[jOOQ/jOOQ#14806] Upgrade checkerframework to 3.19.0 to better support JDK 17

This commit is contained in:
Lukas Eder 2024-03-22 16:10:15 +01:00
parent 407d0ede93
commit 84971d3b69
5 changed files with 68 additions and 7 deletions

View File

@ -37,6 +37,24 @@
<!-- [#9099] later versions up to 3.1.1 don't appear to work (to be tested with 3.1.2) -->
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- [14806] [#14881] Cannot use release with the below exports flag -->
<release combine.self="override"/>
<compilerArgs>
<!-- [14806] [#14881] The checkerframework 3.19+ requires these -->
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</pluginManagement>

View File

@ -43,7 +43,6 @@ import java.io.PrintWriter;
import org.jooq.checker.Tools.Printer;
import org.checkerframework.framework.source.Result;
import org.checkerframework.framework.source.SourceChecker;
/**
@ -53,11 +52,36 @@ import org.checkerframework.framework.source.SourceChecker;
*/
abstract class AbstractChecker extends SourceChecker {
Void error(Object node, String message) {
getChecker().report(Result.failure(message, node), node);
/*
getChecker().report(org.checkerframework.framework.source.Result.failure(message, node), node);
*/
reportError(node, message);
return null;
}
public SourceChecker getChecker() {
/*
return super.getChecker();
*/
return this;
}
static Void print(Printer printer) {
try (PrintWriter writer = new PrintWriter(new FileWriter("error.txt"))){
writer.println("This is probably a bug in jOOQ-checker.");

View File

@ -40,8 +40,6 @@ package org.jooq.checker;
import static java.util.Arrays.asList;
import static org.checkerframework.javacutil.TreeUtils.elementFromDeclaration;
import static org.checkerframework.javacutil.TreeUtils.elementFromUse;
import static org.checkerframework.javacutil.TreeUtils.enclosingClass;
import static org.checkerframework.javacutil.TreeUtils.enclosingMethod;
import java.io.PrintWriter;
import java.util.EnumSet;
@ -212,12 +210,31 @@ final class Tools {
}
static Element enclosing(TreePath path) {
MethodTree enclosingMethod = enclosingMethod(path);
/*
MethodTree enclosingMethod = org.checkerframework.javacutil.TreeUtils.enclosingMethod(path);
*/
MethodTree enclosingMethod = org.checkerframework.javacutil.TreePathUtil.enclosingMethod(path);
if (enclosingMethod != null)
return elementFromDeclaration(enclosingMethod);
ClassTree enclosingClass = enclosingClass(path);
/*
ClassTree enclosingClass = org.checkerframework.javacutil.TreeUtils.enclosingClass(path);
*/
ClassTree enclosingClass = org.checkerframework.javacutil.TreePathUtil.enclosingClass(path);
return elementFromDeclaration(enclosingClass);
}

View File

@ -38,6 +38,7 @@ Authors and contributors of jOOQ or parts of jOOQ in alphabetical order:
- Miguel Gonzalez Sanchez
- Mustafa Yücel
- Nathaniel Fischer
- Nicholas Chong W.B.
- Octavia Togami
- Oliver Flege
- Per Lundberg

View File

@ -58,6 +58,7 @@
<!-- Examples and/or extension modules use these dependencies -->
<hibernate.version>5.6.15.Final</hibernate.version>
<liquibase.version>4.25.1</liquibase.version>
<checkerframework.version>3.19.0</checkerframework.version>
<spring.version>6.1.3</spring.version>
<!-- [#12884] TODO: Remove explicit upgrade of protobuf-java again when https://github.com/google/error-prone/pull/2819 is released -->
<errorprone.version>2.24.1</errorprone.version>
@ -516,7 +517,7 @@
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>2.5.6</version>
<version>${checkerframework.version}</version>
</dependency>
<dependency>