Skip to content

Commit fb65de6

Browse files
Enable annotation processors in JDK 22 (#302)
* enable processors in JDK 22 * Update README.md * Update README.md * Update pom.xml * dependabot * Update dependabot-merge.yml * Update pom.xml --------- Co-authored-by: Rob Bygrave <130515035+rob-bygrave@users.noreply.github.com>
1 parent 19e5677 commit fb65de6

File tree

7 files changed

+59
-21
lines changed

7 files changed

+59
-21
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: maven
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
open-pull-requests-limit: 10
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v1
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
- name: Approve a PR
19+
run: gh pr review --approve "$PR_URL"
20+
env:
21+
PR_URL: ${{github.event.pull_request.html_url}}
22+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
23+
# - name: Enable auto-merge for Dependabot PRs
24+
# if: ${{contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
25+
# run: gh pr merge --auto --merge "$PR_URL"
26+
# env:
27+
# PR_URL: ${{github.event.pull_request.html_url}}
28+
# GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ Use source code generation to adapt annotated REST controllers `@Path, @Get, @Po
4545
</dependency>
4646
```
4747

48+
### JDK 22+
49+
50+
In JDK 22+, annotation processors are disabled by default, you will need to add a flag to re-enable.
51+
```xml
52+
<plugin>
53+
<groupId>org.apache.maven.plugins</groupId>
54+
<artifactId>maven-compiler-plugin</artifactId>
55+
<configuration>
56+
<compilerArgument>-proc:full</compilerArgument>
57+
</configuration>
58+
</plugin>
59+
```
60+
4861
## Define a Controller (These APT processors work with Java and Kotlin.)
4962
```java
5063
package org.example.hello;

http-generator-jex/pom.xml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,13 @@
1616
<artifactId>avaje-http-generator-core</artifactId>
1717
<version>${project.version}</version>
1818
</dependency>
19-
19+
20+
<dependency>
21+
<groupId>io.avaje</groupId>
22+
<artifactId>avaje-prisms</artifactId>
23+
<version>${avaje.prisms.version}</version>
24+
<scope>provided</scope>
25+
</dependency>
26+
2027
</dependencies>
21-
22-
23-
<build>
24-
<plugins>
25-
<plugin>
26-
<groupId>org.apache.maven.plugins</groupId>
27-
<artifactId>maven-compiler-plugin</artifactId>
28-
<version>3.10.1</version>
29-
<configuration>
30-
<source>11</source>
31-
<target>11</target>
32-
<!-- Turn off annotation processing for building -->
33-
<compilerArgument>-proc:none</compilerArgument>
34-
</configuration>
35-
</plugin>
36-
</plugins>
37-
</build>
38-
39-
4028
</project>

http-generator-jex/src/main/java/io/avaje/http/generator/jex/JexProcessor.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import io.avaje.http.generator.core.BaseProcessor;
44
import io.avaje.http.generator.core.ControllerReader;
55
import io.avaje.http.generator.core.PlatformAdapter;
6+
import io.avaje.prism.AnnotationProcessor;
67

78
import java.io.IOException;
89

10+
@AnnotationProcessor
911
public class JexProcessor extends BaseProcessor {
1012

1113
@Override

http-generator-jex/src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77

88
// SHADED: All content after this line will be removed at package time
99
requires transitive io.avaje.http.generator.core;
10+
requires static io.avaje.prism;
1011
}

http-generator-jex/src/main/resources/META-INF/services/javax.annotation.processing.Processor

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)