diff options
author | 2015-02-06 17:20:06 +0000 | |
---|---|---|
committer | 2015-02-06 17:20:06 +0000 | |
commit | 0d194cc019389807f0c50a69b817dfd250831c07 (patch) | |
tree | 3eb2159e12a98a993d45db75ee6ad12c5d094ae7 /src/main/java/com/google | |
parent | c5aeaa39ddccc2c24cc288402eff8ae8bceed111 (diff) |
Fix or suppress warnings in Blaze code. #fixit
--
MOS_MIGRATED_REVID=85722639
Diffstat (limited to 'src/main/java/com/google')
7 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/ImmutableListDirectsNestedSet.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/ImmutableListDirectsNestedSet.java index 12bf222be5..d4acac21b7 100644 --- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/ImmutableListDirectsNestedSet.java +++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/ImmutableListDirectsNestedSet.java @@ -27,7 +27,9 @@ import javax.annotation.Nullable; */ abstract class ImmutableListDirectsNestedSet<E> extends NestedSet<E> { + @SuppressWarnings("rawtypes") private static final NestedSet[] EMPTY = new NestedSet[0]; + private final ImmutableList<E> directDeps; public ImmutableListDirectsNestedSet(ImmutableList<E> directDeps) { @@ -42,9 +44,10 @@ abstract class ImmutableListDirectsNestedSet<E> extends NestedSet<E> { return directDeps.toArray(); } + @SuppressWarnings({"cast", "unchecked"}) @Override - NestedSet[] transitiveSets() { - return EMPTY; + NestedSet<? extends E>[] transitiveSets() { + return (NestedSet<? extends E>[]) EMPTY; } @Override @@ -78,7 +81,7 @@ abstract class ImmutableListDirectsNestedSet<E> extends NestedSet<E> { } return getOrder().equals(other.getOrder()) && other instanceof ImmutableListDirectsNestedSet - && directDeps.equals(((ImmutableListDirectsNestedSet) other).directDeps); + && directDeps.equals(((ImmutableListDirectsNestedSet<? extends E>) other).directDeps); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectManyTransitive.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectManyTransitive.java index 05ba2e8f14..fdd6088991 100644 --- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectManyTransitive.java +++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectManyTransitive.java @@ -53,8 +53,8 @@ abstract class ManyDirectManyTransitive<E> extends MemoizedUniquefierNestedSet<E return other != null && getOrder().equals(other.getOrder()) && other instanceof ManyDirectManyTransitive - && Arrays.equals(directs, ((ManyDirectManyTransitive) other).directs) - && Arrays.equals(transitives, ((ManyDirectManyTransitive) other).transitives); + && Arrays.equals(directs, ((ManyDirectManyTransitive<? extends E>) other).directs) + && Arrays.equals(transitives, ((ManyDirectManyTransitive<? extends E>) other).transitives); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectOneTransitiveNestedSet.java b/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectOneTransitiveNestedSet.java index cdb4f04b1a..f8bbff5e3c 100644 --- a/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectOneTransitiveNestedSet.java +++ b/src/main/java/com/google/devtools/build/lib/collect/nestedset/ManyDirectOneTransitiveNestedSet.java @@ -53,8 +53,8 @@ abstract class ManyDirectOneTransitiveNestedSet<E> extends MemoizedUniquefierNes return other != null && getOrder().equals(other.getOrder()) && other instanceof ManyDirectOneTransitiveNestedSet - && Arrays.equals(directs, ((ManyDirectOneTransitiveNestedSet) other).directs) - && transitive == ((ManyDirectOneTransitiveNestedSet) other).transitive; + && Arrays.equals(directs, ((ManyDirectOneTransitiveNestedSet<? extends E>) other).directs) + && transitive == ((ManyDirectOneTransitiveNestedSet<? extends E>) other).transitive; } @Override diff --git a/src/main/java/com/google/devtools/build/lib/packages/AspectFactory.java b/src/main/java/com/google/devtools/build/lib/packages/AspectFactory.java index 2283f1b739..b375dd9b00 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/AspectFactory.java +++ b/src/main/java/com/google/devtools/build/lib/packages/AspectFactory.java @@ -42,7 +42,7 @@ public interface AspectFactory<TConfiguredTarget, TRuleContext, TAspect> { // Should never be instantiated } - public static AspectFactory create(Class<? extends AspectFactory<?, ?, ?>> clazz) { + public static AspectFactory<?, ?, ?> create(Class<? extends AspectFactory<?, ?, ?>> clazz) { // TODO(bazel-team): This should be cached somehow, because this method is invoked quite often try { return clazz.newInstance(); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/AggregatedCriticalPath.java b/src/main/java/com/google/devtools/build/lib/runtime/AggregatedCriticalPath.java index dd70c3520d..3e61956cd5 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/AggregatedCriticalPath.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/AggregatedCriticalPath.java @@ -21,7 +21,7 @@ import com.google.common.collect.ImmutableList; * Aggregates all the critical path components in one object. This allows us to easily access the * components data and have a proper toString(). */ -public class AggregatedCriticalPath<T extends AbstractCriticalPathComponent> { +public class AggregatedCriticalPath<T extends AbstractCriticalPathComponent<?>> { private final long totalTime; private final ImmutableList<T> criticalPathComponents; diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java index 9fc3df4578..50154625fa 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java @@ -290,7 +290,7 @@ final class ConfiguredTargetFunction implements SkyFunction { // The configured target should have been created in resolveConfiguredTargetDependencies() throw new IllegalStateException(e); } catch (NoSuchThingException | AspectCreationException e) { - AspectFactory depAspectFactory = AspectFactory.Util.create(depAspect); + AspectFactory<?, ?, ?> depAspectFactory = AspectFactory.Util.create(depAspect); throw new DependencyEvaluationException(new ConfiguredValueCreationException( String.format("Evaluation of aspect %s on %s failed: %s", depAspectFactory.getDefinition().getName(), dep.getLabel(), e.toString()))); diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java index f53538fad4..2b9145021f 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java @@ -63,12 +63,13 @@ public final class BinaryOperatorExpression extends Expression { return lhs + " " + operator + " " + rhs; } + @SuppressWarnings("unchecked") private int compare(Object lval, Object rval) throws EvalException { if (!(lval instanceof Comparable)) { throw new EvalException(getLocation(), lval + " is not comparable"); } try { - return ((Comparable) lval).compareTo(rval); + return ((Comparable<Object>) lval).compareTo(rval); } catch (ClassCastException e) { throw new EvalException(getLocation(), "Cannot compare " + EvalUtils.getDatatypeName(lval) + " with " + EvalUtils.getDatatypeName(rval)); |