I can't repro this on a smaller scale. I created small project with two modules and TypeOracle was populated correctly (GWT 2.0-RC1 and trunk), even when compiling both modules together or running DevMode with both modules specified.
I'll keep trying to reproduce this, sorry for the false alarm. Matt. On 20-Nov-09, at 11:05 AM, Scott Blum wrote: > Hi Matt, > > I need more information, because on the face of it, I don't see how > we can be pulling in all types in all cases. We have specific type > oracle tests that check how many types total end up in type oracle. > If it was a fundamental problem, these tests should be blowing up. > Example: > > http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/test/com/google/gwt/dev/javac/TypeOracleMediatorTest.java#1060 > > So, I stuck added the following code at the end of > TypeOracleMediator.addNewUnits() and compiled the Hello sample: > > StringBuilder sb = new StringBuilder(); > for (JClassType type : typeOracle.getTypes()) { > String sn = type.getQualifiedSourceName(); > if (sn.contains(".client.")) { > continue; > } > if (sn.contains(".shared.")) { > continue; > } > if (sn.startsWith("java.")) { > continue; > } > if (sn.startsWith("com.google.gwt.lang.")) { > continue; > } > sb.append(sn); > sb.append('\n'); > } > PerfLogger.end(); <---- breakpoint here > > I didn't see anything get added that shouldn't be there. Can you > dig into this a little or put together a small sample? > > Thanks, > Scott > > On Thu, Nov 19, 2009 at 10:40 PM, Matt Mastracci <matt...@mastracci.com > > wrote: > 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 > > > -- > http://groups.google.com/group/Google-Web-Toolkit-Contributors -- http://groups.google.com/group/Google-Web-Toolkit-Contributors