diff --git a/.ci-build-without-test.sh b/.ci-build-without-test.sh index 825ad389..3aa0f97f 100755 --- a/.ci-build-without-test.sh +++ b/.ci-build-without-test.sh @@ -13,18 +13,31 @@ else export JAVA_HOME=${JAVA_HOME:-$(dirname $(dirname $(readlink -f $(which javac))))} fi -export JSR308="${JSR308:-$(cd .. && pwd -P)}" -export AFU="${AFU:-$(pwd -P)/../annotation-tools/annotation-file-utilities}" -export CHECKERFRAMEWORK="${CHECKERFRAMEWORK:-$(pwd -P)/../checker-framework}" - -export PATH=$AFU/scripts:$JAVA_HOME/bin:$PATH - if [ -d "/tmp/plume-scripts" ] ; then git -C /tmp/plume-scripts pull -q else git -C /tmp clone --depth 1 -q https://github.com/plume-lib/plume-scripts.git fi +export AFU="${AFU:-../annotation-tools/annotation-file-utilities}" +# Don't use `AT=${AFU}/..` which causes a git failure. +AT=$(dirname "${AFU}") + +## Build annotation-tools (Annotation File Utilities) +/tmp/plume-scripts/git-clone-related opprop annotation-tools "${AT}" +if [ ! -d ../annotation-tools ] ; then + ln -s "${AT}" ../annotation-tools +fi + +echo "Running: (cd ${AT} && ./.build-without-test.sh)" +(cd "${AT}" && ./.build-without-test.sh) +echo "... done: (cd ${AT} && ./.build-without-test.sh)" + +export JSR308="${JSR308:-$(cd .. && pwd -P)}" +export CHECKERFRAMEWORK="${CHECKERFRAMEWORK:-$(pwd -P)/../checker-framework}" + +export PATH=$AFU/scripts:$JAVA_HOME/bin:$PATH + ## Build Checker Framework /tmp/plume-scripts/git-clone-related opprop checker-framework ${CHECKERFRAMEWORK} diff --git a/build.gradle b/build.gradle index f2049ca1..075ca232 100644 --- a/build.gradle +++ b/build.gradle @@ -54,6 +54,12 @@ dependencies { implementation 'com.google.guava:guava:30.1.1-jre' + // AFU is an "includedBuild" imported in settings.gradle, so the version number doesn't matter. + // https://docs.gradle.org/current/userguide/composite_builds.html#settings_defined_composite + implementation('org.checkerframework:annotation-file-utilities:*') { + exclude group: 'com.google.errorprone', module: 'javac' + } + // Serialize constraints implementation 'com.googlecode.json-simple:json-simple:1.1.1' // Pretty print serialized constraints diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..054e3af5 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,7 @@ +includeBuild ('../annotation-tools/annotation-file-utilities') { + if (!file('../annotation-tools/annotation-file-utilities').exists()) { + exec { + executable '.ci-build-without-test.sh' + } + } +} diff --git a/src/checkers/inference/InferenceAnnotatedTypeFactory.java b/src/checkers/inference/InferenceAnnotatedTypeFactory.java index c069ef68..d7e30a84 100644 --- a/src/checkers/inference/InferenceAnnotatedTypeFactory.java +++ b/src/checkers/inference/InferenceAnnotatedTypeFactory.java @@ -273,7 +273,7 @@ protected void postDirectSuperTypes(AnnotatedTypeMirror type, List annotations = type.getEffectiveAnnotations(); for (AnnotatedTypeMirror supertype : supertypes) { if (!annotations.equals(supertype.getEffectiveAnnotations())) { - supertype.clearPrimaryAnnotations(); + supertype.clearAnnotations(); supertype.addAnnotations(annotations); } } diff --git a/src/checkers/inference/VariableAnnotator.java b/src/checkers/inference/VariableAnnotator.java index b73f39ce..445225f7 100644 --- a/src/checkers/inference/VariableAnnotator.java +++ b/src/checkers/inference/VariableAnnotator.java @@ -410,7 +410,7 @@ private void addExistentialVariable(final AnnotatedTypeVariable typeVar, final T if (elementToAtm.containsKey(varElem) && !isUpperBoundOfTypeParam && !isReturn) { - typeVar.clearPrimaryAnnotations(); + typeVar.clearAnnotations(); annotateElementFromStore(varElem, typeVar); return; } @@ -420,7 +420,7 @@ private void addExistentialVariable(final AnnotatedTypeVariable typeVar, final T potentialVariable = treeToVarAnnoPair.get(typeTree).first; // might have a primary annotation lingering around // (that would removed in the else clause) - typeVar.clearPrimaryAnnotations(); + typeVar.clearAnnotations(); } else { // element from use and see if we already have this as a local var or field? @@ -431,7 +431,7 @@ private void addExistentialVariable(final AnnotatedTypeVariable typeVar, final T + "typeVar=" + typeVar + "\n" + "tree=" + tree + "\n"); } - typeVar.clearPrimaryAnnotations(); + typeVar.clearAnnotations(); } potentialVariable = createVariable(typeTree); @@ -1546,7 +1546,7 @@ public void handleBinaryTree(AnnotatedTypeMirror atm, BinaryTree binaryTree) { Set lubs = inferenceTypeFactory .getQualifierHierarchy().leastUpperBounds(a.getEffectiveAnnotations(), b.getEffectiveAnnotations()); - atm.clearPrimaryAnnotations(); + atm.clearAnnotations(); atm.addAnnotations(lubs); if (slotManager.getSlot(atm) instanceof VariableSlot) { final Pair> varATMPair = Pair.>of( diff --git a/src/checkers/inference/util/CopyUtil.java b/src/checkers/inference/util/CopyUtil.java index 6efc0370..5f30844a 100644 --- a/src/checkers/inference/util/CopyUtil.java +++ b/src/checkers/inference/util/CopyUtil.java @@ -50,7 +50,7 @@ public static class ClearAndCopy implements CopyMethod { */ @Override public void copy(AnnotatedTypeMirror from, AnnotatedTypeMirror to) { - to.clearPrimaryAnnotations(); + to.clearAnnotations(); to.addAnnotations(from.getAnnotations()); } } @@ -80,7 +80,7 @@ public static void copyParameterReceiverAndReturnTypes(final AnnotatedExecutable // TODO: Constructor receivers might be null? if (from.getReceiverType() != null && to.getReceiverType() != null) { // Only the primary does anything at the moment, so no deep copy. - to.getReceiverType().clearPrimaryAnnotations(); + to.getReceiverType().clearAnnotations(); to.getReceiverType().addAnnotations(from.getReceiverType().getAnnotations()); } diff --git a/src/checkers/inference/util/InferenceUtil.java b/src/checkers/inference/util/InferenceUtil.java index 6d5b5102..a985ce67 100644 --- a/src/checkers/inference/util/InferenceUtil.java +++ b/src/checkers/inference/util/InferenceUtil.java @@ -40,7 +40,7 @@ public static Set clearAnnos(final AnnotatedTypeMirror atm) { final Set oldAnnos = AnnotationUtils.createAnnotationSet(); oldAnnos.addAll(atm.getAnnotations()); - atm.clearPrimaryAnnotations(); + atm.clearAnnotations(); return oldAnnos; }