aspakh / google-gin

Automatically exported from code.google.com/p/google-gin
Apache License 2.0
0 stars 0 forks source link

Ginjector interface generated during GWT compilation cannot be found #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have a project (Mvp4g) where I use a GWT generator to create a 
GInjector. The generator creates this java code: 

public class Mvp4gModuleImpl implements Mvp4gModule { 

    ... 
    @GinModules({com.mvp4g.example.client.Mvp4gGinModule.class}) 
    public interface com_mvp4g_client_Mvp4gModuleGinjector extends 
Ginjector { 
      com.mvp4g.example.client.main.MainPresenter 
getcom_mvp4g_example_client_main_MainPresenter(); 
      com.mvp4g.example.client.main.MainView 
getcom_mvp4g_example_client_main_MainPresenterView(); 
      com.mvp4g.client.history.ClearHistory 
getcom_mvp4g_client_history_ClearHistory(); 

com.mvp4g.example.client.main.historyConverter.MenuHistoryConverter 
getcom_mvp4g_example_client_main_historyConverter_MenuHistoryConverter(); 
    } 

    ... 

    public void createAndStartModule(){ 
      final com_mvp4g_client_Mvp4gModuleGinjector injector = 
GWT.create( com_mvp4g_client_Mvp4gModuleGinjector.class ); 

This works fine with gin-1.0 but when I try it with the gin trunk, I 
got this error: 
16:55:04.235 [ERROR] [mvp4gmodules] Unable to load ginjector type 
[com.mvp4g.client.Mvp4gModuleImpl.com_mvp4g_client_Mvp4gModuleGinjector], 
maybe you haven't compiled your client java sources? 
java.lang.ClassNotFoundException: com$mvp4g$client$Mvp4gModuleImpl 
$com_mvp4g_client_Mvp4gModuleGinjector 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248) 
    at java.lang.Class.forName0(Native Method) 
    at java.lang.Class.forName(Class.java:169) 
    at 
com.google.gwt.inject.rebind.reflect.ReflectUtil.loadClass(ReflectUtil.java­: 
363) 
    at 
com.google.gwt.inject.rebind.GinjectorGenerator.getGinjectorType(GinjectorG­ene
rator.java: 
57) 
    at 
com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator­.ja
va: 
36) 
    at 
com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.ja­va:

48) 
    at 
com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(Generator­Ext
Wrapper.java: 
60) 
    at 
com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally­(St
andardGeneratorContext.java: 
662) 

This is due to the move to Java reflection: 
http://groups.google.com/group/google-gin/browse_thread/thread/9d7f7ed8e2ba5581

Original issue reported on code.google.com by plcoir...@gmail.com on 12 Feb 2011 at 6:41

GoogleCodeExporter commented 8 years ago
Thanks for reporting this. The reason for the problem is that Gin no longer 
loads ginjector definitions from GWT's type oracle and thus can't see freshly 
generated ginjectors. I'm looking into exposing a class loader based on the 
type oracle which would allow us to see any generated code such as the one 
reported in this issue.

Original comment by aragos on 12 Feb 2011 at 10:53

GoogleCodeExporter commented 8 years ago

Original comment by aragos on 17 Feb 2011 at 4:57

GoogleCodeExporter commented 8 years ago
Sorry for the delay - the basic gist of it is that GWT's support is less ideal 
than I'd have liked to. However, I've written a solution that solves this 
problem for now and have thoughts on how to deal with it should GWT change 
their internal representation.

Please review this change here: http://codereview.appspot.com/4276072

Original comment by aragos on 22 Mar 2011 at 11:12

GoogleCodeExporter commented 8 years ago
Fixed in r188.

Original comment by aragos on 23 Mar 2011 at 11:36

GoogleCodeExporter commented 8 years ago
I too granny problem with  Computing:
What is the expected output? What do you see instead?
a working sample.

What you get is:

 Validating units:
      Ignored 17 units with compilation errors in first pass.
Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   Computing all possible rebind results for 'com.mvp4g.client.Mvp4gModule'
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 19 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Generating source for com.mvp4g.client.Mvp4gModuleImpl 
            Mvp4g Compilation: 170ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 6 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 10ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 8 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 13ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 13ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 8 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 21 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 25ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 8 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 13ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 7 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 7 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 11ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 7 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 11ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 8 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 11ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 6 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 9ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 8 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 13ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 8 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 12ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 9 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 15ms.
      Rebinding com.mvp4g.client.Mvp4gModule
         Invoking generator com.mvp4g.util.Mvp4gGenerator
            4272 classes scanned in 10 ms.
            Generating writer for com.mvp4g.client.Mvp4gModuleImpl
            Mvp4g Compilation: 14ms.

Original comment by zakia.la...@gmail.com on 11 Nov 2014 at 8:27