Skip to content

Commit ebd4a80

Browse files
committed
bug: Fix IntelliJ crash due to regex typo
This change fixes an issue where importing a Gradle project into IntelliJ crashes the IDEA plugin, due to a typo in a regex searching for the compiler plugin.
1 parent 19fbbe9 commit ebd4a80

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

plugin-idea/src/main/kotlin/nl/fabianm/kotlin/plugin/generated/idea/GeneratedImportHandler.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ internal object GeneratedImportHandler {
3232
private val PLUGIN_JPS_JAR: String?
3333
get() = PathManager.getJarPathForClass(GeneratedCommandLineProcessor::class.java)
3434

35+
/**
36+
* The implementation title to search for.
37+
*/
38+
private val PLUGIN_IMPLEMENTATION_TITLE = "nl.fabianm.kotlin.plugin.generated"
39+
3540
/**
3641
* The [Logger] instance for this class.
3742
*/
@@ -49,7 +54,7 @@ internal object GeneratedImportHandler {
4954

5055
val facetSettings = facet.configuration.settings
5156
val commonArguments = facetSettings.compilerArguments ?: CommonCompilerArguments.DummyImpl()
52-
val regex = "(.*\\${File.separator}?$buildSystemPluginJar-.*\\.jar".toRegex()
57+
val regex = ".*\\${File.separator}?$buildSystemPluginJar-.*\\.jar".toRegex()
5358

5459
// Remove the incompatible compiler plugin from the classpath if found
5560
var isEnabled = false
@@ -82,7 +87,7 @@ internal object GeneratedImportHandler {
8287
return try {
8388
val jar = JarInputStream(FileInputStream(path))
8489
val manifest = jar.manifest
85-
manifest.mainAttributes.getValue("Implementation-Title").startsWith("nl.fabianm.kotlin.plugin.generated")
90+
manifest.mainAttributes.getValue("Implementation-Title").trim().equals(PLUGIN_IMPLEMENTATION_TITLE, ignoreCase = true)
8691
} catch (_: Exception) {
8792
false
8893
}

0 commit comments

Comments
 (0)