From 73a0dbfcc0869a534ed9e75c26b2c097fee37015 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 28 Oct 2019 13:22:21 -0700 Subject: Restore checkerframework annotations I3e4794368c1369ccb32f24e55df030afe6a784d7 reverted upstream commit d0fcced7ecc9108d70ae2aea0ae3db00aacf3924 to move from checkerframework annotations back to jsr305 annotations. An upcoming turbine change uses the @Nullable in a location that is not valid for the jsr305 annotations but is valid for the checkerframework annotations. We don't have a real copy of the checkerframework annotations in the tree, but we do have a copy packaged into dagger2-auto-value. Restore the java/ directory to match upstream, and let dagger2-auto-value provide the annotations for now. Test: m turbine Change-Id: If7f38e6b54aba2581c0e82a311a1d8e0d5722181 --- Android.bp | 1 - java/com/google/turbine/binder/CtSymClassBinder.java | 2 +- java/com/google/turbine/binder/JimageClassBinder.java | 2 +- java/com/google/turbine/binder/bound/BoundClass.java | 2 +- java/com/google/turbine/binder/bound/ModuleInfo.java | 2 +- java/com/google/turbine/binder/bound/SourceModuleInfo.java | 2 +- .../google/turbine/binder/bound/SourceTypeBoundClass.java | 2 +- .../google/turbine/binder/bytecode/BytecodeBoundClass.java | 2 +- java/com/google/turbine/binder/env/CompoundEnv.java | 2 +- java/com/google/turbine/binder/lookup/CompoundScope.java | 2 +- .../google/turbine/binder/lookup/CompoundTopLevelIndex.java | 2 +- java/com/google/turbine/binder/lookup/Scope.java | 2 +- .../google/turbine/binder/lookup/SimpleTopLevelIndex.java | 2 +- java/com/google/turbine/bytecode/ClassFile.java | 12 +++++------- java/com/google/turbine/bytecode/ClassReader.java | 2 +- java/com/google/turbine/bytecode/sig/Sig.java | 2 +- java/com/google/turbine/lower/Lower.java | 2 +- java/com/google/turbine/options/TurbineOptions.java | 2 +- java/com/google/turbine/options/TurbineOptionsParser.java | 2 +- java/com/google/turbine/parse/ConstExpressionParser.java | 5 ++--- java/com/google/turbine/parse/Parser.java | 2 +- java/com/google/turbine/types/Canonicalize.java | 2 +- 22 files changed, 26 insertions(+), 30 deletions(-) diff --git a/Android.bp b/Android.bp index e6006ea..a7b9442 100644 --- a/Android.bp +++ b/Android.bp @@ -26,7 +26,6 @@ java_library_host { static_libs: [ "error_prone_annotations", "guava-21.0", - "jsr305-3.0.1", ], plugins: ["dagger2-auto-value"], diff --git a/java/com/google/turbine/binder/CtSymClassBinder.java b/java/com/google/turbine/binder/CtSymClassBinder.java index d9d74ab..84fa966 100644 --- a/java/com/google/turbine/binder/CtSymClassBinder.java +++ b/java/com/google/turbine/binder/CtSymClassBinder.java @@ -37,7 +37,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** Constructs a platform {@link ClassPath} from the current JDK's ct.sym file. */ public class CtSymClassBinder { diff --git a/java/com/google/turbine/binder/JimageClassBinder.java b/java/com/google/turbine/binder/JimageClassBinder.java index b32b8ea..e3d0865 100644 --- a/java/com/google/turbine/binder/JimageClassBinder.java +++ b/java/com/google/turbine/binder/JimageClassBinder.java @@ -51,7 +51,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** Constructs a platform {@link ClassPath} from the current JDK's jimage file using jrtfs. */ public class JimageClassBinder { diff --git a/java/com/google/turbine/binder/bound/BoundClass.java b/java/com/google/turbine/binder/bound/BoundClass.java index ad26af7..61dee0f 100644 --- a/java/com/google/turbine/binder/bound/BoundClass.java +++ b/java/com/google/turbine/binder/bound/BoundClass.java @@ -19,7 +19,7 @@ package com.google.turbine.binder.bound; import com.google.common.collect.ImmutableMap; import com.google.turbine.binder.sym.ClassSymbol; import com.google.turbine.model.TurbineTyKind; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** * The initial bound tree representation. diff --git a/java/com/google/turbine/binder/bound/ModuleInfo.java b/java/com/google/turbine/binder/bound/ModuleInfo.java index 9afd474..f21213b 100644 --- a/java/com/google/turbine/binder/bound/ModuleInfo.java +++ b/java/com/google/turbine/binder/bound/ModuleInfo.java @@ -19,7 +19,7 @@ package com.google.turbine.binder.bound; import com.google.common.collect.ImmutableList; import com.google.turbine.binder.sym.ClassSymbol; import com.google.turbine.type.AnnoInfo; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A bound module declaration (see JLS §7.7). */ public class ModuleInfo { diff --git a/java/com/google/turbine/binder/bound/SourceModuleInfo.java b/java/com/google/turbine/binder/bound/SourceModuleInfo.java index b763ede..1163e9f 100644 --- a/java/com/google/turbine/binder/bound/SourceModuleInfo.java +++ b/java/com/google/turbine/binder/bound/SourceModuleInfo.java @@ -16,7 +16,6 @@ package com.google.turbine.binder.bound; -import javax.annotation.Nullable; import com.google.common.collect.ImmutableList; import com.google.turbine.binder.bound.ModuleInfo.ExportInfo; import com.google.turbine.binder.bound.ModuleInfo.OpenInfo; @@ -25,6 +24,7 @@ import com.google.turbine.binder.bound.ModuleInfo.RequireInfo; import com.google.turbine.binder.bound.ModuleInfo.UseInfo; import com.google.turbine.diag.SourceFile; import com.google.turbine.type.AnnoInfo; +import org.checkerframework.checker.nullness.qual.Nullable; /** A {@link ModuleInfo} that corresponds to a source file being compiled. */ public class SourceModuleInfo extends ModuleInfo { diff --git a/java/com/google/turbine/binder/bound/SourceTypeBoundClass.java b/java/com/google/turbine/binder/bound/SourceTypeBoundClass.java index 7314f72..69a2593 100644 --- a/java/com/google/turbine/binder/bound/SourceTypeBoundClass.java +++ b/java/com/google/turbine/binder/bound/SourceTypeBoundClass.java @@ -29,7 +29,7 @@ import com.google.turbine.type.AnnoInfo; import com.google.turbine.type.Type; import com.google.turbine.type.Type.ClassTy; import com.google.turbine.type.Type.TyKind; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A HeaderBoundClass for classes compiled from source. */ public class SourceTypeBoundClass implements TypeBoundClass { diff --git a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java index 6e882e6..6ff8cb4 100644 --- a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java +++ b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java @@ -58,7 +58,7 @@ import com.google.turbine.type.Type.IntersectionTy; import java.lang.annotation.RetentionPolicy; import java.util.Map; import java.util.function.Function; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A bound class backed by a class file. diff --git a/java/com/google/turbine/binder/env/CompoundEnv.java b/java/com/google/turbine/binder/env/CompoundEnv.java index 43ce768..9b216e3 100644 --- a/java/com/google/turbine/binder/env/CompoundEnv.java +++ b/java/com/google/turbine/binder/env/CompoundEnv.java @@ -19,7 +19,7 @@ package com.google.turbine.binder.env; import static java.util.Objects.requireNonNull; import com.google.turbine.binder.sym.Symbol; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** An {@link Env} that chains two existing envs together. */ public class CompoundEnv implements Env { diff --git a/java/com/google/turbine/binder/lookup/CompoundScope.java b/java/com/google/turbine/binder/lookup/CompoundScope.java index a14eb05..11309bf 100644 --- a/java/com/google/turbine/binder/lookup/CompoundScope.java +++ b/java/com/google/turbine/binder/lookup/CompoundScope.java @@ -18,7 +18,7 @@ package com.google.turbine.binder.lookup; import static com.google.common.base.Preconditions.checkNotNull; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A {@link Scope} that chains other scopes together. */ public class CompoundScope implements Scope { diff --git a/java/com/google/turbine/binder/lookup/CompoundTopLevelIndex.java b/java/com/google/turbine/binder/lookup/CompoundTopLevelIndex.java index 526e493..de50a2e 100644 --- a/java/com/google/turbine/binder/lookup/CompoundTopLevelIndex.java +++ b/java/com/google/turbine/binder/lookup/CompoundTopLevelIndex.java @@ -19,7 +19,7 @@ package com.google.turbine.binder.lookup; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableList; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A {@link TopLevelIndex} that aggregates multiple indices into one. */ // Note: this implementation doesn't detect if the indices contain incompatible information, diff --git a/java/com/google/turbine/binder/lookup/Scope.java b/java/com/google/turbine/binder/lookup/Scope.java index 682a62a..12466f4 100644 --- a/java/com/google/turbine/binder/lookup/Scope.java +++ b/java/com/google/turbine/binder/lookup/Scope.java @@ -16,7 +16,7 @@ package com.google.turbine.binder.lookup; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A scope that defines types, and supports qualified name resolution. */ public interface Scope { diff --git a/java/com/google/turbine/binder/lookup/SimpleTopLevelIndex.java b/java/com/google/turbine/binder/lookup/SimpleTopLevelIndex.java index 99aa464..2454319 100644 --- a/java/com/google/turbine/binder/lookup/SimpleTopLevelIndex.java +++ b/java/com/google/turbine/binder/lookup/SimpleTopLevelIndex.java @@ -21,7 +21,7 @@ import com.google.turbine.binder.sym.ClassSymbol; import java.util.HashMap; import java.util.Map; import java.util.Objects; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** * An index of canonical type names where all members are known statically. diff --git a/java/com/google/turbine/bytecode/ClassFile.java b/java/com/google/turbine/bytecode/ClassFile.java index 422f8c6..54b6983 100644 --- a/java/com/google/turbine/bytecode/ClassFile.java +++ b/java/com/google/turbine/bytecode/ClassFile.java @@ -26,7 +26,7 @@ import java.util.ArrayDeque; import java.util.Deque; import java.util.List; import java.util.Map; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A JVMS §4.1 ClassFile. */ public class ClassFile { @@ -131,7 +131,7 @@ public class ClassFile { private final String name; private final String descriptor; @Nullable private final String signature; - @Nullable private final Const.Value value; + private final Const.@Nullable Value value; private final List annotations; private final ImmutableList typeAnnotations; @@ -174,8 +174,7 @@ public class ClassFile { } /** The compile-time constant value. */ - @Nullable - public Const.Value value() { + public Const.@Nullable Value value() { return value; } @@ -234,7 +233,7 @@ public class ClassFile { private final String descriptor; @Nullable private final String signature; private final List exceptions; - @Nullable private final AnnotationInfo.ElementValue defaultValue; + private final AnnotationInfo.@Nullable ElementValue defaultValue; private final List annotations; private final ImmutableList> parameterAnnotations; private final ImmutableList typeAnnotations; @@ -290,8 +289,7 @@ public class ClassFile { } /** The value of the AnnotationDefault attribute. */ - @Nullable - public AnnotationInfo.ElementValue defaultValue() { + public AnnotationInfo.@Nullable ElementValue defaultValue() { return defaultValue; } diff --git a/java/com/google/turbine/bytecode/ClassReader.java b/java/com/google/turbine/bytecode/ClassReader.java index dc5e050..a894997 100644 --- a/java/com/google/turbine/bytecode/ClassReader.java +++ b/java/com/google/turbine/bytecode/ClassReader.java @@ -35,7 +35,7 @@ import com.google.turbine.bytecode.ClassFile.ModuleInfo.UseInfo; import com.google.turbine.model.Const; import java.util.ArrayList; import java.util.List; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A JVMS §4 class file reader. */ public class ClassReader { diff --git a/java/com/google/turbine/bytecode/sig/Sig.java b/java/com/google/turbine/bytecode/sig/Sig.java index 8a326ec..e85740f 100644 --- a/java/com/google/turbine/bytecode/sig/Sig.java +++ b/java/com/google/turbine/bytecode/sig/Sig.java @@ -18,7 +18,7 @@ package com.google.turbine.bytecode.sig; import com.google.common.collect.ImmutableList; import com.google.turbine.model.TurbineConstantTypeKind; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** JVMS 4.7.9.1 signatures. */ public class Sig { diff --git a/java/com/google/turbine/lower/Lower.java b/java/com/google/turbine/lower/Lower.java index 97fbd6e..16447ab 100644 --- a/java/com/google/turbine/lower/Lower.java +++ b/java/com/google/turbine/lower/Lower.java @@ -84,7 +84,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** Lowering from bound classes to bytecode. */ public class Lower { diff --git a/java/com/google/turbine/options/TurbineOptions.java b/java/com/google/turbine/options/TurbineOptions.java index 3bc9755..0ce0c13 100644 --- a/java/com/google/turbine/options/TurbineOptions.java +++ b/java/com/google/turbine/options/TurbineOptions.java @@ -21,7 +21,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import java.util.Optional; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** Header compilation options. */ public class TurbineOptions { diff --git a/java/com/google/turbine/options/TurbineOptionsParser.java b/java/com/google/turbine/options/TurbineOptionsParser.java index 5b1f326..55697ca 100644 --- a/java/com/google/turbine/options/TurbineOptionsParser.java +++ b/java/com/google/turbine/options/TurbineOptionsParser.java @@ -29,7 +29,7 @@ import java.nio.file.Paths; import java.util.ArrayDeque; import java.util.Deque; import java.util.Iterator; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A command line options parser for {@link TurbineOptions}. */ public class TurbineOptionsParser { diff --git a/java/com/google/turbine/parse/ConstExpressionParser.java b/java/com/google/turbine/parse/ConstExpressionParser.java index c6cb284..b3666a4 100644 --- a/java/com/google/turbine/parse/ConstExpressionParser.java +++ b/java/com/google/turbine/parse/ConstExpressionParser.java @@ -31,7 +31,7 @@ import com.google.turbine.tree.Tree.Expression; import com.google.turbine.tree.Tree.Ident; import com.google.turbine.tree.TurbineOperatorKind; import java.util.Optional; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** A parser for compile-time constant expressions. */ public class ConstExpressionParser { @@ -419,8 +419,7 @@ public class ConstExpressionParser { return new Tree.Unary(position, expr, op); } - @Nullable - private Tree.Expression qualIdent() { + private Tree.@Nullable Expression qualIdent() { int pos = position; ImmutableList.Builder bits = ImmutableList.builder(); bits.add(ident()); diff --git a/java/com/google/turbine/parse/Parser.java b/java/com/google/turbine/parse/Parser.java index dd45b0d..ff3cc3e 100644 --- a/java/com/google/turbine/parse/Parser.java +++ b/java/com/google/turbine/parse/Parser.java @@ -62,7 +62,7 @@ import java.util.Deque; import java.util.EnumSet; import java.util.List; import java.util.Optional; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A parser for the subset of Java required for header compilation. diff --git a/java/com/google/turbine/types/Canonicalize.java b/java/com/google/turbine/types/Canonicalize.java index a8861da..ab73618 100644 --- a/java/com/google/turbine/types/Canonicalize.java +++ b/java/com/google/turbine/types/Canonicalize.java @@ -44,7 +44,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; /** * Canonicalizes qualified type names so qualifiers are always the declaring class of the qualified -- cgit v1.2.3 From 23316ef610f850255e8edf0e7cbfc0679252bb10 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 30 Oct 2019 20:46:59 -0700 Subject: Use guava from the tree external/guava is up to date now, use it instead of a prebuilt jar. Test: m turbine Change-Id: I6a6557c06f8e8cf984d47f36028a1805f632c3e8 --- Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index a7b9442..8a1af22 100644 --- a/Android.bp +++ b/Android.bp @@ -25,7 +25,7 @@ java_library_host { manifest: "manifest.txt", static_libs: [ "error_prone_annotations", - "guava-21.0", + "guava", ], plugins: ["dagger2-auto-value"], -- cgit v1.2.3