From 629a1a971c44ee9e2b268854f3767b91b28c2da0 Mon Sep 17 00:00:00 2001 From: aditya3434 Date: Thu, 28 May 2020 12:41:06 +0530 Subject: [PATCH] Revert "Fix for feature request #3313 in Aliasing Checker" This reverts commit fd536c4de755dc1c53adbca9ad2b684e9b39a055. --- .../checkerframework/common/aliasing/AliasingVisitor.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/framework/src/main/java/org/checkerframework/common/aliasing/AliasingVisitor.java b/framework/src/main/java/org/checkerframework/common/aliasing/AliasingVisitor.java index ae19becda68..63d7ba5678a 100644 --- a/framework/src/main/java/org/checkerframework/common/aliasing/AliasingVisitor.java +++ b/framework/src/main/java/org/checkerframework/common/aliasing/AliasingVisitor.java @@ -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 { @@ -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"); } } @@ -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() {