Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 182310 Details for
Bug 329268
DOM AST support for Type Patterns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Initial implementation of feature
aspectj_feature_bug_329268_v20101103 (text/plain), 72.26 KB, created by
Nieraj Singh
on 2010-11-03 13:08:19 EDT
(
hide
)
Description:
Initial implementation of feature
Filename:
MIME Type:
Creator:
Nieraj Singh
Created:
2010-11-03 13:08:19 EDT
Size:
72.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.aspectj.ajdt.core >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AbstractBooleanTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/AbstractBooleanTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/AbstractBooleanTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AbstractBooleanTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+ >+public abstract class AbstractBooleanTypePattern extends TypePattern { >+ >+ private TypePattern left; >+ private TypePattern right; >+ >+ AbstractBooleanTypePattern(AST ast, TypePattern left, TypePattern right) { >+ super(ast); >+ this.left = left; >+ this.right = right; >+ } >+ >+ public TypePattern getLeft() { >+ return left; >+ } >+ >+ public TypePattern getRight() { >+ return right; >+ } >+ >+ boolean subtreeMatch0(ASTMatcher matcher, Object other) { >+ if (matcher instanceof AjASTMatcher) { >+ AjASTMatcher ajmatcher = (AjASTMatcher) matcher; >+ return ajmatcher.match(this, other); >+ } >+ return false; >+ } >+ >+ void accept0(ASTVisitor visitor) { >+ if (visitor instanceof AjASTVisitor) { >+ AjASTVisitor ajVisitor = (AjASTVisitor) visitor; >+ boolean visit = ajVisitor.visit(this); >+ if (visit) { >+ ajVisitor.visit(getLeft()); >+ ajVisitor.visit(getRight()); >+ } >+ ajVisitor.endVisit(this); >+ } >+ } >+ >+ int treeSize() { >+ return >+ memSize() >+ + (this.left == null ? 0 : getLeft().treeSize()) >+ + (this.right == null ? 0 : getRight().treeSize()); >+ } >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AbstractJavaTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/AbstractJavaTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/AbstractJavaTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AbstractJavaTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,51 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+ >+public abstract class AbstractJavaTypePattern extends TypePattern { >+ >+ private Type type; >+ >+ AbstractJavaTypePattern(AST ast, Type type) { >+ super(ast); >+ this.type = type; >+ } >+ >+ public Type getType() { >+ return type; >+ } >+ >+ int memSize() { >+ >+ int memSize = super.memSize(); >+ >+ Type type = getType(); >+ if (type != null) { >+ memSize += type.memSize(); >+ } >+ >+ return memSize; >+ } >+ >+ @Override >+ void accept0(ASTVisitor visitor) { >+ if (visitor instanceof AjASTVisitor) { >+ AjASTVisitor ajVisitor = (AjASTVisitor) visitor; >+ boolean visited = ajVisitor.visit(this); >+ Type type = getType(); >+ if (visited && type != null) { >+ ajVisitor.visit(type); >+ } >+ ajVisitor.endVisit(this); >+ } >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java,v >retrieving revision 1.16 >diff -u -r1.16 AjASTConverter.java >--- src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java 18 Aug 2010 17:01:00 -0000 1.16 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AjASTConverter.java 3 Nov 2010 17:06:11 -0000 >@@ -406,7 +406,7 @@ > ((DeclareAtTypeDeclaration) declareDeclaration).setAnnotationName(annotationName); > } else if (da.getKind().equals(DeclareAnnotation.AT_CONSTRUCTOR)) { > declareDeclaration = new DeclareAtConstructorDeclaration(this.ast); >- ((DeclareAtConstructorDeclaration) declareDeclaration).setPatternNode(convert(da.getSignaturePattern())); >+ ((DeclareAtConstructorDeclaration) declareDeclaration).setPatternNode(convertSignature(da.getSignaturePattern())); > SimpleName annotationName = new SimpleName(this.ast); > annotationName.setSourceRange(da.getAnnotationSourceStart(), > da.getAnnotationSourceEnd() - da.getAnnotationSourceStart()); >@@ -414,7 +414,7 @@ > ((DeclareAtConstructorDeclaration) declareDeclaration).setAnnotationName(annotationName); > } else if (da.getKind().equals(DeclareAnnotation.AT_FIELD)) { > declareDeclaration = new DeclareAtFieldDeclaration(this.ast); >- ((DeclareAtFieldDeclaration) declareDeclaration).setPatternNode(convert(da.getSignaturePattern())); >+ ((DeclareAtFieldDeclaration) declareDeclaration).setPatternNode(convertSignature(da.getSignaturePattern())); > SimpleName annotationName = new SimpleName(this.ast); > annotationName.setSourceRange(da.getAnnotationSourceStart(), > da.getAnnotationSourceEnd() - da.getAnnotationSourceStart()); >@@ -422,7 +422,7 @@ > ((DeclareAtFieldDeclaration) declareDeclaration).setAnnotationName(annotationName); > } else if (da.getKind().equals(DeclareAnnotation.AT_METHOD)) { > declareDeclaration = new DeclareAtMethodDeclaration(this.ast); >- ((DeclareAtMethodDeclaration) declareDeclaration).setPatternNode(convert(da.getSignaturePattern())); >+ ((DeclareAtMethodDeclaration) declareDeclaration).setPatternNode(convertSignature(da.getSignaturePattern())); > SimpleName annotationName = new SimpleName(this.ast); > annotationName.setSourceRange(da.getAnnotationSourceStart(), > da.getAnnotationSourceEnd() - da.getAnnotationSourceStart()); >@@ -624,8 +624,8 @@ > return pointcutDesi; > } > >- public org.aspectj.org.eclipse.jdt.core.dom.PatternNode convert(ISignaturePattern patternNode) { >- org.aspectj.org.eclipse.jdt.core.dom.PatternNode pNode = null; >+ public org.aspectj.org.eclipse.jdt.core.dom.SignaturePattern convertSignature(ISignaturePattern patternNode) { >+ org.aspectj.org.eclipse.jdt.core.dom.SignaturePattern pNode = null; > if (patternNode instanceof SignaturePattern) { > SignaturePattern sigPat = (SignaturePattern) patternNode; > pNode = new org.aspectj.org.eclipse.jdt.core.dom.SignaturePattern(this.ast, sigPat.toString()); >@@ -636,23 +636,144 @@ > return pNode; > } > >- public org.aspectj.org.eclipse.jdt.core.dom.PatternNode convert(PatternNode patternNode) { >- // this is a stub to be used until dom classes have been created for >- // the different weaver TypePattern's >+ public org.aspectj.org.eclipse.jdt.core.dom.PatternNode convert( >+ PatternNode patternNode) { > org.aspectj.org.eclipse.jdt.core.dom.PatternNode pNode = null; > if (patternNode instanceof TypePattern) { >- TypePattern typePat = (TypePattern) patternNode; >- pNode = new DefaultTypePattern(this.ast, typePat.toString()); >- pNode.setSourceRange(typePat.getStart(), (typePat.getEnd() - typePat.getStart() + 1)); >+ TypePattern weaverTypePattern = (TypePattern) patternNode; >+ return convert(weaverTypePattern); >+ > } else if (patternNode instanceof SignaturePattern) { > SignaturePattern sigPat = (SignaturePattern) patternNode; >- pNode = new org.aspectj.org.eclipse.jdt.core.dom.SignaturePattern(this.ast, sigPat.toString()); >- pNode.setSourceRange(sigPat.getStart(), (sigPat.getEnd() - sigPat.getStart() + 1)); >+ pNode = new org.aspectj.org.eclipse.jdt.core.dom.SignaturePattern( >+ this.ast, sigPat.toString()); >+ pNode.setSourceRange(patternNode.getStart(), (patternNode.getEnd() >+ - patternNode.getStart() + 1)); > } > return pNode; > > } > >+ public org.aspectj.org.eclipse.jdt.core.dom.TypePattern convert( >+ TypePattern weaverNode) { >+ >+ // TODO: Should check for JLS2 cases? Example: >+ // if (this.ast.apiLevel == AST.JLS2_INTERNAL) { >+ // return null; >+ // } >+ >+ // First check if the node is a Java type (WildType, ExactType, >+ // BindingType) >+ org.aspectj.org.eclipse.jdt.core.dom.TypePattern domNode = createJavaTypePattern(weaverNode); >+ >+ if (domNode == null) { >+ if (weaverNode instanceof org.aspectj.weaver.patterns.EllipsisTypePattern) { >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.EllipsisTypePattern( >+ ast); >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.NoTypePattern) { >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.NoTypePattern( >+ ast); >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.AnyTypePattern) { >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.AnyTypePattern( >+ ast); >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.AnyWithAnnotationTypePattern) { >+ // For now construct the node with just the annotation >+ // expression >+ String annotationExpression = ((org.aspectj.weaver.patterns.AnyWithAnnotationTypePattern) weaverNode) >+ .toString(); >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.AnyWithAnnotationTypePattern( >+ ast, annotationExpression); >+ >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.OrTypePattern) { >+ org.aspectj.weaver.patterns.OrTypePattern compilerOrNode = (org.aspectj.weaver.patterns.OrTypePattern) weaverNode; >+ domNode = new OrTypePattern(this.ast, >+ convert(compilerOrNode.getLeft()), >+ convert(compilerOrNode.getRight())); >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.AndTypePattern) { >+ org.aspectj.weaver.patterns.AndTypePattern compilerAndType = (org.aspectj.weaver.patterns.AndTypePattern) weaverNode; >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.AndTypePattern( >+ this.ast, convert(compilerAndType.getLeft()), >+ convert(compilerAndType.getRight())); >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.NotTypePattern) { >+ TypePattern negatedTypePattern = ((org.aspectj.weaver.patterns.NotTypePattern) weaverNode) >+ .getNegatedPattern(); >+ org.aspectj.org.eclipse.jdt.core.dom.TypePattern negatedDomTypePattern = convert(negatedTypePattern); >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.NotTypePattern( >+ ast, negatedDomTypePattern); >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.TypeCategoryTypePattern) { >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.TypeCategoryTypePattern( >+ ast, >+ ((org.aspectj.weaver.patterns.TypeCategoryTypePattern) weaverNode) >+ .getTypeCategory()); >+ >+ } else if (weaverNode instanceof org.aspectj.weaver.patterns.HasMemberTypePattern) { >+ ISignaturePattern weaverSignature = ((org.aspectj.weaver.patterns.HasMemberTypePattern) weaverNode) >+ .getSignaturePattern(); >+ org.aspectj.org.eclipse.jdt.core.dom.SignaturePattern signature = convertSignature(weaverSignature); >+ domNode = new org.aspectj.org.eclipse.jdt.core.dom.HasMemberTypePattern( >+ ast, signature); >+ } else { >+ // Handle any cases that are not yet implemented. Create a >+ // default node for >+ // them. >+ domNode = new DefaultTypePattern(this.ast, >+ weaverNode.toString()); >+ } >+ } >+ >+ if (domNode != null) { >+ domNode.setSourceRange(weaverNode.getStart(), (weaverNode.getEnd() >+ - weaverNode.getStart() + 1)); >+ } >+ return domNode; >+ } >+ >+ /** >+ * Creates an ExactType, WildType, or BindingType, or null if none of the >+ * three can be created >+ * >+ * @param weaverTypePattern >+ * to convert to a DOM equivalent >+ * @return DOM node or null if it was not created >+ */ >+ protected org.aspectj.org.eclipse.jdt.core.dom.TypePattern createJavaTypePattern( >+ TypePattern weaverTypePattern) { >+ String typeExpression = weaverTypePattern.toString(); >+ >+ org.aspectj.org.eclipse.jdt.core.dom.TypePattern domTypePattern = null; >+ if (weaverTypePattern instanceof org.aspectj.weaver.patterns.WildTypePattern) { >+ // Use the expression for wild type patterns as a Name may not be >+ // constructed >+ // for a Type with a unresolved typeExpression >+ domTypePattern = new org.aspectj.org.eclipse.jdt.core.dom.WildTypePattern( >+ ast, typeExpression); >+ } else { >+ // TODO: At this point, the type pattern should be resolved. Type >+ // information >+ // may be able to be obtained from the exact type in the weaver >+ // pattern, therefore >+ // replace using the expression to construct the Type and use more >+ // appropriate >+ // information obtained from the exact type >+ >+ if (weaverTypePattern instanceof org.aspectj.weaver.patterns.ExactTypePattern) { >+ Type type = this.ast.newSimpleType(this.ast >+ .newSimpleName(typeExpression)); >+ domTypePattern = new ExactTypePattern(ast, type); >+ } else if (weaverTypePattern instanceof org.aspectj.weaver.patterns.BindingTypePattern) { >+ Type type = this.ast.newSimpleType(this.ast >+ .newSimpleName(typeExpression)); >+ String binding = ((org.aspectj.weaver.patterns.BindingTypePattern) weaverTypePattern) >+ .getBindingName(); >+ FormalBinding formalBinding = new FormalBinding(type, binding, >+ ast); >+ domTypePattern = new org.aspectj.org.eclipse.jdt.core.dom.BindingTypePattern( >+ ast, formalBinding); >+ } >+ } >+ return domTypePattern; >+ } >+ > public ASTNode convert( > org.aspectj.org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration annotationTypeMemberDeclaration) { > checkCanceled(); >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AjASTMatcher.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTMatcher.java,v >retrieving revision 1.5 >diff -u -r1.5 AjASTMatcher.java >--- src/org/aspectj/org/eclipse/jdt/core/dom/AjASTMatcher.java 28 Aug 2008 03:19:50 -0000 1.5 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AjASTMatcher.java 3 Nov 2010 17:06:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -258,4 +258,46 @@ > } > return node.getDetail().equals(((SignaturePattern) other).getDetail()); > } >+ >+ public boolean match(TypePattern typePattern, Object other) { >+ // Note that for NoTypePattern, EllipsisTypePattern >+ // and AnyTypePattern, as they hold no state for now >+ // only do an object check. >+ if (typePattern == other) { >+ return true; >+ } >+ >+ // TODO: implement matching for all the specialised TypePatterns >+// if (typePattern instanceof AbstractBooleanTypePattern) { >+// return match((AbstractBooleanTypePattern) typePattern, other); >+// } else if (typePattern instanceof AbstractJavaTypePattern) { >+// return match((AbstractJavaTypePattern) typePattern, other); >+// } else if (typePattern instanceof BindingTypePattern ) { >+// >+// } else if (typePattern instanceof TypeCategoryTypePattern) { >+// >+// } else if (typePattern instanceof ExactTypePattern || typePattern instanceof WildTypePattern) { >+// >+// } else if (typePattern instanceof BindingTypePattern) { >+// >+// } else if (typePattern instanceof NotTypePattern) { >+// >+// } else if (typePattern instanceof HasMemberTypePattern) { >+// >+// } else if (typePattern instanceof AnyWithAnnotationTypePattern) { >+// >+// } >+ return false; >+ } >+ >+ >+ public boolean match(Type type, Object other) { >+ if (type == other) { >+ return true; >+ } >+ return false; >+ } >+ >+ >+ > } >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AjASTVisitor.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/AjASTVisitor.java,v >retrieving revision 1.2 >diff -u -r1.2 AjASTVisitor.java >--- src/org/aspectj/org/eclipse/jdt/core/dom/AjASTVisitor.java 26 Jan 2006 10:57:12 -0000 1.2 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AjASTVisitor.java 3 Nov 2010 17:06:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -244,4 +244,24 @@ > > public void endVisit(SignaturePattern node) { > } >+ >+ public boolean visit(TypePattern node) { >+ return true; >+ } >+ >+ public void endVisit(TypePattern node) { >+ // ajh02: method added >+ // default implementation: do nothing >+ } >+ >+ >+ public boolean visit(Type node) { >+ // ajh02: method added >+ return true; >+ } >+ >+ public void endVisit(Type node) { >+ // ajh02: method added >+ // default implementation: do nothing >+ } > } >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AndTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/AndTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/AndTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AndTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,32 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class AndTypePattern extends AbstractBooleanTypePattern { >+ >+ AndTypePattern(AST ast, TypePattern left, TypePattern right) { >+ super(ast, left, right); >+ } >+ >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ ASTNode clone0(AST target) { >+ AndTypePattern cloned = new AndTypePattern(target, >+ (TypePattern) getLeft().clone(target), (TypePattern) getRight() >+ .clone(target)); >+ cloned.setSourceRange(getStartPosition(), getLength()); >+ return cloned; >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AnyTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/AnyTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/AnyTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AnyTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,31 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class AnyTypePattern extends TypePattern { >+ >+ AnyTypePattern(AST ast) { >+ super(ast); >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ AnyTypePattern cloned = new AnyTypePattern(target); >+ cloned.setSourceRange(getStartPosition(), getLength()); >+ return cloned; >+ } >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/AnyWithAnnotationTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/AnyWithAnnotationTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/AnyWithAnnotationTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/AnyWithAnnotationTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+/** >+ * TODO: Add support for proper AnnotationPatterns instead of the annotation >+ * expression >+ * >+ */ >+public class AnyWithAnnotationTypePattern extends TypePattern { >+ >+ AnyWithAnnotationTypePattern(AST ast, String annotationExpression) { >+ super(ast, annotationExpression); >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ ASTNode node = new AnyWithAnnotationTypePattern(target, >+ getTypePatternExpression()); >+ node.setSourceRange(getStartPosition(), getLength()); >+ return node; >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/BindingTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/BindingTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/BindingTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/BindingTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class BindingTypePattern extends ExactTypePattern { >+ >+ private FormalBinding binding; >+ >+ public BindingTypePattern(AST ast, FormalBinding binding) { >+ super(ast, binding.getType()); >+ this.binding = binding; >+ } >+ >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ public FormalBinding getBinding() { >+ return binding; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ ASTNode node = new BindingTypePattern(target, >+ (FormalBinding) getBinding().clone(target)); >+ node.setSourceRange(getStartPosition(), getLength()); >+ return node; >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/EllipsisTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/EllipsisTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/EllipsisTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/EllipsisTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,32 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class EllipsisTypePattern extends TypePattern { >+ >+ EllipsisTypePattern(AST ast) { >+ super(ast); >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ ASTNode node = new EllipsisTypePattern(target); >+ node.setSourceRange(getStartPosition(), getLength()); >+ return node; >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/ExactTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/ExactTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/ExactTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/ExactTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,36 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class ExactTypePattern extends AbstractJavaTypePattern { >+ >+ ExactTypePattern(AST ast, Type type) { >+ super(ast, type); >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ Type clonedType = getType(); >+ if (clonedType != null) { >+ clonedType = (Type) clonedType.clone(target); >+ } >+ ASTNode node = new ExactTypePattern(target, clonedType); >+ node.setSourceRange(getStartPosition(), getLength()); >+ return node; >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/FormalBinding.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/FormalBinding.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/FormalBinding.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/FormalBinding.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,88 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class FormalBinding extends Type { >+ >+ private Type type; >+ private String binding; >+ >+ /** >+ * >+ * @param type >+ * must not be null >+ * @param binding >+ * must not be null >+ * @param ast >+ * must not be null >+ */ >+ public FormalBinding(Type type, String binding, AST ast) { >+ super(ast); >+ } >+ >+ public Type getType() { >+ return type; >+ } >+ >+ public String getBinding() { >+ return binding; >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ @Override >+ int getNodeType0() { >+ return 0; >+ } >+ >+ @Override >+ boolean subtreeMatch0(ASTMatcher matcher, Object other) { >+ if (matcher instanceof AjASTMatcher) { >+ return ((AjASTMatcher) matcher).match(this, other); >+ } >+ return false; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ ASTNode node = new FormalBinding((Type) getType().clone(target), >+ getBinding(), target); >+ node.setSourceRange(getStartPosition(), getLength()); >+ return node; >+ } >+ >+ @Override >+ void accept0(ASTVisitor visitor) { >+ if (visitor instanceof AjASTVisitor) { >+ boolean visited = ((AjASTVisitor) visitor).visit(this); >+ if (visited) { >+ ((AjASTVisitor) visitor).visit(getType()); >+ } >+ ((AjASTVisitor) visitor).endVisit(this); >+ } >+ >+ } >+ >+ @Override >+ int treeSize() { >+ return getType().treeSize(); >+ } >+ >+ @Override >+ int memSize() { >+ return BASE_NODE_SIZE + (3 * 4) + getType().memSize(); >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/HasMemberTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/HasMemberTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/HasMemberTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/HasMemberTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+/** >+ * >+ */ >+public class HasMemberTypePattern extends TypePattern { >+ >+ private SignaturePattern signaturePattern; >+ >+ public HasMemberTypePattern(AST ast, SignaturePattern signaturePattern) { >+ super(ast); >+ this.signaturePattern = signaturePattern; >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ public SignaturePattern getSignaturePattern() { >+ return signaturePattern; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ ASTNode cloned = new HasMemberTypePattern(target, >+ (SignaturePattern) getSignaturePattern().clone(target)); >+ cloned.setSourceRange(getStartPosition(), getLength()); >+ return cloned; >+ } >+ >+ @Override >+ void accept0(ASTVisitor visitor) { >+ if (visitor instanceof AjASTVisitor) { >+ AjASTVisitor ajVisitor = (AjASTVisitor) visitor; >+ boolean visited = ajVisitor.visit(this); >+ if (visited) { >+ ajVisitor.visit(getSignaturePattern()); >+ } >+ ajVisitor.endVisit(this); >+ } >+ } >+ >+ @Override >+ int memSize() { >+ return super.memSize() + getSignaturePattern().memSize(); >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/NoTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/NoTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/NoTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/NoTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class NoTypePattern extends TypePattern { >+ >+ NoTypePattern(AST ast) { >+ super(ast); >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ public boolean isStar() { >+ return false; >+ } >+ >+ ASTNode clone0(AST target) { >+ ASTNode node = new NoTypePattern(target); >+ node.setSourceRange(getStartPosition(), getLength()); >+ return node; >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/NotTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/NotTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/NotTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/NotTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class NotTypePattern extends TypePattern { >+ >+ private TypePattern negatedPattern; >+ >+ /** >+ * The negated type pattern cannot be null >+ * >+ * @param ast >+ * not null >+ * @param negatedPattern >+ * not null >+ */ >+ NotTypePattern(AST ast, TypePattern negatedPattern) { >+ super(ast); >+ this.negatedPattern = negatedPattern; >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ public TypePattern getTypePattern() { >+ return negatedPattern; >+ } >+ >+ ASTNode clone0(AST target) { >+ ASTNode node = new NotTypePattern(target, >+ (TypePattern) getTypePattern().clone(target)); >+ node.setSourceRange(getStartPosition(), getLength()); >+ return node; >+ } >+ >+ void accept0(ASTVisitor visitor) { >+ if (visitor instanceof AjASTVisitor) { >+ AjASTVisitor ajVisitor = (AjASTVisitor) visitor; >+ boolean visit = ajVisitor.visit(this); >+ if (visit) { >+ ajVisitor.visit(getTypePattern()); >+ } >+ ajVisitor.endVisit(this); >+ } >+ } >+ >+ int memSize() { >+ return super.memSize() + getTypePattern().memSize(); >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/OrTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/OrTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/OrTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/OrTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,35 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class OrTypePattern extends AbstractBooleanTypePattern { >+ >+ OrTypePattern(AST ast, >+ org.aspectj.org.eclipse.jdt.core.dom.TypePattern left, >+ org.aspectj.org.eclipse.jdt.core.dom.TypePattern right) { >+ super(ast, left, right); >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ OrTypePattern cloned = new OrTypePattern(target, >+ (TypePattern) getLeft().clone(target), (TypePattern) getRight() >+ .clone(target)); >+ cloned.setSourceRange(getStartPosition(), getLength()); >+ return cloned; >+ } >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/PatternNode.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/PatternNode.java,v >retrieving revision 1.1 >diff -u -r1.1 PatternNode.java >--- src/org/aspectj/org/eclipse/jdt/core/dom/PatternNode.java 26 Jan 2006 10:54:40 -0000 1.1 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/PatternNode.java 3 Nov 2010 17:06:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************** >- * Copyright (c) 2006 Contributors. All rights reserved. >+ * Copyright (c) 2006, 2010 Contributors. All rights reserved. > * This program and the accompanying materials are made available > * under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution and is available at >@@ -27,5 +27,5 @@ > int memSize() { > return 0; // stub method > } >- >+ > } >Index: src/org/aspectj/org/eclipse/jdt/core/dom/TypeCategoryTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/TypeCategoryTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/TypeCategoryTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/TypeCategoryTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,56 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class TypeCategoryTypePattern extends TypePattern { >+ >+ private int typeCategory; >+ >+ /** >+ * >+ * See the weaver implementation for the type categories. >+ * >+ * @see org.aspectj.weaver.patterns.TypeCategoryTypePattern >+ * @param ast >+ * must not be null >+ * @param typeCategory >+ * as defined in the corresponding weaver node type >+ */ >+ TypeCategoryTypePattern(AST ast, int typeCategory) { >+ super(ast); >+ this.typeCategory = typeCategory; >+ } >+ >+ /** >+ * >+ * See the weaver implementation for the type categories. >+ * >+ * @see org.aspectj.weaver.patterns.TypeCategoryTypePattern >+ * @return type category >+ */ >+ public int getTypeCategory() { >+ return typeCategory; >+ } >+ >+ @Override >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ @Override >+ ASTNode clone0(AST target) { >+ ASTNode cloned = new TypeCategoryTypePattern(target, getTypeCategory()); >+ cloned.setSourceRange(getStartPosition(), getLength()); >+ return cloned; >+ } >+ >+} >Index: src/org/aspectj/org/eclipse/jdt/core/dom/TypePattern.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/src/org/aspectj/org/eclipse/jdt/core/dom/TypePattern.java,v >retrieving revision 1.1 >diff -u -r1.1 TypePattern.java >--- src/org/aspectj/org/eclipse/jdt/core/dom/TypePattern.java 26 Jan 2006 10:54:40 -0000 1.1 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/TypePattern.java 3 Nov 2010 17:06:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************** >- * Copyright (c) 2006 Contributors. All rights reserved. >+ * Copyright (c) 2006, 2010 Contributors. All rights reserved. > * This program and the accompanying materials are made available > * under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution and is available at >@@ -10,20 +10,52 @@ > *******************************************************************/ > package org.aspectj.org.eclipse.jdt.core.dom; > >- > /** >- * abstract TypePattern DOM AST node. >- * has: >- * nothing at the moment >+ * abstract TypePattern DOM AST node. > */ > public abstract class TypePattern extends PatternNode { >+ >+ private String typePatternExpression; > > TypePattern(AST ast) { > super(ast); > } >+ >+ TypePattern(AST ast, String typePatternExpression) { >+ super(ast); >+ this.typePatternExpression = typePatternExpression; >+ } >+ >+ /** >+ * Return the type pattern in expression form (String representation). In many cases, >+ * this may be the same as toString(). >+ * @return String expression of the type pattern >+ */ >+ public String getTypePatternExpression() { >+ if (typePatternExpression != null) { >+ return typePatternExpression; >+ } else { >+ return toString(); >+ } >+ } >+ >+ boolean subtreeMatch0(ASTMatcher matcher, Object other) { >+ if (matcher instanceof AjASTMatcher) { >+ return ((AjASTMatcher) matcher).match(this, other); >+ } >+ return false; >+ } >+ >+ void accept0(ASTVisitor visitor) { >+ if (visitor instanceof AjASTVisitor) { >+ AjASTVisitor ajVisitor = (AjASTVisitor) visitor; >+ ajVisitor.visit(this); >+ ajVisitor.endVisit(this); >+ } >+ } > >- int memSize() { >- return 0; // stub method >+ int treeSize() { >+ return memSize(); > } > > } >Index: src/org/aspectj/org/eclipse/jdt/core/dom/WildTypePattern.java >=================================================================== >RCS file: src/org/aspectj/org/eclipse/jdt/core/dom/WildTypePattern.java >diff -N src/org/aspectj/org/eclipse/jdt/core/dom/WildTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/org/eclipse/jdt/core/dom/WildTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************** >+ * Copyright (c) 2010 Contributors. All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: Nieraj Singh - initial implementation >+ *******************************************************************/ >+package org.aspectj.org.eclipse.jdt.core.dom; >+ >+import java.util.List; >+ >+public class WildTypePattern extends AbstractJavaTypePattern { >+ >+ private String typeExpression; >+ >+ /** >+ * Use this constructor if Type is known >+ * >+ * @param ast >+ * @param type >+ */ >+ WildTypePattern(AST ast, Type type) { >+ super(ast, type); >+ } >+ >+ /** >+ * Use this constructor if Type cannot be determined >+ * >+ * @param ast >+ * @param typeExpression >+ */ >+ WildTypePattern(AST ast, String typeExpression) { >+ super(ast, null); >+ this.typeExpression = typeExpression; >+ } >+ >+ public String getTypeExpression() { >+ return typeExpression; >+ } >+ >+ List<?> internalStructuralPropertiesForType(int apiLevel) { >+ return null; >+ } >+ >+ ASTNode clone0(AST target) { >+ Type type = getType(); >+ >+ ASTNode cloned = type != null ? new WildTypePattern(target, >+ (Type) type.clone(target)) : new WildTypePattern(target, >+ getTypeExpression()); >+ cloned.setSourceRange(getStartPosition(), getLength()); >+ >+ return cloned; >+ } >+ >+} >Index: testsrc/org/aspectj/tools/ajc/AjASTTest.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjASTTest.java,v >retrieving revision 1.10 >diff -u -r1.10 AjASTTest.java >--- testsrc/org/aspectj/tools/ajc/AjASTTest.java 28 Aug 2008 03:19:50 -0000 1.10 >+++ testsrc/org/aspectj/tools/ajc/AjASTTest.java 3 Nov 2010 17:06:14 -0000 >@@ -1649,6 +1649,14 @@ > public void testDeclareParents() { > checkJLS3("class A{}class B{}aspect C {declare parents : A extends B;}", 28, 29); > } >+ >+ public void testDeclareParentsAnd() { >+ checkJLS3("class A{}class B{}class D{}aspect C {declare parents : A extends B && D ;}", 37, 34); >+ } >+ >+ public void testDeclareParentsOr() { >+ checkJLS3("class A{}class B{}class D{}aspect C {declare parents : A extends B || D;}", 37, 34); >+ } > > public void testDeclareWarning() { > checkJLS3("aspect A {pointcut a();declare warning: a(): \"error\";}", 23, 30); >#P org.aspectj.matcher >Index: src/org/aspectj/weaver/patterns/AnyTypePattern.java >=================================================================== >RCS file: src/org/aspectj/weaver/patterns/AnyTypePattern.java >diff -N src/org/aspectj/weaver/patterns/AnyTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/weaver/patterns/AnyTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,112 @@ >+/* ******************************************************************* >+ * Copyright (c) 2002, 2010 Palo Alto Research Center, Incorporated (PARC) and others. >+ * All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * PARC initial implementation >+ * ******************************************************************/ >+package org.aspectj.weaver.patterns; >+ >+import java.io.IOException; >+import java.util.Map; >+ >+import org.aspectj.util.FuzzyBoolean; >+import org.aspectj.weaver.CompressingDataOutputStream; >+import org.aspectj.weaver.ResolvedType; >+import org.aspectj.weaver.World; >+ >+public class AnyTypePattern extends TypePattern { >+ >+ /** >+ * Constructor for EllipsisTypePattern. >+ * >+ * @param includeSubtypes >+ */ >+ public AnyTypePattern() { >+ super(false, false, new TypePatternList()); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) >+ */ >+ @Override >+ protected boolean couldEverMatchSameTypesAs(TypePattern other) { >+ return true; >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType) >+ */ >+ @Override >+ protected boolean matchesExactly(ResolvedType type) { >+ return true; >+ } >+ >+ @Override >+ protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >+ return true; >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) >+ */ >+ @Override >+ public FuzzyBoolean matchesInstanceof(ResolvedType type) { >+ return FuzzyBoolean.YES; >+ } >+ >+ @Override >+ public void write(CompressingDataOutputStream s) throws IOException { >+ s.writeByte(ANY_KEY); >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind) >+ */ >+ // public FuzzyBoolean matches(IType type, MatchKind kind) { >+ // return FuzzyBoolean.YES; >+ // } >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(IType) >+ */ >+ @Override >+ protected boolean matchesSubtypes(ResolvedType type) { >+ return true; >+ } >+ >+ @Override >+ public boolean isStar() { >+ return true; >+ } >+ >+ @Override >+ public String toString() { >+ return "*"; >+ } >+ >+ @Override >+ public boolean equals(Object obj) { >+ return (obj instanceof AnyTypePattern); >+ } >+ >+ @Override >+ public int hashCode() { >+ return 37; >+ } >+ >+ @Override >+ public Object accept(PatternNodeVisitor visitor, Object data) { >+ return visitor.visit(this, data); >+ } >+ >+ @Override >+ public TypePattern parameterizeWith(Map arg0, World w) { >+ return this; >+ } >+} >\ No newline at end of file >Index: src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java >=================================================================== >RCS file: src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java >diff -N src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/weaver/patterns/AnyWithAnnotationTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,142 @@ >+/* ******************************************************************* >+ * Copyright (c) 2002, 2010 Palo Alto Research Center, Incorporated (PARC) and others. >+ * All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * PARC initial implementation >+ * ******************************************************************/ >+package org.aspectj.weaver.patterns; >+ >+import java.io.IOException; >+import java.lang.reflect.Modifier; >+import java.util.Map; >+ >+import org.aspectj.bridge.MessageUtil; >+import org.aspectj.util.FuzzyBoolean; >+import org.aspectj.weaver.CompressingDataOutputStream; >+import org.aspectj.weaver.ISourceContext; >+import org.aspectj.weaver.ResolvedType; >+import org.aspectj.weaver.VersionedDataInputStream; >+import org.aspectj.weaver.WeaverMessages; >+import org.aspectj.weaver.World; >+ >+ >+/** >+ * This type represents a type pattern of '*' but with an annotation specified, e.g. '@Color *' >+ */ >+public class AnyWithAnnotationTypePattern extends TypePattern { >+ >+ public AnyWithAnnotationTypePattern(AnnotationTypePattern atp) { >+ super(false, false); >+ annotationPattern = atp; >+ } >+ >+ @Override >+ public Object accept(PatternNodeVisitor visitor, Object data) { >+ return visitor.visit(this, data); >+ } >+ >+ @Override >+ protected boolean couldEverMatchSameTypesAs(TypePattern other) { >+ return true; >+ } >+ >+ @Override >+ protected boolean matchesExactly(ResolvedType type) { >+ annotationPattern.resolve(type.getWorld()); >+ boolean b = false; >+ if (type.temporaryAnnotationTypes != null) { >+ b = annotationPattern.matches(type, type.temporaryAnnotationTypes).alwaysTrue(); >+ } else { >+ b = annotationPattern.matches(type).alwaysTrue(); >+ } >+ return b; >+ } >+ >+ @Override >+ public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) { >+ if (requireExactType) { >+ scope.getWorld().getMessageHandler().handleMessage( >+ MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED), getSourceLocation())); >+ return NO; >+ } >+ return super.resolveBindings(scope, bindings, allowBinding, requireExactType); >+ } >+ >+ @Override >+ protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >+ annotationPattern.resolve(type.getWorld()); >+ return annotationPattern.matches(annotatedType).alwaysTrue(); >+ } >+ >+ @Override >+ public FuzzyBoolean matchesInstanceof(ResolvedType type) { >+ if (Modifier.isFinal(type.getModifiers())) { >+ return FuzzyBoolean.fromBoolean(matchesExactly(type)); >+ } >+ return FuzzyBoolean.MAYBE; >+ } >+ >+ @Override >+ public TypePattern parameterizeWith(Map typeVariableMap, World w) { >+ AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith( >+ typeVariableMap, w)); >+ ret.copyLocationFrom(this); >+ return ret; >+ } >+ >+ @Override >+ public void write(CompressingDataOutputStream s) throws IOException { >+ s.writeByte(TypePattern.ANY_WITH_ANNO); >+ annotationPattern.write(s); >+ writeLocation(s); >+ } >+ >+ public static TypePattern read(VersionedDataInputStream s, ISourceContext c) throws IOException { >+ AnnotationTypePattern annPatt = AnnotationTypePattern.read(s, c); >+ AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(annPatt); >+ ret.readLocation(c, s); >+ return ret; >+ } >+ >+ // public FuzzyBoolean matches(IType type, MatchKind kind) { >+ // return FuzzyBoolean.YES; >+ // } >+ >+ @Override >+ protected boolean matchesSubtypes(ResolvedType type) { >+ return true; >+ } >+ >+ @Override >+ public boolean isStar() { >+ return false; >+ } >+ >+ @Override >+ public String toString() { >+ return "(" + annotationPattern + " *)"; >+ } >+ >+ public AnnotationTypePattern getAnnotationTypePattern() { >+ return annotationPattern; >+ } >+ >+ @Override >+ public boolean equals(Object obj) { >+ if (!(obj instanceof AnyWithAnnotationTypePattern)) { >+ return false; >+ } >+ AnyWithAnnotationTypePattern awatp = (AnyWithAnnotationTypePattern) obj; >+ return (annotationPattern.equals(awatp.annotationPattern)); >+ } >+ >+ @Override >+ public int hashCode() { >+ return annotationPattern.hashCode(); >+ } >+} >Index: src/org/aspectj/weaver/patterns/BindingTypePattern.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BindingTypePattern.java,v >retrieving revision 1.2 >diff -u -r1.2 BindingTypePattern.java >--- src/org/aspectj/weaver/patterns/BindingTypePattern.java 18 May 2010 16:20:12 -0000 1.2 >+++ src/org/aspectj/weaver/patterns/BindingTypePattern.java 3 Nov 2010 17:06:15 -0000 >@@ -1,5 +1,5 @@ > /* ******************************************************************* >- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). >+ * Copyright (c) 2002, 2010 Palo Alto Research Center, Incorporated (PARC). > * All rights reserved. > * This program and the accompanying materials are made available > * under the terms of the Eclipse Public License v1.0 >@@ -25,6 +25,7 @@ > > public class BindingTypePattern extends ExactTypePattern implements BindingPattern { > private int formalIndex; >+ private String bindingName; > > public BindingTypePattern(UnresolvedType type, int index, boolean isVarArgs) { > super(type, false, isVarArgs); >@@ -33,11 +34,16 @@ > > public BindingTypePattern(FormalBinding binding, boolean isVarArgs) { > this(binding.getType(), binding.getIndex(), isVarArgs); >+ this.bindingName = binding.getName(); > } > > public int getFormalIndex() { > return formalIndex; > } >+ >+ public String getBindingName() { >+ return bindingName; >+ } > > public boolean equals(Object other) { > if (!(other instanceof BindingTypePattern)) { >Index: src/org/aspectj/weaver/patterns/EllipsisTypePattern.java >=================================================================== >RCS file: src/org/aspectj/weaver/patterns/EllipsisTypePattern.java >diff -N src/org/aspectj/weaver/patterns/EllipsisTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/weaver/patterns/EllipsisTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,109 @@ >+/* ******************************************************************* >+ * Copyright (c) 2002, 2010 Palo Alto Research Center, Incorporated (PARC) and others. >+ * All rights reserved. >+ * This program and the accompanying materials are made available >+ * under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * PARC initial implementation >+ * ******************************************************************/ >+package org.aspectj.weaver.patterns; >+ >+import java.io.IOException; >+import java.util.Map; >+ >+import org.aspectj.util.FuzzyBoolean; >+import org.aspectj.weaver.CompressingDataOutputStream; >+import org.aspectj.weaver.ResolvedType; >+import org.aspectj.weaver.World; >+ >+public class EllipsisTypePattern extends TypePattern { >+ >+ /** >+ * Constructor for EllipsisTypePattern. >+ * >+ * @param includeSubtypes >+ */ >+ public EllipsisTypePattern() { >+ super(false, false, new TypePatternList()); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) >+ */ >+ @Override >+ protected boolean couldEverMatchSameTypesAs(TypePattern other) { >+ return true; >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType) >+ */ >+ @Override >+ protected boolean matchesExactly(ResolvedType type) { >+ return false; >+ } >+ >+ @Override >+ protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >+ return false; >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) >+ */ >+ @Override >+ public FuzzyBoolean matchesInstanceof(ResolvedType type) { >+ return FuzzyBoolean.NO; >+ } >+ >+ @Override >+ public void write(CompressingDataOutputStream s) throws IOException { >+ s.writeByte(ELLIPSIS_KEY); >+ } >+ >+ @Override >+ public boolean isEllipsis() { >+ return true; >+ } >+ >+ @Override >+ public String toString() { >+ return ".."; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see java.lang.Object#equals(java.lang.Object) >+ */ >+ @Override >+ public boolean equals(Object obj) { >+ return (obj instanceof EllipsisTypePattern); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see java.lang.Object#hashCode() >+ */ >+ @Override >+ public int hashCode() { >+ return 17 * 37; >+ } >+ >+ @Override >+ public Object accept(PatternNodeVisitor visitor, Object data) { >+ return visitor.visit(this, data); >+ } >+ >+ @Override >+ public TypePattern parameterizeWith(Map typeVariableMap, World w) { >+ return this; >+ } >+ >+} >\ No newline at end of file >Index: src/org/aspectj/weaver/patterns/HasMemberTypePattern.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.matcher/src/org/aspectj/weaver/patterns/HasMemberTypePattern.java,v >retrieving revision 1.6 >diff -u -r1.6 HasMemberTypePattern.java >--- src/org/aspectj/weaver/patterns/HasMemberTypePattern.java 18 May 2010 16:20:12 -0000 1.6 >+++ src/org/aspectj/weaver/patterns/HasMemberTypePattern.java 3 Nov 2010 17:06:15 -0000 >@@ -49,6 +49,10 @@ > return hasMethod(type); > } > } >+ >+ public ISignaturePattern getSignaturePattern() { >+ return signaturePattern; >+ } > > private final static String declareAtPrefix = "ajc$declare_at"; > >Index: src/org/aspectj/weaver/patterns/NoTypePattern.java >=================================================================== >RCS file: src/org/aspectj/weaver/patterns/NoTypePattern.java >diff -N src/org/aspectj/weaver/patterns/NoTypePattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/aspectj/weaver/patterns/NoTypePattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,106 @@ >+package org.aspectj.weaver.patterns; >+ >+import java.io.IOException; >+import java.util.Map; >+ >+import org.aspectj.util.FuzzyBoolean; >+import org.aspectj.weaver.CompressingDataOutputStream; >+import org.aspectj.weaver.ResolvedType; >+import org.aspectj.weaver.World; >+ >+public class NoTypePattern extends TypePattern { >+ >+ public NoTypePattern() { >+ super(false, false, new TypePatternList()); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) >+ */ >+ @Override >+ protected boolean couldEverMatchSameTypesAs(TypePattern other) { >+ return false; >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType) >+ */ >+ @Override >+ protected boolean matchesExactly(ResolvedType type) { >+ return false; >+ } >+ >+ @Override >+ protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >+ return false; >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) >+ */ >+ @Override >+ public FuzzyBoolean matchesInstanceof(ResolvedType type) { >+ return FuzzyBoolean.NO; >+ } >+ >+ @Override >+ public void write(CompressingDataOutputStream s) throws IOException { >+ s.writeByte(NO_KEY); >+ } >+ >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind) >+ */ >+ // public FuzzyBoolean matches(IType type, MatchKind kind) { >+ // return FuzzyBoolean.YES; >+ // } >+ /** >+ * @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(IType) >+ */ >+ @Override >+ protected boolean matchesSubtypes(ResolvedType type) { >+ return false; >+ } >+ >+ @Override >+ public boolean isStar() { >+ return false; >+ } >+ >+ @Override >+ public String toString() { >+ return "<nothing>"; >+ }// FIXME AV - bad! toString() cannot be parsed back (not idempotent) >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see java.lang.Object#equals(java.lang.Object) >+ */ >+ @Override >+ public boolean equals(Object obj) { >+ return (obj instanceof NoTypePattern); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see java.lang.Object#hashCode() >+ */ >+ @Override >+ public int hashCode() { >+ return 17 * 37 * 37; >+ } >+ >+ @Override >+ public Object accept(PatternNodeVisitor visitor, Object data) { >+ return visitor.visit(this, data); >+ } >+ >+ @Override >+ public TypePattern parameterizeWith(Map arg0, World w) { >+ return this; >+ } >+} >Index: src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java,v >retrieving revision 1.2 >diff -u -r1.2 TypeCategoryTypePattern.java >--- src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java 18 May 2010 16:20:12 -0000 1.2 >+++ src/org/aspectj/weaver/patterns/TypeCategoryTypePattern.java 3 Nov 2010 17:06:15 -0000 >@@ -44,6 +44,10 @@ > super(false); > this.category = category; > } >+ >+ public int getTypeCategory() { >+ return category; >+ } > > @Override > protected boolean matchesExactly(ResolvedType type) { >Index: src/org/aspectj/weaver/patterns/TypePattern.java >=================================================================== >RCS file: /cvsroot/tools/org.aspectj/modules/org.aspectj.matcher/src/org/aspectj/weaver/patterns/TypePattern.java,v >retrieving revision 1.9 >diff -u -r1.9 TypePattern.java >--- src/org/aspectj/weaver/patterns/TypePattern.java 31 May 2010 17:38:07 -0000 1.9 >+++ src/org/aspectj/weaver/patterns/TypePattern.java 3 Nov 2010 17:06:15 -0000 >@@ -1,5 +1,5 @@ > /* ******************************************************************* >- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC). >+ * Copyright (c) 2002, 2010 Palo Alto Research Center, Incorporated (PARC). > * All rights reserved. > * This program and the accompanying materials are made available > * under the terms of the Eclipse Public License v1.0 >@@ -13,14 +13,12 @@ > package org.aspectj.weaver.patterns; > > import java.io.IOException; >-import java.lang.reflect.Modifier; > import java.util.Iterator; > import java.util.Map; > > import org.aspectj.bridge.MessageUtil; > import org.aspectj.util.FuzzyBoolean; > import org.aspectj.weaver.BCException; >-import org.aspectj.weaver.CompressingDataOutputStream; > import org.aspectj.weaver.ISourceContext; > import org.aspectj.weaver.IntMap; > import org.aspectj.weaver.ResolvedType; >@@ -357,392 +355,5 @@ > > } > >-class EllipsisTypePattern extends TypePattern { > >- /** >- * Constructor for EllipsisTypePattern. >- * >- * @param includeSubtypes >- */ >- public EllipsisTypePattern() { >- super(false, false, new TypePatternList()); >- } >- >- /* >- * (non-Javadoc) >- * >- * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) >- */ >- @Override >- protected boolean couldEverMatchSameTypesAs(TypePattern other) { >- return true; >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType) >- */ >- @Override >- protected boolean matchesExactly(ResolvedType type) { >- return false; >- } >- >- @Override >- protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >- return false; >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) >- */ >- @Override >- public FuzzyBoolean matchesInstanceof(ResolvedType type) { >- return FuzzyBoolean.NO; >- } >- >- @Override >- public void write(CompressingDataOutputStream s) throws IOException { >- s.writeByte(ELLIPSIS_KEY); >- } >- >- @Override >- public boolean isEllipsis() { >- return true; >- } >- >- @Override >- public String toString() { >- return ".."; >- } >- >- /* >- * (non-Javadoc) >- * >- * @see java.lang.Object#equals(java.lang.Object) >- */ >- @Override >- public boolean equals(Object obj) { >- return (obj instanceof EllipsisTypePattern); >- } >- >- /* >- * (non-Javadoc) >- * >- * @see java.lang.Object#hashCode() >- */ >- @Override >- public int hashCode() { >- return 17 * 37; >- } >- >- @Override >- public Object accept(PatternNodeVisitor visitor, Object data) { >- return visitor.visit(this, data); >- } >- >- @Override >- public TypePattern parameterizeWith(Map typeVariableMap, World w) { >- return this; >- } >- >-} >- >-class AnyTypePattern extends TypePattern { >- >- /** >- * Constructor for EllipsisTypePattern. >- * >- * @param includeSubtypes >- */ >- public AnyTypePattern() { >- super(false, false, new TypePatternList()); >- } >- >- /* >- * (non-Javadoc) >- * >- * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) >- */ >- @Override >- protected boolean couldEverMatchSameTypesAs(TypePattern other) { >- return true; >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType) >- */ >- @Override >- protected boolean matchesExactly(ResolvedType type) { >- return true; >- } >- >- @Override >- protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >- return true; >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) >- */ >- @Override >- public FuzzyBoolean matchesInstanceof(ResolvedType type) { >- return FuzzyBoolean.YES; >- } >- >- @Override >- public void write(CompressingDataOutputStream s) throws IOException { >- s.writeByte(ANY_KEY); >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind) >- */ >- // public FuzzyBoolean matches(IType type, MatchKind kind) { >- // return FuzzyBoolean.YES; >- // } >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(IType) >- */ >- @Override >- protected boolean matchesSubtypes(ResolvedType type) { >- return true; >- } >- >- @Override >- public boolean isStar() { >- return true; >- } >- >- @Override >- public String toString() { >- return "*"; >- } >- >- @Override >- public boolean equals(Object obj) { >- return (obj instanceof AnyTypePattern); >- } >- >- @Override >- public int hashCode() { >- return 37; >- } >- >- @Override >- public Object accept(PatternNodeVisitor visitor, Object data) { >- return visitor.visit(this, data); >- } >- >- @Override >- public TypePattern parameterizeWith(Map arg0, World w) { >- return this; >- } >-} >- >-/** >- * This type represents a type pattern of '*' but with an annotation specified, e.g. '@Color *' >- */ >-class AnyWithAnnotationTypePattern extends TypePattern { >- >- public AnyWithAnnotationTypePattern(AnnotationTypePattern atp) { >- super(false, false); >- annotationPattern = atp; >- } >- >- @Override >- public Object accept(PatternNodeVisitor visitor, Object data) { >- return visitor.visit(this, data); >- } >- >- @Override >- protected boolean couldEverMatchSameTypesAs(TypePattern other) { >- return true; >- } >- >- @Override >- protected boolean matchesExactly(ResolvedType type) { >- annotationPattern.resolve(type.getWorld()); >- boolean b = false; >- if (type.temporaryAnnotationTypes != null) { >- b = annotationPattern.matches(type, type.temporaryAnnotationTypes).alwaysTrue(); >- } else { >- b = annotationPattern.matches(type).alwaysTrue(); >- } >- return b; >- } >- >- @Override >- public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) { >- if (requireExactType) { >- scope.getWorld().getMessageHandler().handleMessage( >- MessageUtil.error(WeaverMessages.format(WeaverMessages.WILDCARD_NOT_ALLOWED), getSourceLocation())); >- return NO; >- } >- return super.resolveBindings(scope, bindings, allowBinding, requireExactType); >- } >- >- @Override >- protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >- annotationPattern.resolve(type.getWorld()); >- return annotationPattern.matches(annotatedType).alwaysTrue(); >- } >- >- @Override >- public FuzzyBoolean matchesInstanceof(ResolvedType type) { >- if (Modifier.isFinal(type.getModifiers())) { >- return FuzzyBoolean.fromBoolean(matchesExactly(type)); >- } >- return FuzzyBoolean.MAYBE; >- } >- >- @Override >- public TypePattern parameterizeWith(Map typeVariableMap, World w) { >- AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(this.annotationPattern.parameterizeWith( >- typeVariableMap, w)); >- ret.copyLocationFrom(this); >- return ret; >- } >- >- @Override >- public void write(CompressingDataOutputStream s) throws IOException { >- s.writeByte(TypePattern.ANY_WITH_ANNO); >- annotationPattern.write(s); >- writeLocation(s); >- } > >- public static TypePattern read(VersionedDataInputStream s, ISourceContext c) throws IOException { >- AnnotationTypePattern annPatt = AnnotationTypePattern.read(s, c); >- AnyWithAnnotationTypePattern ret = new AnyWithAnnotationTypePattern(annPatt); >- ret.readLocation(c, s); >- return ret; >- } >- >- // public FuzzyBoolean matches(IType type, MatchKind kind) { >- // return FuzzyBoolean.YES; >- // } >- >- @Override >- protected boolean matchesSubtypes(ResolvedType type) { >- return true; >- } >- >- @Override >- public boolean isStar() { >- return false; >- } >- >- @Override >- public String toString() { >- return "(" + annotationPattern + " *)"; >- } >- >- @Override >- public boolean equals(Object obj) { >- if (!(obj instanceof AnyWithAnnotationTypePattern)) { >- return false; >- } >- AnyWithAnnotationTypePattern awatp = (AnyWithAnnotationTypePattern) obj; >- return (annotationPattern.equals(awatp.annotationPattern)); >- } >- >- @Override >- public int hashCode() { >- return annotationPattern.hashCode(); >- } >-} >- >-class NoTypePattern extends TypePattern { >- >- public NoTypePattern() { >- super(false, false, new TypePatternList()); >- } >- >- /* >- * (non-Javadoc) >- * >- * @see org.aspectj.weaver.patterns.TypePattern#couldEverMatchSameTypesAs(org.aspectj.weaver.patterns.TypePattern) >- */ >- @Override >- protected boolean couldEverMatchSameTypesAs(TypePattern other) { >- return false; >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesExactly(IType) >- */ >- @Override >- protected boolean matchesExactly(ResolvedType type) { >- return false; >- } >- >- @Override >- protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { >- return false; >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesInstanceof(IType) >- */ >- @Override >- public FuzzyBoolean matchesInstanceof(ResolvedType type) { >- return FuzzyBoolean.NO; >- } >- >- @Override >- public void write(CompressingDataOutputStream s) throws IOException { >- s.writeByte(NO_KEY); >- } >- >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matches(IType, MatchKind) >- */ >- // public FuzzyBoolean matches(IType type, MatchKind kind) { >- // return FuzzyBoolean.YES; >- // } >- /** >- * @see org.aspectj.weaver.patterns.TypePattern#matchesSubtypes(IType) >- */ >- @Override >- protected boolean matchesSubtypes(ResolvedType type) { >- return false; >- } >- >- @Override >- public boolean isStar() { >- return false; >- } >- >- @Override >- public String toString() { >- return "<nothing>"; >- }// FIXME AV - bad! toString() cannot be parsed back (not idempotent) >- >- /* >- * (non-Javadoc) >- * >- * @see java.lang.Object#equals(java.lang.Object) >- */ >- @Override >- public boolean equals(Object obj) { >- return (obj instanceof NoTypePattern); >- } >- >- /* >- * (non-Javadoc) >- * >- * @see java.lang.Object#hashCode() >- */ >- @Override >- public int hashCode() { >- return 17 * 37 * 37; >- } >- >- @Override >- public Object accept(PatternNodeVisitor visitor, Object data) { >- return visitor.visit(this, data); >- } >- >- @Override >- public TypePattern parameterizeWith(Map arg0, World w) { >- return this; >- } >-}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 329268
: 182310 |
183097