Add JDK 23 information and example for annotation processing#939
Add JDK 23 information and example for annotation processing#939desruisseaux merged 10 commits intoapache:masterfrom
Conversation
| import java.util.jar.Manifest; | ||
| import java.util.stream.Stream; | ||
|
|
||
| import javax.lang.model.SourceVersion; |
There was a problem hiding this comment.
Imports where changed by spotless:apply
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
Outdated
Show resolved
Hide resolved
|
@slawekjaranowski Any idea why builds fails to spotless, even that I DO apply spotless? |
…ly when building the project.
…new dependency mechanism of Maven 4. Change indentation from 4 spaces to 2 spaces for consistency with other examples in APT files.
Maven 4 way to declare a processor
| <artifactId>hibernate-processor</artifactId> | ||
| <version>{version.hibernate}</version> | ||
| </path> | ||
| </annotationProcessorPaths> |
There was a problem hiding this comment.
This is the Maven 3 way. While it still work in Maven 4, it is marked as deprecated. The Maven 4 way would be to put the processor in <dependencies> with <type>processor</type>.
Should we copy this page in its current form to the 3.x branch, then edit this page on the master branch for the Maven 4 way?
| ``` | ||
|
|
||
| ### Maven 4 | ||
| Using Maven 4 and Maven Compiler Plugin 4.x, you can still use the same config as for Maven 3 and plugin version 3.x. |
There was a problem hiding this comment.
Actually, the Maven 3 way is deprecated in the Maven 4 plugin. One reason for that is because the Maven 3 way does not provide control on class-path versus module-path. If we agree about this deprecation, and if we want to encourage users to migrate to the Maven 4 way, should the Maven 4 section be first?
There was a problem hiding this comment.
Another possible advantage of the Maven 4 way may be security. In the Maven 3 way, the compiler plugin is the only plugin to know which annotation processors were executed. In the Maven 4 way, all plugins can have this information. Therefore, a "bill of material" plugin could include this information in its report if desired.
There was a problem hiding this comment.
I updated the section, but left it below the Maven 3 section. I can totally not make a good assumption how fast Maven 4 will be adopted. I personally think quite quick, but many of the long time committer think it will take years.
Since JDK 23 no annotation processing is done by default for security reason.
This PR adds information about this and also adds an example page how to do it in general and what is the recommended way to execute annotation processing (which applies also to earlier JDK versions).