Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-23 Thread Matt Mastracci
I'm getting closer to figuring out exactly what happened here.  The  
extra classes that were getting included were all under root-package/ 
client.  I've restructured our half-dozen GWT modules so that they all  
inherit source paths and imports from a basic set of root modules.   
For modules that differ only in entry point, the module XML looks  
something like this:

module
inherits name='rootpackage.Common' /
entry-point class='rootpackage.othermodule.Module' /
/module

When GWT loads a module without any source elements in a module, it  
adds an implicit source path=client / in ModuleDefSchema. After  
some module refactoring that took place in my GWT 2.0 porting work,  
the modules that no longer had source paths after I had modified the  
modules were causing extra source to be silently imported:

(from ModuleDefSchema):

 // Maybe infer source and public.
 //
 if (!foundExplicitSourceOrSuperSource) {
   bodySchema.addSourcePackage(modulePackageAsPath, client,  
Empty.STRINGS,
   Empty.STRINGS, true, true, false);
 }


I can no longer reproduce the specific crash below, but I strongly  
suspect it was related to the other compiler errors.

I'll work around the implicit source path issue for now by using fake  
source paths in modules that don't have any additional source  
imports.  If possible, it would be useful if there were a log warning  
explaining that the source path is defaulting to client.

After fixing this, I managed to get my first GWT 2.0 build working  
from the command line with a free 4% savings on final code size. :)

Thanks,
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 

Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-23 Thread John Tamplin
On Mon, Nov 23, 2009 at 1:33 PM, Matt Mastracci matt...@mastracci.comwrote:

 I'll work around the implicit source path issue for now by using fake
 source paths in modules that don't have any additional source
 imports.  If possible, it would be useful if there were a log warning
 explaining that the source path is defaulting to client.


I don't think that warning there would be good, as that is a pretty common
default - basically if you are using the recommended package setup and you
don't have server-shared code, the common case is not needing any source
tag in your module.

-- 
John A. Tamplin
Software Engineer (GWT), Google

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

Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-23 Thread Bruce Johnson
Maybe not a warning, but maybe an INFO-level log entry, or perhaps a
TRACE-level one. I think the default introduction of source path=client is
net confusing. Forcing people to specify it would have helped (forced?)
people to understand what is going on.

On Mon, Nov 23, 2009 at 1:40 PM, John Tamplin j...@google.com wrote:

 On Mon, Nov 23, 2009 at 1:33 PM, Matt Mastracci matt...@mastracci.comwrote:

 I'll work around the implicit source path issue for now by using fake
 source paths in modules that don't have any additional source
 imports.  If possible, it would be useful if there were a log warning
 explaining that the source path is defaulting to client.


 I don't think that warning there would be good, as that is a pretty common
 default - basically if you are using the recommended package setup and you
 don't have server-shared code, the common case is not needing any source
 tag in your module.

 --
 John A. Tamplin
 Software Engineer (GWT), Google

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


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

Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-23 Thread Ray Ryan
FWIW, this confusion is exactly why webAppCreator no longer generates
projects that use the implicit include. I wonder if we shouldn't flat out
deprecate it--in which case a warning would be the right thing.

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

Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-23 Thread Isaac Truett
+1 deprecate and warn.

On Mon, Nov 23, 2009 at 2:24 PM, Ray Ryan rj...@google.com wrote:
 FWIW, this confusion is exactly why webAppCreator no longer generates
 projects that use the implicit include. I wonder if we shouldn't flat out
 deprecate it--in which case a warning would be the right thing.

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

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


Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-23 Thread Bruce Johnson
let's remember to talk about this more for the release after 2.0

On Mon, Nov 23, 2009 at 2:26 PM, Isaac Truett itru...@gmail.com wrote:

 +1 deprecate and warn.

 On Mon, Nov 23, 2009 at 2:24 PM, Ray Ryan rj...@google.com wrote:
  FWIW, this confusion is exactly why webAppCreator no longer generates
  projects that use the implicit include. I wonder if we shouldn't flat out
  deprecate it--in which case a warning would be the right thing.
 
  --
  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

Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-23 Thread Matt Mastracci
Filed a bug on this: 
http://code.google.com/p/google-web-toolkit/issues/detail?id=4268

On 23-Nov-09, at 12:40 PM, Bruce Johnson wrote:

 let's remember to talk about this more for the release after 2.0

 On Mon, Nov 23, 2009 at 2:26 PM, Isaac Truett itru...@gmail.com  
 wrote:
 +1 deprecate and warn.

 On Mon, Nov 23, 2009 at 2:24 PM, Ray Ryan rj...@google.com wrote:
  FWIW, this confusion is exactly why webAppCreator no longer  
 generates
  projects that use the implicit include. I wonder if we shouldn't  
 flat out
  deprecate it--in which case a warning would be the right thing.
 
  --
  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

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

Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-20 Thread Scott Blum
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

http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/test/com/google/gwt/dev/javac/TypeOracleMediatorTest.java#1054So,
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.comwrote:

 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

Re: [gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-20 Thread Matt Mastracci
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

[gwt-contrib] TypeOracle allTypes including types not in a source path

2009-11-19 Thread Matt Mastracci
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