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

Update Kotlin to 1.4.21 #3254

Merged
merged 12 commits into from
Jan 19, 2021
Merged

Update Kotlin to 1.4.21 #3254

merged 12 commits into from
Jan 19, 2021

Conversation

arturbosch
Copy link
Member

Also updates Gradle and AssertJ and removes the old dokka 1 plugin workaround.

@arturbosch arturbosch added this to the 1.15.0 milestone Nov 28, 2020
@codecov
Copy link

codecov bot commented Nov 28, 2020

Codecov Report

Merging #3254 (f54e23c) into master (25edc90) will decrease coverage by 0.10%.
The diff coverage is 87.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #3254      +/-   ##
============================================
- Coverage     80.45%   80.34%   -0.11%     
- Complexity     2737     2740       +3     
============================================
  Files           447      448       +1     
  Lines          8287     8279       -8     
  Branches       1573     1581       +8     
============================================
- Hits           6667     6652      -15     
  Misses          772      772              
- Partials        848      855       +7     
Impacted Files Coverage Δ Complexity Δ
...n/io/gitlab/arturbosch/detekt/core/DetektResult.kt 90.00% <0.00%> (-10.00%) 7.00 <1.00> (ø)
.../main/kotlin/io/gitlab/arturbosch/detekt/Detekt.kt 27.95% <ø> (ø) 19.00 <0.00> (ø)
...gitlab/arturbosch/detekt/internal/DetektAndroid.kt 71.87% <ø> (ø) 12.00 <0.00> (ø)
.../io/gitlab/arturbosch/detekt/internal/DetektJvm.kt 59.25% <ø> (ø) 5.00 <0.00> (ø)
...bosch/detekt/rules/bugs/EqualsWithHashCodeExist.kt 88.88% <ø> (ø) 8.00 <0.00> (ø)
...o/gitlab/arturbosch/detekt/internal/DetektPlain.kt 87.50% <87.50%> (ø) 5.00 <5.00> (?)
...kotlin/io/gitlab/arturbosch/detekt/DetektPlugin.kt 80.95% <100.00%> (-3.43%) 9.00 <1.00> (-2.00)
.../detekt/metrics/processors/ProjectCLOCProcessor.kt 100.00% <100.00%> (+5.88%) 3.00 <0.00> (ø)
...n/kotlin/io/gitlab/arturbosch/detekt/rules/Junk.kt 53.33% <100.00%> (+6.66%) 0.00 <0.00> (ø)
.../io/gitlab/arturbosch/detekt/rules/style/NoTabs.kt 93.33% <100.00%> (+5.83%) 9.00 <0.00> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25edc90...5cc9018. Read the comment docs.

@arturbosch
Copy link
Member Author

I'm getting the same stacktrace with Java8 as in CI:

detekt on  update-deps [$] via ☕ v1.8.0
❯ ./detekt-cli/build/run/detekt -i ~/git/repos/detekt
java.lang.RuntimeException: java.util.zip.ZipException: invalid block type
	at org.jetbrains.kotlin.com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:116)
	at org.jetbrains.kotlin.com.intellij.ide.plugins.PluginManagerCore.loadDescriptorFromJar(PluginManagerCore.java:900)
	at org.jetbrains.kotlin.com.intellij.ide.plugins.PluginManagerCore.registerExtensionPointAndExtensions(PluginManagerCore.java:1867)
	at org.jetbrains.kotlin.com.intellij.core.CoreApplicationEnvironment.registerExtensionPointAndExtensions(CoreApplicationEnvironment.java:265)
	at org.jetbrains.kotlin.cli.jvm.compiler.CoreApplicationEnvironmentCompatKt.registerExtensionPointAndExtensionsEx(coreApplicationEnvironmentCompat.kt:17)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerApplicationExtensionPointsAndExtensionsFrom(KotlinCoreEnvironment.kt:537)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createApplicationEnvironment(KotlinCoreEnvironment.kt:508)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.getOrCreateApplicationEnvironmentForProduction(KotlinCoreEnvironment.kt:465)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:419)
	at io.github.detekt.parser.KotlinEnvironmentUtilsKt.createKotlinCoreEnvironment(KotlinEnvironmentUtils.kt:44)
	at io.gitlab.arturbosch.detekt.core.settings.EnvironmentFacade$environment$2.invoke(EnvironmentAware.kt:38)
	at io.gitlab.arturbosch.detekt.core.settings.EnvironmentFacade$environment$2.invoke(EnvironmentAware.kt:22)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at io.gitlab.arturbosch.detekt.core.settings.EnvironmentFacade.getEnvironment(EnvironmentAware.kt)
	at io.gitlab.arturbosch.detekt.core.ProcessingSettings.getEnvironment(ProcessingSettings.kt)
	at io.gitlab.arturbosch.detekt.core.KtTreeCompiler.<init>(KtTreeCompiler.kt:14)
	at io.gitlab.arturbosch.detekt.core.tooling.ParsingStrategyKt$inputPathsToKtFiles$1.invoke(ParsingStrategy.kt:26)
	at io.gitlab.arturbosch.detekt.core.tooling.ParsingStrategyKt$inputPathsToKtFiles$1.invoke(ParsingStrategy.kt)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$filesToAnalyze$1.invoke(Lifecycle.kt:34)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$filesToAnalyze$1.invoke(Lifecycle.kt:22)
	at io.gitlab.arturbosch.detekt.core.util.PerformanceMonitor.measure(PerformanceMonitor.kt:42)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.measure(Lifecycle.kt:30)
	at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.analyze(Lifecycle.kt:34)
	at io.gitlab.arturbosch.detekt.core.tooling.DefaultLifecycle.analyze(Lifecycle.kt:57)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:43)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade$runAnalysis$1.invoke(AnalysisFacade.kt:21)
	at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:24)
	at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:42)
	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:33)
	at io.gitlab.arturbosch.detekt.cli.CliRunner.run(CliRunner.kt:15)
	at io.gitlab.arturbosch.detekt.cli.Main.main(Main.kt:19)
Caused by: java.util.zip.ZipException: invalid block type
	at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
	at org.jetbrains.kotlin.com.intellij.openapi.vfs.CharsetToolkit.inputStreamSkippingBOM(CharsetToolkit.java:117)
	at org.jetbrains.kotlin.com.intellij.openapi.util.JDOMUtil.load(JDOMUtil.java:345)
	at org.jetbrains.kotlin.com.intellij.ide.plugins.PluginManagerCore.loadDescriptorFromJar(PluginManagerCore.java:880)
	... 31 more

@arturbosch
Copy link
Member Author

Also 1.4.20 introduces reflective access warnings when running detekt ...

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.ReflectionUtil (file:/home/artur/git/repos/detekt/detekt-cli/build/run/detekt) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
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

Copy link
Member

@schalkms schalkms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw the same issues locally. What's the plan to move this forward?

@schalkms schalkms changed the title Update Kotlin to 1.4.20 Update Kotlin to 1.4.21 Dec 13, 2020
@arturbosch arturbosch modified the milestones: 1.15.0, 1.16.0 Dec 14, 2020
@arturbosch
Copy link
Member Author

I saw the same issues locally. What's the plan to move this forward?

I haven't really debugged this yet. A quick search was also not successful.
Debugging a detekt run and hold at the crashing point could show some insights.
Maybe we need to configure a new property in the kotlin compiler.

@cortinico
Copy link
Member

I saw the same issues locally. What's the plan to move this forward?

Should we hold on here till Gradle 6.8 is released?

@BraisGabin
Copy link
Member

I rebased this PR because it had conflicts and I wanted to check what was happening. I added a commit updating mockk so now the tests in JDK 8 should work.

But I see the same error locally too.

@BraisGabin

This comment has been minimized.

@chao2zhang
Copy link
Member

Gradle 6.8 is out https://docs.gradle.org/6.8/release-notes.html

@chao2zhang chao2zhang mentioned this pull request Jan 9, 2021
@cortinico
Copy link
Member

Gradle 6.8 is out docs.gradle.org/6.8/release-notes.html

Here you go #3362

@cortinico
Copy link
Member

Is there anything missing? @schalkms are you taking over this branch?

@schalkms
Copy link
Member

I handled the merge conflicts. It works for all JDKs except JDK 8, which is interesting. The build task shows the following error.

java -jar ./detekt-cli/build/run/detekt "@./config/detekt/argsfile"
java.lang.RuntimeException: java.util.zip.ZipException: invalid block type

@chao2zhang
Copy link
Member

chao2zhang commented Jan 14, 2021

I handled the merge conflicts. It works for all JDKs except JDK 8, which is interesting. The build task shows the following error.

java -jar ./detekt-cli/build/run/detekt "@./config/detekt/argsfile"
java.lang.RuntimeException: java.util.zip.ZipException: invalid block type

I am able to reproduce the error locally, which looks like the output executable shadowJarExecutable might not be compatible with this PR.

On the other hand, it looks like running the jar in the traditional way works:
java -jar detekt-cli/build/libs/detekt-cli-1.15.0-all.jar "@./config/detekt/argsfile"

@arturbosch
Copy link
Member Author

I handled the merge conflicts. It works for all JDKs except JDK 8, which is interesting. The build task shows the following error.

java -jar ./detekt-cli/build/run/detekt "@./config/detekt/argsfile"
java.lang.RuntimeException: java.util.zip.ZipException: invalid block type

I am able to reproduce the error locally, which looks like the output executable shadowJarExecutable might not be compatible with this PR.

On the other hand, it looks like running the jar in the traditional way works:
java -jar detekt-cli/build/libs/detekt-cli-1.15.0-all.jar "@./config/detekt/argsfile"

I also can confirm this.

Are there other ways to build an executable from a jar?
We could switch to shipping the zip or tar files ...

@chao2zhang
Copy link
Member

shadowJarExecutable makes it a single executable. If we fallback to detekt-cli/build/libs/detekt-cli-1.15.0-all.jar, we probably need to expose accompanying shell/bat script together.

This probably also explains why we should keep publishing -all.jar as questioned in #3329

@chao2zhang
Copy link
Member

chao2zhang commented Jan 14, 2021

I was wondering how detekt was added to Homebrew. It looks like @chenrui333 is managing the updates for us ❤️ .

The detekt brew formulae were also using detekt-cli/build/libs/detekt-cli-1.15.0-all.jar

@arturbosch arturbosch added the migration Marker to add a migration step in the changelog label Jan 16, 2021
@arturbosch
Copy link
Member Author

shadowJarExecutable makes it a single executable. If we fallback to detekt-cli/build/libs/detekt-cli-1.15.0-all.jar, we probably need to expose accompanying shell/bat script together.

This probably also explains why we should keep publishing -all.jar as questioned in #3329

The mentioned zip/tar archives are built with the application plugin, so they include starting scripts.
Oh, we even already upload the zip file - https://github.com/detekt/detekt/releases/download/v1.15.0/detekt-cli-1.15.0.zip
I will go forward and remove the executable so we can finally ship with Kotlin 1.4.21.

@arturbosch arturbosch force-pushed the update-deps branch 2 times, most recently from 0a5f88d to abb7931 Compare January 16, 2021 21:18
@arturbosch
Copy link
Member Author

Cool stuff! First time seeing the github integration of detekt:

Screenshot from 2021-01-16 22-48-02

With this PR merged, we will see some reflection warnings due to https://youtrack.jetbrains.com/issue/KT-43520 :(

@BraisGabin
Copy link
Member

I'll see how we can restore the executable. If we remove it we need to update our documentation.

@BraisGabin
Copy link
Member

It seems that ktlint has the same issue as we have here:

Kotlin added JDK support in 1.4.20 version. Update is blocked, because CLI fails to run with this Kotlin version.

Extracted from: pinterest/ktlint#1063

@arturbosch arturbosch merged commit a04171a into master Jan 19, 2021
@arturbosch arturbosch deleted the update-deps branch January 19, 2021 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migration Marker to add a migration step in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants