Skip to content

Target the published javac plugin at Java 8#1

Merged
wasabii merged 6 commits into
mainfrom
copilot/create-java-compiler-plugin
May 30, 2026
Merged

Target the published javac plugin at Java 8#1
wasabii merged 6 commits into
mainfrom
copilot/create-java-compiler-plugin

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 30, 2026

The plugin was built with a newer Java target and used post-Java-8 language features, which prevented it from working as a Java 8 javac plugin. This change keeps the Gradle build on a modern JDK while making the published plugin artifact Java 8-compatible.

  • Build targeting

    • Compile plugin main sources with a Java 8 toolchain.
    • Resolve javac APIs from the Java 8 tools.jar so the plugin links against the Java 8 compiler surface.
    • Keep test/build execution on Java 17.
  • Source compatibility

    • Replace pattern-matching instanceof usage in production code with Java 8-compatible casts and control flow.
    • Preserve existing constructor-invocation detection and stripping behavior.
  • Compatibility guardrail

    • Add a test that asserts the emitted plugin classes target Java 8 bytecode (major version 52).
tasks.named<JavaCompile>("compileJava") {
    javaCompiler = java8Compiler
    sourceCompatibility = JavaVersion.VERSION_1_8.toString()
    targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

@wasabii wasabii marked this pull request as ready for review May 30, 2026 03:53
@wasabii wasabii merged commit 3ebc966 into main May 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants