fmgasparino / google-gin

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

@Inject public ActivityProxy(Provider<A> activityProvider) not supported ? #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
--> What steps will reproduce the problem?
I'm using the new 'Activity' interfaces provided by GWT. In order to enhance 
the functionality, and allow a page to load his javascript only once called, I 
use the following class:

public final class ActivityProxy<A extends Activity> implements Activity {

  private final Provider<A> activityProvider;
  private Activity activity;
  private boolean isCancelled;

  @Inject
  public ActivityProxy(Provider<A> activityProvider) {
    this.activityProvider = activityProvider;
  }

  @Override
  public String mayStop() {
    if(activity != null) {
      return activity.mayStop();
    }
    return null;
  }

  @Override
  public void onCancel() {
    isCancelled = true;
    if(activity != null) {
      activity.onCancel();
    }
  }

  @Override
  public void onStop() {
    if(activity != null) {
      activity.onStop();
    }
  }

  @Override
  public void start(final AcceptsOneWidget panel, final EventBus eventBus) {
    isCancelled = false;
    GWT.runAsync(new RunAsyncCallback() {

      @Override
      public void onFailure(Throwable reason) {
          throw new RuntimeException(reason);
      }

      @Override
      public void onSuccess() {
        activity = activityProvider.get();
        if(!isCancelled) {
          activity.start(panel, eventBus);
        }
      }

    });    
  }

And somewhere else in my code I have something like:

@Inject
public MyActivityMapper(ActivityProxy<HomepageActivity> myHomepageActivity){
    ...
}

This code is succesfully compiled with GWT-2.1.1 and gin-1.0, but this isn't 
working anymore with GWT-2.2.0 and gin-head.

--> What is the expected output? What do you see instead?
When I compile my application, I have an unexpected (and not really clear) 
error message.

 [java] Compiling module com.freemymove.ufe.UserFrontEnd
     [java]    Scanning for additional dependencies: file:/C:/wamp/www/Unswitch/dev/ufe/src/com/freemymove/ufe/client/UserFrontEnd.java
     [java]       Computing all possible rebind results for 'com.freemymove.ufe.client.UserFrontEndGinjector'
     [java]          Rebinding com.freemymove.ufe.client.UserFrontEndGinjector
     [java]             Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
     [java]                [ERROR] Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception while rebinding 'com.freemymove.ufe.client.UserFrontEndGinjector'
     [java] java.lang.NullPointerException
     [java]     at com.google.gwt.inject.rebind.util.SourceWriteUtil.getBinaryName(SourceWriteUtil.java:530)
     [java]     at com.google.gwt.inject.rebind.util.SourceWriteUtil.getJniSignature(SourceWriteUtil.java:497)
     [java]     at com.google.gwt.inject.rebind.util.SourceWriteUtil.getJsniSignature(SourceWriteUtil.java:467)
     [java]     at com.google.gwt.inject.rebind.util.SourceWriteUtil.createMethodCallWithInjection(SourceWriteUtil.java:312)
     [java]     at com.google.gwt.inject.rebind.util.SourceWriteUtil.createMethodCallWithInjection(SourceWriteUtil.java:213)
     [java]     at com.google.gwt.inject.rebind.util.SourceWriteUtil.createConstructorInjection(SourceWriteUtil.java:191)
     [java]     at com.google.gwt.inject.rebind.binding.CallConstructorBinding.appendCreationStatement(CallConstructorBinding.java:54)
     [java]     at com.google.gwt.inject.rebind.binding.CreatorBinding.writeCreatorMethods(CreatorBinding.java:66)
     [java]     at com.google.gwt.inject.rebind.GinjectorOutputter.outputBinding(GinjectorOutputter.java:210)
     [java]     at com.google.gwt.inject.rebind.GinjectorOutputter.outputBindings(GinjectorOutputter.java:187)
     [java]     at com.google.gwt.inject.rebind.GinjectorOutputter.output(GinjectorOutputter.java:143)
     [java]     at com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorImpl.java:73)
     [java]     at com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:66)

--> What version of the product are you using? On what operating system?
The issue appears on GWT-2.2.0 and the head version of gin. I'm under Windows 7.

--> Please provide any additional information below.
N/A

Original issue reported on code.google.com by cdebuss...@gmail.com on 5 Apr 2011 at 3:58

GoogleCodeExporter commented 9 years ago
This is a bug caused by missing packages during class loading. Working on it.

Original comment by aragos on 5 Apr 2011 at 4:12