question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java 9 - reflection cannot make constructor private

See original GitHub issue

A 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
arturboschcommented, Mar 24, 2017

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!

0reactions
lock[bot]commented, Jun 20, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found