Skip to content

Commit 97358ba

Browse files
committed
Smoke-test the native binary on Java 25 syntax
A compact source file with a module import and an unnamed pattern, formatted by the image itself: this is the syntax palantir#1707 brings, and the image also needs its ImportTree#isModule metadata for it.
1 parent 5e99868 commit 97358ba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ jobs:
130130
env:
131131
JDK21_HOME: ${{ steps.jdk21.outputs.path }}
132132

133-
# The binary itself on a file that needs formatting, a formatted one and one that does not parse.
133+
# The binary itself on a file that needs formatting, a formatted one, one that does not parse and
134+
# one in Java 25 syntax.
134135
- name: Smoke-test the binary
135136
run: |
136137
binary="$PWD/$(ls open-java-format-native/build/native/nativeCompile/open-java-format-* | grep -v '\.txt$')"
@@ -143,6 +144,10 @@ jobs:
143144
printf 'class B {\n' > B.java
144145
set +e; "$binary" B.java; status=$?; set -e
145146
test "$status" -eq 2
147+
# Java 25 syntax: a compact source file with a module import and an unnamed pattern.
148+
printf 'import module java.base;\nrecord Box(int a,int b){}\nvoid main(){Object o=new Box(1,2);if(o instanceof Box(_,_)){IO.println(List.of(1));}}\n' > C.java
149+
"$binary" --replace C.java
150+
printf 'import module java.base;\n\nrecord Box(int a, int b) {}\n\nvoid main() {\n Object o = new Box(1, 2);\n if (o instanceof Box(_, _)) {\n IO.println(List.of(1));\n }\n}\n' | diff - C.java
146151
147152
- name: Test the plugins against the image
148153
run: ./gradlew -PnativeImage=true :open-java-format-jdk-bootstrap:test :gradle-open-java-format:test

0 commit comments

Comments
 (0)