Hey all,

Sorry to keep spamming GWT 2.0 issues.

I've run into a difference in how TypeOracle works that seems to have  
changed in GWT 2.0.  In previous versions, calling  
context.getTypeOracle().getTypes() from a generator would limit itself  
to types available on the <source> paths.  I have some code that took  
advantage of that to build a quick-and-dirty annotation-based  
dependency-injection framework. It generates a single factory class  
which contains methods to initialize all of the injectable classes  
(and injectee) classes available on the <source> path.

It seems that getTypeOracle().getTypes() is now returning all classes  
available on the classpath, rather than limiting itself to <source>- 
specified classes.  These classes are picked up by the factory and  
generated into the new class, which then ends up causing a  
java.lang.NoClassDefFoundError
  when this class is instantiated:

Caused by: java.lang.NoClassDefFoundError: XXX
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getDeclaredConstructors(Class.java:1808)
at  
com 
.google 
.gwt 
.dev 
.shell 
.DispatchClassInfo 
.lazyInitTargetMembersUsingReflectionHelper(DispatchClassInfo.java:163)
at  
com 
.google 
.gwt 
.dev 
.shell.DispatchClassInfo.lazyInitTargetMembers(DispatchClassInfo.java: 
146)
at  
com 
.google 
.gwt.dev.shell.DispatchClassInfo.getMemberId(DispatchClassInfo.java:55)
at com.google.gwt.dev.shell.CompilingClassLoader 
$DispatchClassInfoOracle.getDispId(CompilingClassLoader.java:166)
at  
com 
.google 
.gwt 
.dev.shell.CompilingClassLoader.getDispId(CompilingClassLoader.java:930)
at com.google.gwt.dev.shell.Jsni 
$JsSourceGenWithJsniIdentFixup.visit(Jsni.java:105)
The exception itself is probably a bug (not sure why it didn't trigger  
a compiler error), but I'm not sure if TypeOracle.getTypes() returning  
all types is by design.
I've been looking for an excuse to ditch the custom IoC code for Guice- 
GWT, however.
Matt.

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to