Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

"InjectAdapter uses unchecked or unsafe operations" when injecting parameterized type into generic class #500

@mattlogan

Description

@mattlogan

I'm seeing the following compiler warning with field injection of a parameterized type inside a generic class:

Note: <path to generated class>/Foo$$InjectAdapter.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

As a simple example, I'm using the following generic class:

public class Foo<T> {
    @Inject Bar<Baz> bazBar;
}

And the following module:

@Module(
           injects = Foo.class
)
public class MainModule {
    @Provides Bar<Baz> provideBazBar() {
        return new Bar<>();
    }
}

To verify, clone this sample project and run ./gradlew clean compileDebugJavaWithJavac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions