diff options
author | aclement <aclement> | 2006-02-15 11:10:19 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-02-15 11:10:19 +0000 |
commit | 81228854e0cd74f3a771aafbffb06b264fdac59f (patch) | |
tree | 22df92ee236d802b45d6e4578a0bebfe19fec83b | |
parent | 2dcda062d98090b2ca35f58f737dca4bc65f342b (diff) | |
download | aspectj-81228854e0cd74f3a771aafbffb06b264fdac59f.tar.gz aspectj-81228854e0cd74f3a771aafbffb06b264fdac59f.zip |
test and fix for 120527
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java | 27 | ||||
-rw-r--r-- | tests/bugs151/pr120527/Bugs.aj | 11 |
2 files changed, 36 insertions, 2 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java index 02b2fe6b6..c66247514 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/problem/AjProblemReporter.java @@ -42,6 +42,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.aspectj.org.eclipse.jdt.internal.compiler.impl.ReferenceContext; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MemberTypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; @@ -54,8 +55,11 @@ import org.aspectj.weaver.ConcreteTypeMunger; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.patterns.DeclareAnnotation; +import org.aspectj.weaver.patterns.DeclareParents; import org.aspectj.weaver.patterns.DeclareSoft; +import org.aspectj.weaver.patterns.TypePattern; /** * Extends problem reporter to support compiler-side implementation of declare soft. @@ -415,8 +419,27 @@ public class AjProblemReporter extends ProblemReporter { public void unusedPrivateType(TypeDeclaration typeDecl) { // don't output unused type warnings for aspects! - if (!(typeDecl instanceof AspectDeclaration)) - super.unusedPrivateType(typeDecl); + if (typeDecl instanceof AspectDeclaration) return; + if (typeDecl.enclosingType!=null && (typeDecl.enclosingType instanceof AspectDeclaration)) { + AspectDeclaration ad = (AspectDeclaration)typeDecl.enclosingType; + if (ad.concreteName!=null) { + List declares = ad.concreteName.declares; + for (Iterator iter = declares.iterator(); iter.hasNext();) { + Object dec = (Object) iter.next(); + if (dec instanceof DeclareParents) { + DeclareParents decp = (DeclareParents)dec; + TypePattern[] newparents = decp.getParents().getTypePatterns(); + for (int i = 0; i < newparents.length; i++) { + TypePattern pattern = newparents[i]; + UnresolvedType ut = pattern.getExactType(); + if (ut==null) continue; + if (CharOperation.compareWith(typeDecl.binding.signature(),ut.getSignature().toCharArray())==0) return; + } + } + } + } + } + super.unusedPrivateType(typeDecl); } public void unusedPrivateMethod(AbstractMethodDeclaration methodDecl) { diff --git a/tests/bugs151/pr120527/Bugs.aj b/tests/bugs151/pr120527/Bugs.aj new file mode 100644 index 000000000..83ade6779 --- /dev/null +++ b/tests/bugs151/pr120527/Bugs.aj @@ -0,0 +1,11 @@ +public class Bugs { + public static void main(String[] args) { + System.out.println("" + (new C())); // + instanceof A.I)); + } + static class C{} + + static aspect A { + private interface I {} + declare parents : C implements I; + } +} |