Skip to content

Commit

Permalink
Revert "Fix for feature request typetools#3313 in Aliasing Checker"
Browse files Browse the repository at this point in the history
This reverts commit fd536c4.
  • Loading branch information
aditya3434 committed Jun 11, 2020
1 parent 97ff12d commit 629a1a9
Showing 1 changed file with 3 additions and 5 deletions.
Expand Up @@ -70,8 +70,7 @@ public Void visitMethodInvocation(MethodInvocationTree node, Void p) {
// Check if a call to super() might create an alias: that
// happens when the parent's respective constructor is not @Unique.
AnnotatedTypeMirror superResult = atypeFactory.getAnnotatedType(node);
if ((!superResult.hasAnnotation(Unique.class))
&& (!superResult.toString().equals("@MaybeAliased Object"))) {
if (!superResult.hasAnnotation(Unique.class)) {
checker.reportError(node, "unique.leaked");
}
} else {
Expand Down Expand Up @@ -256,8 +255,7 @@ protected void checkThisOrSuperConstructorCall(
// Check if a call to super() might create an alias: that
// happens when the parent's respective constructor is not @Unique.
AnnotatedTypeMirror superResult = atypeFactory.getAnnotatedType(superCall);
if ((!superResult.hasAnnotation(Unique.class))
&& (!superResult.toString().equals("@MaybeAliased Object"))) {
if (!superResult.hasAnnotation(Unique.class)) {
checker.reportError(superCall, "unique.leaked");
}
}
Expand All @@ -273,7 +271,7 @@ private boolean canBeLeaked(Tree exp) {
AnnotatedTypeMirror type = atypeFactory.getAnnotatedType(exp);
boolean isMethodInvocation = exp.getKind() == Kind.METHOD_INVOCATION;
boolean isNewClass = exp.getKind() == Kind.NEW_CLASS;
return type.hasAnnotation(Unique.class) && !isMethodInvocation && !isNewClass;
return type.hasExplicitAnnotation(Unique.class) && !isMethodInvocation && !isNewClass;
}

private boolean isInUniqueConstructor() {
Expand Down

0 comments on commit 629a1a9

Please sign in to comment.