Skip to content

Commit 1b392f4

Browse files
committed
Change the build file to use spotless so the build works with Java 17 and Java 21
1 parent 4d58008 commit 1b392f4

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

build.gradle

+9-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ buildscript {
3131
dependencies { classpath 'org.netbeans.tools:sigtest-maven-plugin:1.5' }
3232
}
3333

34-
plugins { id 'com.github.sherter.google-java-format' version '0.9' apply false }
34+
plugins { id 'com.diffplug.spotless' version "6.23.3" apply false }
3535
plugins { id 'me.champeau.jmh' version '0.6.8' apply false }
3636
plugins { id 'org.sonarqube' version '4.3.1.3277' apply false }
3737

@@ -181,9 +181,14 @@ project(':tools:retrofitter') {
181181
// All projects are checked with googleJavaFormat, Checkstyle and PMD,
182182
// and tested with :asm-test and JUnit.
183183
subprojects {
184-
apply plugin: 'com.github.sherter.google-java-format'
185-
googleJavaFormat.toolVersion = '1.18.1'
186-
googleJavaFormat.exclude 'src/resources/java/**/*'
184+
apply plugin: 'com.diffplug.spotless'
185+
spotless {
186+
java {
187+
target '**/*.java'
188+
targetExclude 'src/resources/java/**/*'
189+
googleJavaFormat('1.18.1')
190+
}
191+
}
187192

188193
// Check the coding style with Checkstyle. Fail in case of error or warning.
189194
apply plugin: 'checkstyle'

tools/retrofitter/src/main/java/org/objectweb/asm/tools/Retrofitter.java

+6
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,12 @@ public MethodVisitor visitMethod(
475475
return new MethodVisitor(
476476
api, super.visitMethod(access, name, descriptor, signature, exceptions)) {
477477

478+
@Override
479+
public void visitParameter(final String name, final int access) {
480+
// Javac 21 generates a Parameter attribute for the synthetic/mandated parameters.
481+
// Remove the Parameter attribute.
482+
}
483+
478484
@Override
479485
public void visitFieldInsn(
480486
final int opcode, final String owner, final String name, final String descriptor) {

0 commit comments

Comments
 (0)