Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .ci-build-without-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
}
}
2 changes: 1 addition & 1 deletion src/checkers/inference/InferenceAnnotatedTypeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected void postDirectSuperTypes(AnnotatedTypeMirror type, List<? extends Ann
Set<AnnotationMirror> annotations = type.getEffectiveAnnotations();
for (AnnotatedTypeMirror supertype : supertypes) {
if (!annotations.equals(supertype.getEffectiveAnnotations())) {
supertype.clearPrimaryAnnotations();
supertype.clearAnnotations();
supertype.addAnnotations(annotations);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/checkers/inference/VariableAnnotator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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?
Expand All @@ -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);
Expand Down Expand Up @@ -1546,7 +1546,7 @@ public void handleBinaryTree(AnnotatedTypeMirror atm, BinaryTree binaryTree) {
Set<? extends AnnotationMirror> lubs = inferenceTypeFactory
.getQualifierHierarchy().leastUpperBounds(a.getEffectiveAnnotations(),
b.getEffectiveAnnotations());
atm.clearPrimaryAnnotations();
atm.clearAnnotations();
atm.addAnnotations(lubs);
if (slotManager.getSlot(atm) instanceof VariableSlot) {
final Pair<Slot, Set<? extends AnnotationMirror>> varATMPair = Pair.<Slot, Set<? extends AnnotationMirror>>of(
Expand Down
4 changes: 2 additions & 2 deletions src/checkers/inference/util/CopyUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Expand Down Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion src/checkers/inference/util/InferenceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static Set<AnnotationMirror> clearAnnos(final AnnotatedTypeMirror atm) {
final Set<AnnotationMirror> oldAnnos = AnnotationUtils.createAnnotationSet();
oldAnnos.addAll(atm.getAnnotations());

atm.clearPrimaryAnnotations();
atm.clearAnnotations();
return oldAnnos;
}

Expand Down