Update of /cvsroot/nice/Nice/src/bossa/link
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20234/src/bossa/link
Modified Files:
Dispatch.java
Log Message:
Check that imported Java methods do not have missing implementations.
Be more clever about what Java methods not to test, to save time.
Index: Dispatch.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/bossa/link/Dispatch.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** Dispatch.java 22 Feb 2004 13:33:23 -0000 1.65
--- Dispatch.java 24 Feb 2004 14:05:53 -0000 1.66
***************
*** 100,104 ****
Stack sortedAlternatives = Alternative.sortedAlternatives(m);
! if (! trivialTestOK(sortedAlternatives))
test(m, sortedAlternatives, true);
--- 100,104 ----
Stack sortedAlternatives = Alternative.sortedAlternatives(m);
! if (! trivialTestJava(m, sortedAlternatives))
test(m, sortedAlternatives, true);
***************
*** 123,126 ****
--- 123,148 ----
}
+ private static boolean trivialTestJava(JavaMethod m, Stack alternatives)
+ {
+ gnu.bytecode.Method reflectMethod = m.reflectMethod;
+
+ // Static methods and constructors cannot be overriden, so there is
+ // no problem.
+ if (reflectMethod.getStaticFlag() || reflectMethod.isConstructor())
+ return true;
+
+ if (! reflectMethod.isAbstract())
+ // The only risk with a non abstract method is that it might be
+ // ambiguous.
+ // We know this won't happen in two cases:
+ // 1) if there is only one argument (single
+ // inheritance, since the root must be a class),
+ // 2) if there are less than two implementations.
+ return m.getArity() == 1 || alternatives.size() < 2;
+
+ // This method will need testing.
+ return false;
+ }
+
private static boolean[] findUsedPositions(int len, Stack alternatives)
{
|