WARNING: Illegal reflective access by com.google.inject.assistedinject.FactoryProvider2
See original GitHub issueI’m seeing this warning when starting Gerrit with Java11:
$ java -jar bazel-bin/release.war init -d ../test_site_gerrit_3.2 --batch --dev
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.assistedinject.FactoryProvider2 (file:/home/davido/.gerritcodereview/tmp/gerrit_6966619352392581698_app/guice-assistedinject-4.2.3.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of com.google.inject.assistedinject.FactoryProvider2
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
The code has even “this isn’t a public API” comment:
// Note: this isn't a public API, but we need to use it in order to call default methods on (or
// with) non-public types. If it doesn't exist, the code falls back to a less precise check.
private static final Constructor<MethodHandles.Lookup> methodHandlesLookupCxtor =
findMethodHandlesLookupCxtor();
private static Constructor<MethodHandles.Lookup> findMethodHandlesLookupCxtor() {
try {
Constructor<MethodHandles.Lookup> cxtor =
MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, int.class);
cxtor.setAccessible(true);
return cxtor;
} catch (ReflectiveOperationException ignored) {
// Ignore, the code falls back to a less-precise check if we can't create method handles.
return null;
}
}
See also this upstream issue: [1].
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How to fix Guice error, "An illegal reflective access operation ...
The issue is due to how Guice internally accesses Java objects, which is unsafe under the new (Java 9+) Java Module System.
Read more >12639 - WARNING: An illegal reflective access operation has ...
That looks like a problem in Guice Assisted Inject v4.2.3: FactoryProvider2 is breaking strong encapsulation. The test *IS* with Vanilla Gerrit.
Read more >New gerrit install 3.3.3 - get this strange error - Google Groups
WARNING: An illegal reflective access operation has occurred. WARNING: Illegal reflective access by com.google.inject.assistedinject.FactoryProvider2 ...
Read more >Unhelpful error on web UI, logs don't seem to show any issues
WARNING : Illegal reflective access by com.google.inject.assistedinject.FactoryProvider2$MethodHandleWrapper (file:/usr/sha
Read more >[JENKINS-46620] [JDK9] Illegal reflective access from guice 4.0
WARNING : Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/var/jenkins_home/war/WEB-INF/lib/guice-4.0.jar) to method ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was kind of hoping this would be fixed by 5.0.0-BETA-1, but nope, it’s still there.
Correct.