Menu

#35 anObject.getClass().getMethods()

open
5
2009-01-15
2009-01-15
No

anObject.getClass().getMethods() is not working in 2.0 but it worked in 1.0. due to some problem i can't find, the following program will fail

public class ReflectionBug {
public static void main(String[] args) {
test1();
System.out.println("finnished");
}
private static void test1() {
Method[] mts = ReflectionBug.class.getMethods();
}
}

in ClassExt.js, function Clazz.innerFunctions.getDeclaredMethods firefox says that java.lang.reflect.Modifier have no properties. If the later class is decorated with:

/** @j2sRequireImport java.lang.reflect.Modifier */

it works fine.

In old versions of java2script I had similar problems when static code calling static code. The sollution was always j2sRequireImport. But in newer versions of java2script this bugs tend to be fixed.

I think the problem coud be: because compilation unit java.lang.Class is kind of native, it dependencies are not loaded in a common way. I think it is wise to force the loading of this kind of "native compilation unit" dependencies.

Discussion


Log in to post a comment.