Skip to content

Commit

Permalink
Improve JDK 17 support
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 373882999
  • Loading branch information
cushon authored and Error Prone Team committed May 14, 2021
1 parent 65a75c9 commit ff07935
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Expand Up @@ -55,10 +55,13 @@ public boolean anyMatch(Predicate<Symbol> predicate) {
private static final Class<?> FILTER_CLASS = getFilterClass();

private static Class<?> getFilterClass() {
if (RuntimeVersion.isAtLeast17()) {
return null;
}
try {
return Class.forName("com.sun.tools.javac.util.Filter");
} catch (ClassNotFoundException e) {
return null;
throw new LinkageError(e.getMessage(), e);
}
}

Expand Down
Expand Up @@ -90,6 +90,11 @@ public static boolean isAtLeast16() {
return MAJOR >= 16;
}

/** Returns true if the current runtime is JDK 17 or newer. */
public static boolean isAtLeast17() {
return MAJOR >= 17;
}

/**
* Returns the latest {@code --release} version.
*
Expand Down

0 comments on commit ff07935

Please sign in to comment.