java 9 - reflection cannot make constructor private
See original GitHub issueA Java 9 issue related to reflection. I ran java -jar .../detekt-cli.jar -p .
against a simple Kotlin project, using Java 9 (build 9-ea+159):
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private jdk.internal.reflect.ConstructorAccessor java.lang.reflect.Constructor.acquireConstructorAccessor() accessible: module java.base does not "opens java.lang.reflect" to unnamed module @34c4973
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Unknown Source)
at java.base/java.lang.reflect.Method.setAccessible(Unknown Source)
at com.intellij.util.ReflectionUtil.findMethod(ReflectionUtil.java:265)
at com.intellij.util.ReflectionUtil.getDeclaredMethod(ReflectionUtil.java:279)
at com.intellij.util.ReflectionUtil.<clinit>(ReflectionUtil.java:422)
... 14 more
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Java: accessing private constructor with type parameters
Yes we can create the object of above class. // reflection concept to get constructor of a Singleton class. Constructor<Singleton> constructor = ...
Read more >How to access private constructor using java reflection
There are a couple of problems. First, getConstructor() looks for public constructors. Use getDeclaredConstructor instead.
Read more >Troubleshooting - The Reflection API
This reflection Java tutorial describes using reflection for accessing and manipulating classes, fields, methods, and constructors.
Read more >Java reflection get private constructor - W3schools.blog
Java reflection get private constructor example program code : The java.lang.Class provides the methods to examine the runtime properties of the object ...
Read more >SEC05-J. Do not use reflection to increase
When a method uses reflection to access class members (that is, uses the APIs belonging to the java.lang.reflect package), the reflection uses the...
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
Thx for the report. I’ve never tested detekt on Java 9 but this seems like a problem from within the kotlin-compiler which will likely be fixed for the Java9 release. I will keep track of this!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics.