You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gradle can run with a JDK that's different from the one that's used to compile, and that means it could run with a lower version of the JDK, lower even than the configured java.targetCompatibility, and that causes signature parsing errors.
For example, running Gradle with JDK 11 while using a JDK 21 toolchain and targetCompatibility will cause this error:
> Task :example:forbiddenApisMain FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':example:forbiddenApisMain'.
> Parsing signatures failed: Method not found while parsing signature: java.text.NumberFormat#getCompactNumberInstance()
I would add that Forbidden APIs, particularly as it creates a task for each source set, should read that source set's JavaCompile task's own targetCompatibility rather than the project-wide java.targetCompatibility.
The Forbidden APIs task should itself use a toolchain/JavaLauncher with the Worker API to make sure (or at least make it possible for) the Forbidden APIs checker runs in a JDK compatible with the target compatibility.
The text was updated successfully, but these errors were encountered:
Gradle can run with a JDK that's different from the one that's used to compile, and that means it could run with a lower version of the JDK, lower even than the configured
java.targetCompatibility
, and that causes signature parsing errors.For example, running Gradle with JDK 11 while using a JDK 21 toolchain and targetCompatibility will cause this error:
I would add that Forbidden APIs, particularly as it creates a task for each source set, should read that source set's
JavaCompile
task's owntargetCompatibility
rather than the project-widejava.targetCompatibility
.The Forbidden APIs task should itself use a toolchain/
JavaLauncher
with the Worker API to make sure (or at least make it possible for) the Forbidden APIs checker runs in a JDK compatible with the target compatibility.The text was updated successfully, but these errors were encountered: