From 089a7c18b6e24042f4a3386edaa255c898d102a4 Mon Sep 17 00:00:00 2001 From: Aosen Xiong <82676488+Ao-senXiong@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:54:14 -0400 Subject: [PATCH] Replace deprecated APIs and update gradle build configuration (#108) --- build.gradle | 5 +++++ .../java/universe/UniverseInferenceAnnotatedTypeFactory.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 79ff161..7dfa6bc 100644 --- a/build.gradle +++ b/build.gradle @@ -115,6 +115,8 @@ task cloneAndBuildDependencies(type: Exec) { tasks.withType(JavaCompile) { compilationTask -> options.compilerArgs = [ '-implicit:class', + '-Werror', + '-Xlint:deprecation', '-Awarns', '-Xmaxwarns', '10000', @@ -125,6 +127,9 @@ tasks.withType(JavaCompile) { compilationTask -> // Enable Error Prone options.errorprone.enabled = !isJava8 options.errorprone.disableWarningsInGeneratedCode = true + options.errorprone.errorproneArgs = [ + '-Xep:VoidUsed:OFF', + ] } afterEvaluate { diff --git a/src/main/java/universe/UniverseInferenceAnnotatedTypeFactory.java b/src/main/java/universe/UniverseInferenceAnnotatedTypeFactory.java index b682a63..c0bcaef 100644 --- a/src/main/java/universe/UniverseInferenceAnnotatedTypeFactory.java +++ b/src/main/java/universe/UniverseInferenceAnnotatedTypeFactory.java @@ -108,7 +108,7 @@ protected Slot getOrCreateDeclBound(AnnotatedDeclaredType type) { @Override public void handleBinaryTree(AnnotatedTypeMirror atm, BinaryTree binaryTree) { - if (atm.isAnnotatedInHierarchy(getVarAnnot())) { + if (atm.hasAnnotationInHierarchy(getVarAnnot())) { // Happens for binary trees whose atm is implicitly immutable and already handled by // PICOInferencePropagationTreeAnnotator return; @@ -135,7 +135,7 @@ public Void visitBinary(BinaryTree node, AnnotatedTypeMirror type) { public Void visitTypeCast(TypeCastTree node, AnnotatedTypeMirror type) { applyBottomIfImplicitlyBottom( type); // Must run before calling super method to respect existing annotation - if (type.isAnnotatedInHierarchy(ANY)) { + if (type.hasAnnotationInHierarchy(ANY)) { // VarAnnot is guarenteed to not exist on type, because PropagationTreeAnnotator has // the highest previledge // So VarAnnot hasn't been inserted to cast type yet.