Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detekt 1.22.0: Dependency on openJdk@17: Missing module options (java.lang.reflect.InaccessibleObjectException [...] module java.base does not "opens java.lang" to unnamed module) #116784

Closed
2 tasks done
rowi1de opened this issue Nov 27, 2022 · 1 comment
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age

Comments

@rowi1de
Copy link
Contributor

rowi1de commented Nov 27, 2022

brew gist-logs <formula> link OR brew config AND brew doctor output

brew config
HOMEBREW_VERSION: 3.6.12
ORIGIN: https://github.com/Homebrew/brew
HEAD: 759ab2d0bdc6b0d1f810d6e9351c834d027809f7
Last commit: 8 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: d03c0d1e3f46e23859803643324a2083d320e5ac
Core tap last commit: 3 days ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_BROWSER: open
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: vi
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: dodeca-core 64-bit kabylake
Clang: 14.0.0 build 1400
Git: 2.38.1 => /usr/local/bin/git
Curl: 7.84.0 => /usr/bin/curl
macOS: 13.0.1-x86_64
CLT: N/A


brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  lerna
  python@3.10
  kubernetes-cli
  node

Verification

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

  • Running detekt --auto-correct --build-upon-default-config --plugins /path/to/detekt-formatting-1.22.0.jar

It's missing --add-opens java.base/java.lang=ALL-UNNAMED when running detekt.jar

See detekt/detekt#5247 (comment)

What happened (include all command output)?

java.lang.IllegalStateException: Analyzing /Users/robertwiesner/repo/detekt-cli-issue5247/src/main/kotlin/de/rowi1de/config/SomeKotlin.kt led to an exception.
Location: org.jetbrains.kotlin.com.intellij.util.exception.FrequentErrorLogger.report(FrequentErrorLogger.java:47)
The original exception message was: null
Running detekt '1.22.0' on Java '17.0.5+0' on OS 'Mac OS X'
If the exception message does not help, please feel free to create an issue on our GitHub page.
        at io.gitlab.arturbosch.detekt.core.AnalyzerKt.throwIllegalStateException(Analyzer.kt:184)
        at io.gitlab.arturbosch.detekt.core.AnalyzerKt.access$throwIllegalStateException(Analyzer.kt:1)
        at io.gitlab.arturbosch.detekt.core.Analyzer.runSync(Analyzer.kt:74)
        at io.gitlab.arturbosch.detekt.core.Analyzer.run(Analyzer.kt:52)
        at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$result$1.invoke(Lifecycle.kt:47)
        at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$result$1.invoke(Lifecycle.kt:44)
        at io.gitlab.arturbosch.detekt.core.util.PerformanceMonitor.measure(PerformanceMonitor.kt:42)
        at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.measure(Lifecycle.kt:34)
        at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.analyze(Lifecycle.kt:44)
        at io.gitlab.arturbosch.detekt.core.tooling.DefaultLifecycle.analyze(Lifecycle.kt:61)
        at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:48)
        at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:47)
        at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:26)
        at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:47)
        at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.run(AnalysisFacade.kt:25)
        at io.gitlab.arturbosch.detekt.cli.runners.Runner.call(Runner.kt:33)
        at io.gitlab.arturbosch.detekt.cli.CliRunner.run(CliRunner.kt:31)
        at io.gitlab.arturbosch.detekt.cli.CliRunner.run(CliRunner.kt:14)
        at io.gitlab.arturbosch.detekt.cli.Main.main(Main.kt:18)
Caused by: java.lang.ExceptionInInitializerError
        at org.jetbrains.kotlin.com.intellij.util.exception.FrequentErrorLogger.report(FrequentErrorLogger.java:47)
        at org.jetbrains.kotlin.com.intellij.util.exception.FrequentErrorLogger.info(FrequentErrorLogger.java:43)
        at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.handleUnspecifiedTrace(DebugUtil.java:628)
        at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.currentInvalidationTrace(DebugUtil.java:620)
        at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.calcInvalidationTrace(DebugUtil.java:614)
        at org.jetbrains.kotlin.com.intellij.psi.impl.DebugUtil.onInvalidated(DebugUtil.java:585)
        at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement.onInvalidated(TreeElement.java:226)
        at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement.invalidate(TreeElement.java:328)
        at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement.rawRemove(TreeElement.java:312)
        at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.TreeElement.rawReplaceWithList(TreeElement.java:319)
        at org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafElement.rawReplaceWithText(LeafElement.java:146)
        at com.pinterest.ktlint.ruleset.standard.IndentationRule.visitWhiteSpace(IndentationRule.kt:851)
        at com.pinterest.ktlint.ruleset.standard.IndentationRule.beforeVisitChildNodes(IndentationRule.kt:343)
        at io.gitlab.arturbosch.detekt.formatting.FormattingRule.beforeVisitChildNodes(FormattingRule.kt:113)
        at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visitASTNodes(FormattingRule.kt:126)
        at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visitASTNodes(FormattingRule.kt:129)
        at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visitASTNodes(FormattingRule.kt:129)
        at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visitASTNodes(FormattingRule.kt:129)
        at io.gitlab.arturbosch.detekt.formatting.FormattingRule.visit(FormattingRule.kt:84)
        at io.gitlab.arturbosch.detekt.formatting.KtLintMultiRule.visit(KtLintMultiRule.kt:145)
        at io.gitlab.arturbosch.detekt.api.BaseRule.visitFile(BaseRule.kt:46)
        at io.gitlab.arturbosch.detekt.core.Analyzer.analyze$executeRules(Analyzer.kt:130)
        at io.gitlab.arturbosch.detekt.core.Analyzer.analyze(Analyzer.kt:141)
        at io.gitlab.arturbosch.detekt.core.Analyzer.runSync(Analyzer.kt:73)
        ... 16 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.Object java.lang.Throwable.backtrace accessible: module java.base does not "opens java.lang" to unnamed module @29428716
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
        at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.findFieldInHierarchy(ReflectionUtil.java:154)
        at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.getDeclaredField(ReflectionUtil.java:279)
        at org.jetbrains.kotlin.com.intellij.openapi.util.objectTree.ThrowableInterner.<clinit>(ThrowableInterner.java:88)
        ... 40 more

What did you expect to happen?

detekt works with JDK 17 which was added here https://github.com/Homebrew/homebrew-core/blame/04c92a907a3c0a1cefa2e22aeee8a39cae9d47f6/Formula/detekt.rb#L17

Step-by-step reproduction instructions (by running brew commands)

brew install detekt

DETEKT_VERSION=$(detekt --version)
export DETEKT_VERSION
export DETEKT_PLUGINS="detekt/plugins"

if [[ ! -e "$DETEKT_PLUGINS/detekt-formatting-$DETEKT_VERSION.jar" ]]; then
    rm -rf $DETEKT_PLUGINS
    mkdir $DETEKT_PLUGINS
    http --download https://github.com/detekt/detekt/releases/download/v$DETEKT_VERSION/detekt-formatting-$DETEKT_VERSION.jar --output "$DETEKT_PLUGINS/detekt-formatting-$DETEKT_VERSION.jar"
fi


detekt --debug --auto-correct --max-issues 0 --input src --build-upon-default-config  --plugins detekt/plugins/detekt-formatting-$DETEKT_VERSION.jar

or see https://github.com/rowi1de/detekt-cli-issue5247/blob/main/.envrc

@rowi1de rowi1de added the bug Reproducible Homebrew/homebrew-core bug label Nov 27, 2022
@rowi1de rowi1de changed the title detekt 1.22.0: Dependency on JDK 17 but missing module options (java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.Object java.lang.Throwable.backtrace accessible: module java.base does not "opens java.lang" to unnamed module @29428716) detekt 1.22.0: Dependency on JDK 17 but missing module options (java.lang.reflect.InaccessibleObjectException [...] module java.base does not "opens java.lang" to unnamed module @29428716) Nov 27, 2022
@rowi1de rowi1de changed the title detekt 1.22.0: Dependency on JDK 17 but missing module options (java.lang.reflect.InaccessibleObjectException [...] module java.base does not "opens java.lang" to unnamed module @29428716) detekt 1.22.0: Dependency on JDK 17 but missing module options (java.lang.reflect.InaccessibleObjectException [...] module java.base does not "opens java.lang" to unnamed module) Nov 27, 2022
rowi1de pushed a commit to rowi1de/homebrew-core that referenced this issue Nov 27, 2022
- With the upgrade from openjdk@11 to openjdk@17 the formula breaks when running detekt
- See Homebrew#116784
@rowi1de rowi1de changed the title detekt 1.22.0: Dependency on JDK 17 but missing module options (java.lang.reflect.InaccessibleObjectException [...] module java.base does not "opens java.lang" to unnamed module) detekt 1.22.0: Dependency on openJdk@17: Missing module options (java.lang.reflect.InaccessibleObjectException [...] module java.base does not "opens java.lang" to unnamed module) Nov 27, 2022
BrewTestBot pushed a commit that referenced this issue Nov 28, 2022
* [FIX] Detekt Add --add-opens java.base/java.lang=ALL-UNNAMED
  - With the upgrade from openjdk@11 to openjdk@17 the formula breaks when running detekt
  - See #116784
* Review: Add link to detekt issue to remove workaround
* Review: reminder to remove workaround after root cause is fixed

Closes #116785.

Co-authored-by: Sean Molenaar <SMillerDev@users.noreply.github.com>
Signed-off-by: Sean Molenaar <1484494+SMillerDev@users.noreply.github.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
@rowi1de
Copy link
Contributor Author

rowi1de commented Nov 28, 2022

Fixed via #116785

@rowi1de rowi1de closed this as completed Nov 28, 2022
@github-actions github-actions bot added the outdated PR was locked due to age label Dec 29, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant