From 8efebf1e4b4a455965a16cc16767df914c336f0d Mon Sep 17 00:00:00 2001 From: Kurt Alfred Kluever Date: Tue, 1 Feb 2022 08:31:09 -0800 Subject: Automatic code cleanup. PiperOrigin-RevId: 425631296 --- java/com/google/turbine/binder/Binder.java | 7 ++++--- java/com/google/turbine/binder/CanonicalTypeBinder.java | 2 +- java/com/google/turbine/binder/CompUnitPreprocessor.java | 2 +- java/com/google/turbine/binder/ConstBinder.java | 2 +- java/com/google/turbine/binder/HierarchyBinder.java | 3 ++- java/com/google/turbine/binder/Processing.java | 4 ++-- java/com/google/turbine/binder/TypeBinder.java | 4 ++-- java/com/google/turbine/binder/bytecode/BytecodeBinder.java | 2 +- .../com/google/turbine/binder/bytecode/BytecodeBoundClass.java | 10 +++++----- 9 files changed, 19 insertions(+), 17 deletions(-) (limited to 'java/com/google/turbine/binder') diff --git a/java/com/google/turbine/binder/Binder.java b/java/com/google/turbine/binder/Binder.java index 2916a81..d2ce948 100644 --- a/java/com/google/turbine/binder/Binder.java +++ b/java/com/google/turbine/binder/Binder.java @@ -186,7 +186,7 @@ public final class Binder { } return new BindingResult( - result.build(), + result.buildOrThrow(), boundModules, classPathEnv, tli, @@ -293,7 +293,7 @@ public final class Binder { } }); } - return new LazyEnv<>(completers.build(), classPathEnv); + return new LazyEnv<>(completers.buildOrThrow(), classPathEnv); } private static Env bindTypes( @@ -409,7 +409,8 @@ public final class Binder { // lazily evaluated fields in the current compilation unit with // constant fields in the classpath (which don't require evaluation). Env constenv = - new LazyEnv<>(completers.build(), SimpleEnv.builder().build()); + new LazyEnv<>( + completers.buildOrThrow(), SimpleEnv.builder().build()); SimpleEnv.Builder builder = SimpleEnv.builder(); for (ClassSymbol sym : syms) { diff --git a/java/com/google/turbine/binder/CanonicalTypeBinder.java b/java/com/google/turbine/binder/CanonicalTypeBinder.java index 944563f..5ff17bb 100644 --- a/java/com/google/turbine/binder/CanonicalTypeBinder.java +++ b/java/com/google/turbine/binder/CanonicalTypeBinder.java @@ -199,7 +199,7 @@ public final class CanonicalTypeBinder { (IntersectionTy) Canonicalize.canonicalize(source, position, env, sym, info.upperBound()); result.put(e.getKey(), new TyVarInfo(upperBound, /* lowerBound= */ null, info.annotations())); } - return result.build(); + return result.buildOrThrow(); } private static ImmutableList canonicalizeList( diff --git a/java/com/google/turbine/binder/CompUnitPreprocessor.java b/java/com/google/turbine/binder/CompUnitPreprocessor.java index 0e9f4e5..970dc4b 100644 --- a/java/com/google/turbine/binder/CompUnitPreprocessor.java +++ b/java/com/google/turbine/binder/CompUnitPreprocessor.java @@ -149,7 +149,7 @@ public final class CompUnitPreprocessor { types.add(new SourceBoundClass(sym, owner, children, access, decl)); } } - return result.build(); + return result.buildOrThrow(); } /** Desugars access flags for a class. */ diff --git a/java/com/google/turbine/binder/ConstBinder.java b/java/com/google/turbine/binder/ConstBinder.java index 3ba059f..29ae710 100644 --- a/java/com/google/turbine/binder/ConstBinder.java +++ b/java/com/google/turbine/binder/ConstBinder.java @@ -334,7 +334,7 @@ public class ConstBinder { /* lowerBound= */ null, constEvaluator.evaluateAnnotations(info.annotations()))); } - return result.build(); + return result.buildOrThrow(); } private Type bindType(Type type) { diff --git a/java/com/google/turbine/binder/HierarchyBinder.java b/java/com/google/turbine/binder/HierarchyBinder.java index 9a5f763..ac2c840 100644 --- a/java/com/google/turbine/binder/HierarchyBinder.java +++ b/java/com/google/turbine/binder/HierarchyBinder.java @@ -114,7 +114,8 @@ public class HierarchyBinder { typeParameters.put(p.name().value(), new TyVarSymbol(origin, p.name().value())); } - return new SourceHeaderBoundClass(base, superclass, interfaces.build(), typeParameters.build()); + return new SourceHeaderBoundClass( + base, superclass, interfaces.build(), typeParameters.buildOrThrow()); } /** diff --git a/java/com/google/turbine/binder/Processing.java b/java/com/google/turbine/binder/Processing.java index 555e691..a836fa7 100644 --- a/java/com/google/turbine/binder/Processing.java +++ b/java/com/google/turbine/binder/Processing.java @@ -272,7 +272,7 @@ public class Processing { for (Processor processor : processorInfo.processors()) { result.put(processor, SupportedAnnotationTypes.create(processor)); } - return result.build(); + return result.buildOrThrow(); } @AutoValue @@ -555,7 +555,7 @@ public class Processing { // requireNonNull is safe, barring bizarre processor implementations (e.g., anonymous class) result.put(requireNonNull(e.getKey().getCanonicalName()), e.getValue().elapsed()); } - return result.build(); + return result.buildOrThrow(); } } diff --git a/java/com/google/turbine/binder/TypeBinder.java b/java/com/google/turbine/binder/TypeBinder.java index e2011e2..92d2827 100644 --- a/java/com/google/turbine/binder/TypeBinder.java +++ b/java/com/google/turbine/binder/TypeBinder.java @@ -560,7 +560,7 @@ public class TypeBinder { new TyVarInfo( IntersectionTy.create(bounds.build()), /* lowerBound= */ null, annotations)); } - return result.build(); + return result.buildOrThrow(); } private List bindMethods( @@ -588,7 +588,7 @@ public class TypeBinder { for (Tree.TyParam pt : t.typarams()) { builder.put(pt.name().value(), new TyVarSymbol(sym, pt.name().value())); } - typeParameters = builder.build(); + typeParameters = builder.buildOrThrow(); } // type parameters can refer to each other in f-bounds, so update the scope first diff --git a/java/com/google/turbine/binder/bytecode/BytecodeBinder.java b/java/com/google/turbine/binder/bytecode/BytecodeBinder.java index af8a8a3..82f8a8c 100644 --- a/java/com/google/turbine/binder/bytecode/BytecodeBinder.java +++ b/java/com/google/turbine/binder/bytecode/BytecodeBinder.java @@ -137,7 +137,7 @@ public final class BytecodeBinder { for (Map.Entry e : value.elementValuePairs().entrySet()) { values.put(e.getKey(), bindValue(e.getValue())); } - return new TurbineAnnotationValue(new AnnoInfo(null, sym, null, values.build())); + return new TurbineAnnotationValue(new AnnoInfo(null, sym, null, values.buildOrThrow())); } static ImmutableList bindAnnotations(List input) { diff --git a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java index 9be2dd1..cc97dcb 100644 --- a/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java +++ b/java/com/google/turbine/binder/bytecode/BytecodeBoundClass.java @@ -157,7 +157,7 @@ public class BytecodeBoundClass implements TypeBoundClass { result.put(inner.innerName(), new ClassSymbol(inner.innerClass())); } } - return result.build(); + return result.buildOrThrow(); } }); @@ -212,7 +212,7 @@ public class BytecodeBoundClass implements TypeBoundClass { for (Sig.TyParamSig p : csig.tyParams()) { result.put(p.name(), new TyVarSymbol(sym, p.name())); } - return result.build(); + return result.buildOrThrow(); } }); @@ -325,7 +325,7 @@ public class BytecodeBoundClass implements TypeBoundClass { // typeParameters() is constructed to guarantee the requireNonNull call is safe. tparams.put(requireNonNull(typeParameters().get(p.name())), bindTyParam(p, scope)); } - return tparams.build(); + return tparams.buildOrThrow(); } }); @@ -406,7 +406,7 @@ public class BytecodeBoundClass implements TypeBoundClass { for (Sig.TyParamSig p : sig.tyParams()) { result.put(p.name(), new TyVarSymbol(methodSymbol, p.name())); } - tyParams = result.build(); + tyParams = result.buildOrThrow(); } ImmutableMap tyParamTypes; @@ -417,7 +417,7 @@ public class BytecodeBoundClass implements TypeBoundClass { // tyParams is constructed to guarantee the requireNonNull call is safe. tparams.put(requireNonNull(tyParams.get(p.name())), bindTyParam(p, scope)); } - tyParamTypes = tparams.build(); + tyParamTypes = tparams.buildOrThrow(); } Function scope = makeScope(env, sym, tyParams); -- cgit v1.2.3