Skip to content

LinkageError when injecting AsyncProvider subtype #180

Description

@GoogleCodeExporter
What steps will reproduce the problem?

1. Define a class that implements com.google.gwt.inject.client.AsyncProvider 
and inject an instance of it.

Example:

public class AsyncProviderTest implements EntryPoint {

    @NoGinModules
    public interface TestGinjector extends Ginjector {
        void injectMembers(AsyncProviderTest instance);
    }

    public static class FooProvider implements AsyncProvider<Widget> {

        @Override
        public void get(AsyncCallback<? super Widget> callback) {
            callback.onSuccess(null);
        }
    }

    // Loading the FooProvider class results in a LinkageError
    @Inject
    private FooProvider fooProvider;

    public void onModuleLoad() {
        GWT.<TestGinjector> create(TestGinjector.class);
    }
}

What is the expected output? What do you see instead?
Expected: no compilation errors
Result: java.lang.LinkageError: loader constraint violation: loader (instance 
of sun/misc/Launcher$AppClassLoader) previously initiated loading for a 
different type with name "com/google/gwt/user/client/rpc/AsyncCallback"


What version of the product are you using? On what operating system?

GIN 2.0 / Windows 7, Ubuntu 12.04

Please provide any additional information below.

Workaround: add AsyncCallback's package to the "excepted packages" by adding 
the following to your GWT module XML:

<extend-configuration-property name="gin.classloading.exceptedPackages" 
value="com.google.gwt.user.client.rpc" />

Possible solutions: 
a) don't add AsyncProvider to excepted packages/types by default
b) exclude AsyncCallback by default in addition to AsyncProvider

Original issue reported on code.google.com by mcart...@gmail.com on 24 Sep 2012 at 3:36

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions