Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Added structural conversion hints for Kotlin: with the caret on an operator or convention-named call you can now convert `a.plus(b)` to `a + b`, `a.get(i)`/`a.set(i, v)` to `a[i]`/`a[i] = v`, `a.contains(b)` to `b in a`, `a.invoke(b)` to `a(b)`, `a.not()`/`a.unaryPlus()` to `!a`/`+a`, and `f() {}` to `f {}` directly from the hint popup.
# 0.11.54 (2026-10-12)

- Added **New → Kotlin Package** for **Source Packages**, **Test Packages**, **Kotlin Source Packages**, and **Kotlin Test Packages**, creating the requested nested package hierarchy exclusively beneath the selected source or test root in Maven, Gradle, and Ant/J2SE projects.
Expand Down
2 changes: 1 addition & 1 deletion CoreImpl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.github.nbplugins</groupId>
<artifactId>netbeans-plugin-kotlin</artifactId>
<version>0.11.282-SNAPSHOT</version>
<version>0.11.284-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>netbeans-plugin-kotlin-core-impl</artifactId>
Expand Down
318 changes: 318 additions & 0 deletions KotlinCodeInsightImpl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.nbplugins</groupId>
<artifactId>netbeans-plugin-kotlin</artifactId>
<version>0.11.284-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>netbeans-plugin-kotlin-code-insight-impl</artifactId>
<packaging>jar</packaging>
<name>Netbeans Plugin Kotlin Code Insight Impl</name>
<description>
Structural-conversion inspections and intentions compiled from
submodules/IntellijCommunity (code-insight/inspections-k2,
code-insight/intentions-k2, code-insight/inspections-shared).
These are the IDEA implementations of operator/function conversions
(a + b &lt;-&gt; a.plus(b), a[i] &lt;-&gt; a.get(i), a in b &lt;-&gt; b.contains(a),
f {} &lt;-&gt; f() {}) consumed by the NetBeans adapter layer in the Nbm module.
</description>

<build>
<!--
Sources are copied from submodule directories into
target/generated-sources/code-insight/ so that gmavenplus patches can modify
copies without dirtying the git submodule, and kotlin-maven-plugin compiles
from one sourceDirectory.
-->
<sourceDirectory>${project.build.directory}/generated-sources/code-insight</sourceDirectory>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>

<!-- code-insight/inspections-k2: K2 inspection implementations -->
<execution>
<id>copy-inspections-k2</id>
<phase>initialize</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/code-insight</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/../submodules/IntellijCommunity/plugins/kotlin/code-insight/inspections-k2/src</directory>
<filtering>false</filtering>
<includes>
<include>org/jetbrains/kotlin/idea/k2/codeinsight/inspections/expressions/ReplaceCallWithBinaryOperatorInspection.kt</include>
<include>org/jetbrains/kotlin/idea/k2/codeinsight/inspections/ReplaceGetOrSetInspection.kt</include>
<include>org/jetbrains/kotlin/idea/k2/codeinsight/inspections/ReplaceContainsInspection.kt</include>
</includes>
</resource>
</resources>
</configuration>
</execution>

<!-- code-insight/intentions-k2: K2 intention implementations -->
<execution>
<id>copy-intentions-k2</id>
<phase>initialize</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/code-insight</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/../submodules/IntellijCommunity/plugins/kotlin/code-insight/intentions-k2/src</directory>
<filtering>false</filtering>
<includes>
<include>org/jetbrains/kotlin/idea/k2/codeinsight/intentions/ReplaceInvokeIntention.kt</include>
<include>org/jetbrains/kotlin/idea/k2/codeinsight/intentions/ReplaceCallWithUnaryOperatorIntention.kt</include>
</includes>
</resource>
</resources>
</configuration>
</execution>

<!-- code-insight/inspections-shared: inspection implementations shared by K1/K2 -->
<execution>
<id>copy-inspections-shared</id>
<phase>initialize</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/code-insight</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/../submodules/IntellijCommunity/plugins/kotlin/code-insight/inspections-shared/src</directory>
<filtering>false</filtering>
<includes>
<include>org/jetbrains/kotlin/idea/codeInsight/inspections/shared/RemoveEmptyParenthesesFromLambdaCallInspection.kt</include>
</includes>
</resource>
</resources>
</configuration>
</execution>

<!-- Local standalone classes for this module -->
<execution>
<id>copy-local-code-insight</id>
<phase>initialize</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/code-insight</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${basedir}/src/main/kotlin</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>

</executions>
</plugin>

<!--
Patch API drift between the IDEA sources and this standalone container.
Each patch is guarded: a missing target only logs a warning.
-->
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<executions>
<execution>
<id>patch-code-insight-impl</id>
<phase>generate-sources</phase>
<goals><goal>execute</goal></goals>
<configuration>
<scripts>
<script><![CDATA[
import java.nio.file.*

def srcDir = new File(project.build.directory, 'generated-sources/code-insight')

// Several IDEA inspections are declared `internal` (Kotlin module-private). The NetBeans
// adapter layer lives in the Nbm module, which is a different Kotlin module, so the
// Kotlin compiler rejects referencing them. Kotlin `internal` is a compile-time-only
// restriction — the bytecode is already public — so widening the declaration here is
// the minimal change that keeps the implementation byte-identical.
def visibilityPatches = [
'org/jetbrains/kotlin/idea/k2/codeinsight/inspections/ReplaceGetOrSetInspection.kt',
'org/jetbrains/kotlin/idea/k2/codeinsight/inspections/expressions/ReplaceCallWithBinaryOperatorInspection.kt',
'org/jetbrains/kotlin/idea/codeInsight/inspections/shared/RemoveEmptyParenthesesFromLambdaCallInspection.kt',
]

visibilityPatches.each { path ->
def f = new File(srcDir, path)
if (!f.exists()) { log.warn("patch target not found: ${path}"); return }
def text = f.text
if (!text.contains('internal class ')) { log.warn("no 'internal class' in ${path}"); return }
f.text = text.replace('internal class ', 'class ')
log.info("Patched ${path}: widened internal -> public")
}
]]></script>
</scripts>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<languageVersion>${kotlin.runtime.languageVersion}</languageVersion>
<apiVersion>${kotlin.runtime.languageVersion}</apiVersion>
<jvmTarget>17</jvmTarget>
<args>
<arg>-Xskip-metadata-version-check</arg>
<arg>-Xcontext-parameters</arg>
<arg>-opt-in=kotlin.ExperimentalContextParameters</arg>
<arg>-opt-in=kotlin.RequiresOptIn</arg>
<arg>-opt-in=org.jetbrains.kotlin.analysis.api.KaExperimentalApi</arg>
<arg>-opt-in=org.jetbrains.kotlin.analysis.api.KaIdeApi</arg>
<arg>-opt-in=org.jetbrains.kotlin.analysis.api.KaContextParameterApi</arg>
</args>
<sourceDirs>
<sourceDir>${project.build.directory}/generated-sources/code-insight</sourceDir>
</sourceDirs>
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals><goal>compile</goal></goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals><goal>compile</goal></goals>
<configuration>
<sourceDirs>
<sourceDir>${project.build.directory}/generated-sources/code-insight</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<!-- IntelliJ platform: PsiElement, Project, codeInspection, modcommand API -->
<dependency>
<groupId>com.jetbrains.intellij.platform</groupId>
<artifactId>core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jetbrains.intellij.platform</groupId>
<artifactId>analysis</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jetbrains.intellij.platform</groupId>
<artifactId>extensions</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.jetbrains.intellij.platform</groupId>
<artifactId>core-impl</artifactId>
<version>193.7288.26</version>
<scope>provided</scope>
<exclusions>
<exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion>
</exclusions>
</dependency>

<!-- Kotlin PSI and compiler internals -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-ir-for-ide</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-common-for-ide</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion>
</exclusions>
</dependency>

<!-- Analysis API: KaSession, resolveToCall, KaNamedFunctionSymbol -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>analysis-api-for-ide</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>analysis-api-impl-base-for-ide</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion>
</exclusions>
</dependency>

<!-- java-psi: PsiClassOwner — supertype of KtFile -->
<dependency>
<groupId>com.jetbrains.intellij.java</groupId>
<artifactId>java-psi</artifactId>
<version>${intellij.platform.253.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion><groupId>*</groupId><artifactId>*</artifactId></exclusion>
</exclusions>
</dependency>

<!-- KotlinFixesImpl: KotlinApplicableInspectionBase, KotlinModCommandQuickFix,
KotlinApplicableModCommandAction, ApplicabilityRange, ApplicableRangesProvider -->
<dependency>
<groupId>io.github.nbplugins</groupId>
<artifactId>netbeans-plugin-kotlin-fixes-impl</artifactId>
</dependency>

<!-- KotlinIntentionUtils: KotlinBundle, KotlinPsiUtils (callExpression,
appendSemicolonBeforeLambdaContainingElement) -->
<dependency>
<groupId>io.github.nbplugins</groupId>
<artifactId>netbeans-plugin-kotlin-intention-utils</artifactId>
</dependency>

<!-- KotlinRefactoring: OperatorToFunctionConverter, ReplaceGetOrSetInspectionUtils,
RemoveEmptyParenthesesFromLambdaCallUtils, allOverriddenSymbolsWithSelf -->
<dependency>
<groupId>io.github.nbplugins</groupId>
<artifactId>netbeans-plugin-kotlin-refactoring</artifactId>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion KotlinCompilerCliBase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.github.nbplugins</groupId>
<artifactId>netbeans-plugin-kotlin</artifactId>
<version>0.11.282-SNAPSHOT</version>
<version>0.11.284-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>netbeans-plugin-kotlin-compiler-cli-base</artifactId>
Expand Down
Loading
Loading