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
// Java file to test
import java.util.Random;
public class Hello {
public long getRandom() {
Random r = new Random();
// nextLong(long, long) is available in Java 17
return r.nextLong(100L, 500L);
}
}
run ./gradlew build, it passed
comment out sourceCompatibility, and use toolchain config, run ./gradlew build again, it failed as expected because the api version
Expected Behavior
It should use only Java 11 features to compile.
Current Behavior
When using new features, e.g. a Java API in new version, it does not report error.
Context
When build a java lib, using sourceCompatibility does not detect the version compatibility problem.
Steps to Reproduce
./gradlew build
, it passed./gradlew build
again, it failed as expected because the api versionresult:
error: method nextLong in class Random cannot be applied to given types;
Your Environment
$ ./gradlew --version
The text was updated successfully, but these errors were encountered: