ktlint icon indicating copy to clipboard operation
ktlint copied to clipboard

Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.ReflectionUtil in 0.47.0

Open kkocel opened this issue 3 years ago • 4 comments

I noticed that Illegal reflective access reappeared:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.ReflectionUtil (file:/opt/homebrew/Cellar/ktlint/0.47.0/libexec/ktlint) to field java.lang.Throwable.backtrace
WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.com.intellij.util.ReflectionUtil
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

kkocel avatar Aug 29 '22 13:08 kkocel

I expect this to be a problem caused by a transitive dependency. At least that seemed the solution in https://github.com/pinterest/ktlint/issues/1143. Please add a clear reproduction path (with exact java version) and sample project.

paul-dingemans avatar Aug 30 '22 19:08 paul-dingemans

$ java --version
openjdk 17.0.3 2022-04-19 LTS
OpenJDK Runtime Environment (build 17.0.3+7-LTS)
OpenJDK 64-Bit Server VM (build 17.0.3+7-LTS, mixed mode, sharing)

Reproduction:

  1. checkout sample project: https://github.com/kkocel/ktlint-reproduction
  2. run ktlint -F
  3. Observed behavior:
$ ktlint -F
13:28:16.135 [main] INFO com.pinterest.ktlint.internal.KtlintCommandLine - Enable default patterns [**/*.kt, **/*.kts]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.ReflectionUtil (file:/opt/homebrew/Cellar/ktlint/0.47.0/libexec/ktlint) to field java.lang.Throwable.backtrace
WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.com.intellij.util.ReflectionUtil
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

kkocel avatar Aug 31 '22 11:08 kkocel

I just found that @Goooler already reported this to jetbrains as a comment on https://youtrack.jetbrains.com/issue/KT-43704. I am doubting whether it gets any priority from the kotlin team. So until then, you have to ignore it, or try one of the workarounds mentioned in the issue.

paul-dingemans avatar Sep 01 '22 18:09 paul-dingemans

Also

  • https://youtrack.jetbrains.com/issue/KT-53226
  • https://youtrack.jetbrains.com/issue/KT-51619

Goooler avatar Sep 01 '22 18:09 Goooler