apache / apache/maven-compiler-plugin

[MCOMPILER-310] Different behaviour between JDK 8 / JDK 9 related to annotation processor usage

Open
#513 7 comments 0 reactions 0 assignees View on GitHub
bug priority:critical
Dominant language
Java
Stars
261
Forks
191
Avg merge
1d 5h
Merged PRs (30d)
8

Description

**[Karl Heinz Marbaise](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=khmarbaise)** opened **[MCOMPILER-310](https://issues.apache.org/jira/browse/MCOMPILER-310?redirect=false)** and commented

Based on the [SO question](https://stackoverflow.com/questions/46500984/immutables-dont-generate-code-with-java-9-with-modules) is looks like we have a difference in behaviour between JDK 8 / JDK 9 related to the picking up of annotation processors.
If you run the following code under JDK 8 (except for a module-info.java file):

```xml

4.0.0

example
jigsaw
1.0-SNAPSHOT


UTF-8



org.immutables
value
2.5.6
provided




org.apache.maven.plugins
maven-compiler-plugin
3.7.0


```

The maven-compiler-plugin will automatically pickup the annotation processor and produce the classed from the annotation.
If you run the same with JDK 9 this will not work anymore. Only if you explicitly add the annotation processor configuration to maven-compiler-plugin it will work as expected:

```xml

4.0.0

example
jigsaw
1.0-SNAPSHOT


UTF-8



org.immutables
value
2.5.6
provided




org.apache.maven.plugins
maven-compiler-plugin
3.7.0

9
9


org.immutables
value
2.5.6





```

I'm not sure if this is based on the usage of modules (module-path instead of classpath)?

---

**Affects:** 3.7.0

5 votes, 10 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided Maven POM and run the annotation-processor example under JDK 8 and JDK 9, comparing automatic discovery with explicit annotationProcessorPaths. Read the maven-compiler-plugin configuration involved in annotation processing and verify whether module-path behavior explains the difference. Done means the discrepancy is reproduced, its expected handling is agreed, and a regression check is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.