jluo-bgl / gwt-ent

Automatically exported from code.google.com/p/gwt-ent
0 stars 0 forks source link

An internal compiler exception occurred com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit. #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

1. GWT version 1.6.4, XP, Eclips Europa, gwt-ent-0.6
2. Trying to implement GWT reflection supported by gwtent.jar on client 
side.
3. Code below
ReflectionTest obj = (ReflectionTest)constructor.newInstance(); 
          Method[] methods = classType.getMethods();
          for (Method method : methods)
              Window.alert(method.toString());

          Method method = classType.findMethod
("setXXX", "java.lang.String");
          classType.invoke(obj, method.getName(), new Object[]
{"ReflectionTest"});
          method.invoke(obj, new String[]{"ReflectionTest"}); 

I am trying to invoke method using Method.invoke and ClassType.invoke but 
both doesn't work giving following exception at compile time.

It works when we call obj.setXXX("ReflectionTest") and gives all the 
method name, if i comment the two line with invoke()

Stack Trace :-

gwtc:
     [java] Compiling module com.google.gwt.sample.hello.Hello
     [java]    [ERROR] An internal compiler exception occurred
     [java] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected 
error during visit.
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.translateException
(JVisitor.java:74)
     [java]     at 
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove
(JModVisitor.java:166)
     [java]     at com.google.gwt.dev.jjs.ast.js.JMultiExpression.traverse
(JMultiExpression.java:60)
     [java]     at 
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove
(JModVisitor.java:162)
     [java]     at com.google.gwt.dev.jjs.ast.js.JMultiExpression.traverse
(JMultiExpression.java:60)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:81)
     [java]     at com.google.gwt.dev.jjs.ast.JReturnStatement.traverse
(JReturnStatement.java:39)
     [java]     at 
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove
(JModVisitor.java:162)
     [java]     at com.google.gwt.dev.jjs.ast.JBlock.traverse
(JBlock.java:36)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:53)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JIfStatement.traverse
(JIfStatement.java:56)
     [java]     at 
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove
(JModVisitor.java:162)
     [java]     at com.google.gwt.dev.jjs.ast.JBlock.traverse
(JBlock.java:36)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JVisitor.accept
(JVisitor.java:94)
     [java]     at com.google.gwt.dev.jjs.ast.JMethodBody.traverse
(JMethodBody.java:52)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.ast.JMethod.traverse
(JMethod.java:194)
     [java]     at com.google.gwt.dev.jjs.ast.JModVisitor.accept
(JModVisitor.java:132)
     [java]     at com.google.gwt.dev.jjs.impl.DeadCodeElimination.execImpl
(DeadCodeElimination.java:1788)
     [java]     at com.google.gwt.dev.jjs.impl.DeadCodeElimination.exec
(DeadCodeElimination.java:1761)
     [java]     at com.google.gwt.dev.jjs.impl.MethodInliner.execImpl
(MethodInliner.java:522)
     [java]     at com.google.gwt.dev.jjs.impl.MethodInliner.exec
(MethodInliner.java:500)
     [java]     at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.optimize
(JavaToJavaScriptCompiler.java:385)
     [java]     at 
com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile
(JavaToJavaScriptCompiler.java:328)
     [java]     at com.google.gwt.dev.Precompile.precompile
(Precompile.java:300)
     [java]     at com.google.gwt.dev.Compiler.run(Compiler.java:170)
     [java]     at com.google.gwt.dev.Compiler$1.run(Compiler.java:124)
     [java]     at com.google.gwt.dev.CompileTaskRunner.doRun
(CompileTaskRunner.java:84)
     [java]     at 
com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger
(CompileTaskRunner.java:78)
     [java]     at com.google.gwt.dev.Compiler.main(Compiler.java:131)
     [java] Caused by: java.lang.NullPointerException
     [java]     at com.google.gwt.dev.jjs.impl.Simplifier.conditional
(Simplifier.java:181)
     [java]     at com.google.gwt.dev.jjs.impl.Simplifier.conditional
(Simplifier.java:132)
     [java]     at 
com.google.gwt.dev.jjs.impl.DeadCodeElimination$DeadCodeVisitor.endVisit
(DeadCodeElimination.java:266)
     [java]     at com.google.gwt.dev.jjs.ast.JConditional.traverse
(JConditional.java:72)
     [java]     at 
com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove
(JModVisitor.java:162)
     [java]     ... 85 more

Original issue reported on code.google.com by dhiraj.c...@gmail.com on 11 Jun 2009 at 12:20

GoogleCodeExporter commented 9 years ago
Hi, Dharij, Thank you for log this.
Can you upload a example for this issue? I can't found out what's wrong with it.
Or you can have a look this test case for more in Reflection
(http://code.google.com/p/gwt-ent/source/browse/trunk/gwtent/test/com/gwtent/cli
ent/test/reflection/ReflectionTestCase.java)

And now you can invoke by this if you have JDK5: method.invoke(obj, 
"ReflectionTest");

Original comment by JamesLuo...@gmail.com on 20 Jun 2009 at 12:09

GoogleCodeExporter commented 9 years ago

Original comment by JamesLuo...@gmail.com on 20 Jun 2009 at 12:09

GoogleCodeExporter commented 9 years ago
Hi James,

I found the mistake, i was trying to invoke a GWT RPC Service or a server side 
object via Reflection.

Which i think is not supported by GWT.

If the above assumption is incorrect then please correct me?

Thank you
Dheeraj

Original comment by dhiraj.c...@gmail.com on 13 Jul 2009 at 4:06