rzo1 opened a new pull request, #332:
URL: https://github.com/apache/openjpa/pull/332

   https://issues.apache.org/jira/browse/OPENJPA-2734
   
   The metamodel annotation processor (`AnnotationProcessor6`, in 
openjpa-persistence) was only registered as a 
`javax.annotation.processing.Processor` service in the aggregate `openjpa` 
module. With the individual jars, javac did not find it unless `-processor` was 
given.
   
   Changes:
   - The service file moves to openjpa-persistence. openjpa and openjpa-all 
already merge `META-INF/services` with the shade plugin's 
`ServicesResourceTransformer`, so each of `openjpa-persistence.jar`, 
`openjpa.jar` and `openjpa-all.jar` lists the processor exactly once (checked 
in the built jars).
   - `openjpa-persistence` compiles its main classes with `<proc>none</proc>`: 
the service file is copied to `target/classes` before the processor class is 
compiled, which made javac fail with "Provider ... not found" on JDK 17-22.
   - `AnnotationProcessor6.process()` returns false when metamodel generation 
is off, so it no longer claims `@Entity`, `@Embeddable` and `@MappedSuperclass` 
from other processors on the same path. With `-Aopenjpa.metamodel=true` nothing 
changes.
   - The processor stays inactive unless `-Aopenjpa.metamodel=true` is set. On 
JDK 21/22 javac prints a note that annotation processing is enabled when it 
finds processors on the class path (`-proc:none` turns it off); from JDK 23 on 
javac does not run class path processors without `-processorpath`, `-proc:full` 
or `-processor`. The manual (criteria chapter) and the migration notes are 
updated accordingly.
   
   Tests: new `TestAnnotationProcessorRegistration` in openjpa-persistence: the 
processor is found via `ServiceLoader`, a `javax.tools` compile with 
`-Aopenjpa.metamodel=true` and no `-processor` generates the metamodel class, 
without the option nothing is generated and no compiler messages appear, and an 
inactive processor does not claim the annotations. openjpa-lib, openjpa-kernel 
and openjpa-persistence pass, built with JDK 17 and 25.
   
   TCK: https://github.com/apache/openjpa/actions/runs/46485392510, Databases: 
https://github.com/apache/openjpa/actions/runs/46485271927 (running)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to