google / guice

Guice (pronounced 'juice') is a lightweight dependency injection framework for Java 11 and above, brought to you by Google.
https://github.com/google/guice
Apache License 2.0
12.41k stars 1.66k forks source link

Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 #1524

Open znakeeye opened 3 years ago

znakeeye commented 3 years ago

Running android-arscblamer I got this error for my APK:

INFO: Build completed successfully, 22 total actions
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/C:/Users/foo/_bazel_foo/sajszmsi/external/guice/jar/guice-4.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.NullPointerException
        at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:890)
        at com.google.devrel.gmscore.tools.apk.arsc.PackageChunk.getTypeSpecChunk(PackageChunk.java:202)
        at com.google.devrel.gmscore.tools.apk.arsc.ResourceEntryStatsCollector.computeTypeSpecSizes(ResourceEntryStatsCollector.java:175)
        at com.google.devrel.gmscore.tools.apk.arsc.ResourceEntryStatsCollector.computeTypeSpecSizes(ResourceEntryStatsCollector.java:117)
        at com.google.devrel.gmscore.tools.apk.arsc.ResourceEntryStatsCollector.computePackageSizes(ResourceEntryStatsCollector.java:95)
        at com.google.devrel.gmscore.tools.apk.arsc.ResourceEntryStatsCollector.compute(ResourceEntryStatsCollector.java:73)
        at com.google.devrel.gmscore.tools.apk.arsc.ArscDumper.dumpEntries(ArscDumper.java:209)
        at com.google.devrel.gmscore.tools.apk.arsc.ArscDumper.dumpEntries(ArscDumper.java:194)
        at com.google.devrel.gmscore.tools.apk.arsc.ArscDumper.main(ArscDumper.java:115)

This APK was minified with android.enableR8.fullMode=true if that matters.

mcculls commented 3 years ago

Have you tried the latest 5.0.1 release of Guice? It doesn't use CGLIB and won't produce this message.

znakeeye commented 3 years ago

Changed the version to 5.0.1 in my WORKSPACE and those warnings did disappear. The exception still occurs though.

maven_jar(
    name = "guice",
    artifact = "com.google.inject:guice:5.0.1",
)
mcculls commented 3 years ago

The NullPointerException is coming from android-arscblamer code, specifically https://github.com/google/android-arscblamer/blob/master/java/com/google/devrel/gmscore/tools/apk/arsc/PackageChunk.java#L202 - it doesn't appear to be related to any injection performed by Guice.

I'd suggest contacting the android-arscblamer project to find out why the typeSpecs chunk is null for that id.