Skip to content

Allow Bazel's own build to use Java 11 language features #14592

@cushon

Description

@cushon

Bazel's build now requires a minimum of JDK 11, but it's still configured to use Java 8 language features.

We should enable Java 11 language features for Bazel.

e.g.

 git diff
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/DigestHashFunction.java b/src/main/java/com/google/devtools/build/lib/vfs/DigestHashFunction.java
index 8d5fd508f8..e760bb31d0 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/DigestHashFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/DigestHashFunction.java
@@ -187,7 +187,7 @@ public class DigestHashFunction {

   private static boolean supportsClone(MessageDigest toCheck) {
     try {
-      toCheck.clone();
+      var unused = toCheck.clone();
       return true;
     } catch (CloneNotSupportedException e) {
       return false;
$ bazel build //src:bazel
...
src/main/java/com/google/devtools/build/lib/vfs/DigestHashFunction.java:190: warning: as of release 10, 'var' is a restricted local variable type and cannot be used for type declarations or as the element type of an array
      var unused = toCheck.clone();
          ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions