From 8d8939ac74bdfb9d9e543e667b49c9dff81f0d38 Mon Sep 17 00:00:00 2001 From: acolyer Date: Wed, 22 Jun 2005 15:15:49 +0000 Subject: [PATCH] rename weaver.patterns.TypeVariable to weaver.patterns.TypeVariablePattern --- .../patterns/AbstractPatternNodeVisitor.java | 2 +- .../patterns/IdentityPointcutVisitor.java | 2 +- .../weaver/patterns/PatternNodeVisitor.java | 4 +- .../weaver/patterns/PatternParser.java | 14 ++-- .../patterns/ScopeWithTypeVariables.java | 2 +- ...Variable.java => TypeVariablePattern.java} | 18 +++--- .../patterns/TypeVariablePatternList.java | 14 ++-- .../weaver/patterns/ParserTestCase.java | 64 +++++++++---------- 8 files changed, 60 insertions(+), 60 deletions(-) rename weaver/src/org/aspectj/weaver/patterns/{TypeVariable.java => TypeVariablePattern.java} (90%) diff --git a/weaver/src/org/aspectj/weaver/patterns/AbstractPatternNodeVisitor.java b/weaver/src/org/aspectj/weaver/patterns/AbstractPatternNodeVisitor.java index 11c4ea60c..5c93d020a 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AbstractPatternNodeVisitor.java +++ b/weaver/src/org/aspectj/weaver/patterns/AbstractPatternNodeVisitor.java @@ -397,7 +397,7 @@ public abstract class AbstractPatternNodeVisitor implements PatternNodeVisitor { return node; } - public Object visit(TypeVariable node, Object data) { + public Object visit(TypeVariablePattern node, Object data) { return node; } diff --git a/weaver/src/org/aspectj/weaver/patterns/IdentityPointcutVisitor.java b/weaver/src/org/aspectj/weaver/patterns/IdentityPointcutVisitor.java index 90a302d1b..bd1269ef0 100644 --- a/weaver/src/org/aspectj/weaver/patterns/IdentityPointcutVisitor.java +++ b/weaver/src/org/aspectj/weaver/patterns/IdentityPointcutVisitor.java @@ -232,7 +232,7 @@ public class IdentityPointcutVisitor implements PatternNodeVisitor { return node; } - public Object visit(TypeVariable node, Object data) { + public Object visit(TypeVariablePattern node, Object data) { return node; } diff --git a/weaver/src/org/aspectj/weaver/patterns/PatternNodeVisitor.java b/weaver/src/org/aspectj/weaver/patterns/PatternNodeVisitor.java index 87a61a694..4e97357d0 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PatternNodeVisitor.java +++ b/weaver/src/org/aspectj/weaver/patterns/PatternNodeVisitor.java @@ -86,7 +86,7 @@ public interface PatternNodeVisitor { Object visit(NamePattern node, Object data); Object visit(SignaturePattern node, Object data); Object visit(ThrowsPattern node, Object data); - Object visit(TypeVariable node, Object data); + Object visit(TypeVariablePattern node, Object data); Object visit(TypeVariablePatternList node,Object data); // Catch-all @@ -549,7 +549,7 @@ public interface PatternNodeVisitor { return null; } - public Object visit(TypeVariable node, Object data) { + public Object visit(TypeVariablePattern node, Object data) { append(node); return null; } diff --git a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java index ade7b62db..a80e9bdea 100644 --- a/weaver/src/org/aspectj/weaver/patterns/PatternParser.java +++ b/weaver/src/org/aspectj/weaver/patterns/PatternParser.java @@ -1183,14 +1183,14 @@ public class PatternParser { public TypeVariablePatternList maybeParseTypeVariableList() { if (!maybeEat("<")) return null; List typeVars = new ArrayList(); - TypeVariable t = parseTypeVariable(); + TypeVariablePattern t = parseTypeVariable(); typeVars.add(t); while (maybeEat(",")) { - TypeVariable nextT = parseTypeVariable(); + TypeVariablePattern nextT = parseTypeVariable(); typeVars.add(nextT); } eat(">"); - TypeVariable[] tvs = new TypeVariable[typeVars.size()]; + TypeVariablePattern[] tvs = new TypeVariablePattern[typeVars.size()]; typeVars.toArray(tvs); return new TypeVariablePatternList(tvs); } @@ -1201,11 +1201,11 @@ public class PatternParser { List typeVars = new ArrayList(); do { String typeVarName = parseIdentifier(); - TypeVariable tv = new TypeVariable(typeVarName); + TypeVariablePattern tv = new TypeVariablePattern(typeVarName); typeVars.add(tv); } while (maybeEat(",")); eat(">","',' or '>'"); - TypeVariable[] tvs = new TypeVariable[typeVars.size()]; + TypeVariablePattern[] tvs = new TypeVariablePattern[typeVars.size()]; typeVars.toArray(tvs); return new TypeVariablePatternList(tvs); } @@ -1223,7 +1223,7 @@ public class PatternParser { return new TypePatternList(tps); } - public TypeVariable parseTypeVariable() { + public TypeVariablePattern parseTypeVariable() { TypePattern upperBound = null; TypePattern[] additionalInterfaceBounds = null; TypePattern lowerBound = null; @@ -1235,7 +1235,7 @@ public class PatternParser { } else if (maybeEatIdentifier("super")) { lowerBound = parseTypePattern(); } - return new TypeVariable(typeVariableName,upperBound,additionalInterfaceBounds,lowerBound); + return new TypeVariablePattern(typeVariableName,upperBound,additionalInterfaceBounds,lowerBound); } private TypePattern[] maybeParseAdditionalInterfaceBounds() { diff --git a/weaver/src/org/aspectj/weaver/patterns/ScopeWithTypeVariables.java b/weaver/src/org/aspectj/weaver/patterns/ScopeWithTypeVariables.java index dcab3ba4f..b6d450ad6 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ScopeWithTypeVariables.java +++ b/weaver/src/org/aspectj/weaver/patterns/ScopeWithTypeVariables.java @@ -36,7 +36,7 @@ public class ScopeWithTypeVariables implements IScope { * @see org.aspectj.weaver.patterns.IScope#lookupType(java.lang.String, org.aspectj.weaver.IHasPosition) */ public TypeX lookupType(String name, IHasPosition location) { - TypeVariable typeVariableMatch = typeVariables.lookupTypeVariable(name); + TypeVariablePattern typeVariableMatch = typeVariables.lookupTypeVariable(name); if (typeVariableMatch != null) { return typeVariableMatch.resolvedType(); } else { diff --git a/weaver/src/org/aspectj/weaver/patterns/TypeVariable.java b/weaver/src/org/aspectj/weaver/patterns/TypeVariablePattern.java similarity index 90% rename from weaver/src/org/aspectj/weaver/patterns/TypeVariable.java rename to weaver/src/org/aspectj/weaver/patterns/TypeVariablePattern.java index 8c667f010..6b0262456 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypeVariable.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypeVariablePattern.java @@ -30,7 +30,7 @@ import org.aspectj.weaver.VersionedDataInputStream; *
  • Foo<T extends Bar & IGoo> * */ -public class TypeVariable extends PatternNode { +public class TypeVariablePattern extends PatternNode { private static final String anything = "?"; @@ -45,7 +45,7 @@ public class TypeVariable extends PatternNode { * Create a named type variable with upper bound Object and no lower bounds. * Use this constructor for the simple "T" case */ - public TypeVariable(String variableName) { + public TypeVariablePattern(String variableName) { this.name = variableName; this.upperBound = new ExactTypePattern(TypeX.OBJECT,false,false); this.lowerBound = null; @@ -58,14 +58,14 @@ public class TypeVariable extends PatternNode { * @param variableName * @param upperBound */ - public TypeVariable(String variableName, TypePattern upperBound) { + public TypeVariablePattern(String variableName, TypePattern upperBound) { this.name = variableName; this.upperBound = upperBound; this.lowerBound = null; this.interfaceBounds = null; } - public TypeVariable(String variableName, TypePattern upperLimit, TypePattern[] interfaceBounds, TypePattern lowerBound) { + public TypeVariablePattern(String variableName, TypePattern upperLimit, TypePattern[] interfaceBounds, TypePattern lowerBound) { this.name = variableName; this.upperBound = upperLimit; if (upperBound == null) upperBound = new ExactTypePattern(TypeX.OBJECT,false,false); @@ -117,8 +117,8 @@ public class TypeVariable extends PatternNode { } public boolean equals(Object obj) { - if (!(obj instanceof TypeVariable)) return false; - TypeVariable other = (TypeVariable) obj; + if (!(obj instanceof TypeVariablePattern)) return false; + TypeVariablePattern other = (TypeVariablePattern) obj; if (!name.equals(other.name)) return false; if (!upperBound.equals(other.upperBound)) return false; if (lowerBound != null) { @@ -193,8 +193,8 @@ public class TypeVariable extends PatternNode { writeLocation(s); } - public static TypeVariable read(VersionedDataInputStream s, ISourceContext context) throws IOException { - TypeVariable tv = null; + public static TypeVariablePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException { + TypeVariablePattern tv = null; String name = s.readUTF(); TypePattern upperBound = TypePattern.read(s, context); TypePattern[] additionalInterfaceBounds = null; @@ -208,7 +208,7 @@ public class TypeVariable extends PatternNode { boolean hasLowerBound = s.readBoolean(); TypePattern lowerBound = null; if (hasLowerBound) lowerBound = TypePattern.read(s,context); - tv = new TypeVariable(name,upperBound,additionalInterfaceBounds,lowerBound); + tv = new TypeVariablePattern(name,upperBound,additionalInterfaceBounds,lowerBound); tv.readLocation(context, s); return tv; } diff --git a/weaver/src/org/aspectj/weaver/patterns/TypeVariablePatternList.java b/weaver/src/org/aspectj/weaver/patterns/TypeVariablePatternList.java index 1107d4e81..a01633130 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypeVariablePatternList.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypeVariablePatternList.java @@ -23,19 +23,19 @@ import org.aspectj.weaver.VersionedDataInputStream; */ public class TypeVariablePatternList extends PatternNode { - public static final TypeVariablePatternList EMPTY = new TypeVariablePatternList(new TypeVariable[0]); + public static final TypeVariablePatternList EMPTY = new TypeVariablePatternList(new TypeVariablePattern[0]); - private TypeVariable[] patterns; + private TypeVariablePattern[] patterns; - public TypeVariablePatternList(TypeVariable[] typeVars) { + public TypeVariablePatternList(TypeVariablePattern[] typeVars) { this.patterns = typeVars; } - public TypeVariable[] getTypeVariablePatterns() { + public TypeVariablePattern[] getTypeVariablePatterns() { return this.patterns; } - public TypeVariable lookupTypeVariable(String name) { + public TypeVariablePattern lookupTypeVariable(String name) { for (int i = 0; i < patterns.length; i++) { if (patterns[i].getName().equals(name)) { return patterns[i]; @@ -56,9 +56,9 @@ public class TypeVariablePatternList extends PatternNode { TypeVariablePatternList ret = EMPTY; int length = s.readInt(); if (length > 0) { - TypeVariable[] patterns = new TypeVariable[length]; + TypeVariablePattern[] patterns = new TypeVariablePattern[length]; for (int i = 0; i < patterns.length; i++) { - patterns[i] = TypeVariable.read(s,context); + patterns[i] = TypeVariablePattern.read(s,context); } ret = new TypeVariablePatternList(patterns); } diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/ParserTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/ParserTestCase.java index 2b07aa6b6..9fb105ca8 100644 --- a/weaver/testsrc/org/aspectj/weaver/patterns/ParserTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/patterns/ParserTestCase.java @@ -232,37 +232,37 @@ public class ParserTestCase extends TestCase { public void testParseSimpleTypeVariable() { PatternParser parser = new PatternParser("T"); - TypeVariable tv = parser.parseTypeVariable(); - TypeVariable expected = new TypeVariable("T"); + TypeVariablePattern tv = parser.parseTypeVariable(); + TypeVariablePattern expected = new TypeVariablePattern("T"); assertEquals("Expected simple type variable T",expected,tv); } public void testParseExtendingTypeVariable() { PatternParser parser = new PatternParser("T extends Number"); - TypeVariable tv = parser.parseTypeVariable(); - TypeVariable expected = new TypeVariable("T",new PatternParser("Number").parseTypePattern()); + TypeVariablePattern tv = parser.parseTypeVariable(); + TypeVariablePattern expected = new TypeVariablePattern("T",new PatternParser("Number").parseTypePattern()); assertEquals("Expected type variable T extends Number",expected,tv); } public void testParseExtendingTypeVariableWithPattern() { PatternParser parser = new PatternParser("T extends Number+"); - TypeVariable tv = parser.parseTypeVariable(); - TypeVariable expected = new TypeVariable("T",new PatternParser("Number+").parseTypePattern()); + TypeVariablePattern tv = parser.parseTypeVariable(); + TypeVariablePattern expected = new TypeVariablePattern("T",new PatternParser("Number+").parseTypePattern()); assertEquals("Expected type variable T extends Number+",expected,tv); } public void testParseExtendingTypeVariableWithInterface() { PatternParser parser = new PatternParser("T extends Number & Comparable"); - TypeVariable tv = parser.parseTypeVariable(); - TypeVariable expected = new TypeVariable("T",new PatternParser("Number").parseTypePattern(), + TypeVariablePattern tv = parser.parseTypeVariable(); + TypeVariablePattern expected = new TypeVariablePattern("T",new PatternParser("Number").parseTypePattern(), new TypePattern[] {new PatternParser("Comparable").parseTypePattern()},null); assertEquals("Expected type variable T extends Number",expected,tv); } public void testParseExtendingTypeVariableWithInterfaceList() { PatternParser parser = new PatternParser("T extends Number & Comparable & Cloneable"); - TypeVariable tv = parser.parseTypeVariable(); - TypeVariable expected = new TypeVariable("T",new PatternParser("Number").parseTypePattern(), + TypeVariablePattern tv = parser.parseTypeVariable(); + TypeVariablePattern expected = new TypeVariablePattern("T",new PatternParser("Number").parseTypePattern(), new TypePattern[] {new PatternParser("Comparable").parseTypePattern(), new PatternParser("Cloneable").parseTypePattern()},null); assertEquals("Expected type variable T extends Number",expected,tv); @@ -271,8 +271,8 @@ public class ParserTestCase extends TestCase { public void testParseTypeParameterList() { PatternParser parser = new PatternParser(""); TypeVariablePatternList list = parser.maybeParseTypeVariableList(); - TypeVariable[] patterns = list.getTypeVariablePatterns(); - TypeVariable expected = new TypeVariable("T"); + TypeVariablePattern[] patterns = list.getTypeVariablePatterns(); + TypeVariablePattern expected = new TypeVariablePattern("T"); assertEquals("Expected simple type variable T",expected,patterns[0]); assertEquals("One pattern in list",1,patterns.length); } @@ -280,12 +280,12 @@ public class ParserTestCase extends TestCase { public void testParseTypeParameterListWithSeveralTypeParameters() { PatternParser parser = new PatternParser(""); TypeVariablePatternList list = parser.maybeParseTypeVariableList(); - TypeVariable[] patterns = list.getTypeVariablePatterns(); - TypeVariable expected0 = new TypeVariable("T"); + TypeVariablePattern[] patterns = list.getTypeVariablePatterns(); + TypeVariablePattern expected0 = new TypeVariablePattern("T"); assertEquals("Expected simple type variable T",expected0,patterns[0]); - TypeVariable expected1 = new TypeVariable("S",new PatternParser("Number").parseTypePattern()); + TypeVariablePattern expected1 = new TypeVariablePattern("S",new PatternParser("Number").parseTypePattern()); assertEquals("Expected type variable S extends Number",expected1,patterns[1]); - TypeVariable expected2 = new TypeVariable("R"); + TypeVariablePattern expected2 = new TypeVariablePattern("R"); assertEquals("Expected simple type variable R",expected2,patterns[2]); assertEquals("3 patterns in list",3,patterns.length); @@ -294,8 +294,8 @@ public class ParserTestCase extends TestCase { public void testParseAllowedSuperInTypeVariable() { PatternParser parser = new PatternParser("T super Number+"); - TypeVariable tv = parser.parseTypeVariable(); - TypeVariable expected = new TypeVariable("T",new ExactTypePattern(TypeX.OBJECT,false,false),null,new PatternParser("Number+").parseTypePattern()); + TypeVariablePattern tv = parser.parseTypeVariable(); + TypeVariablePattern expected = new TypeVariablePattern("T",new ExactTypePattern(TypeX.OBJECT,false,false),null,new PatternParser("Number+").parseTypePattern()); assertEquals("Expected type variable T super Number+",expected,tv); } @@ -362,11 +362,11 @@ public class ParserTestCase extends TestCase { public void testSimpleTypeVariableList() { PatternParser parser = new PatternParser(""); TypeVariablePatternList tl = parser.maybeParseSimpleTypeVariableList(); - TypeVariable[] patterns = tl.getTypeVariablePatterns(); + TypeVariablePattern[] patterns = tl.getTypeVariablePatterns(); assertEquals("3 patterns",3,patterns.length); - assertEquals("T",new TypeVariable("T"),patterns[0]); - assertEquals("S",new TypeVariable("S"),patterns[1]); - assertEquals("V",new TypeVariable("V"),patterns[2]); + assertEquals("T",new TypeVariablePattern("T"),patterns[0]); + assertEquals("S",new TypeVariablePattern("S"),patterns[1]); + assertEquals("V",new TypeVariablePattern("V"),patterns[2]); } public void testSimpleTypeVariableListError() { @@ -382,7 +382,7 @@ public class ParserTestCase extends TestCase { public void testParseCallPCDWithTypeVariables() { PatternParser parser = new PatternParser("call(* Foo.*(T))"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvps = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvps = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type variable",1,tvps.length); assertEquals("T",tvps[0].getName()); } @@ -530,7 +530,7 @@ public class ParserTestCase extends TestCase { public void testExecutionWithTypeVariables() { PatternParser parser = new PatternParser("execution(T Bar.doSomething())"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } @@ -538,7 +538,7 @@ public class ParserTestCase extends TestCase { public void testInitializationWithTypeVariables() { PatternParser parser = new PatternParser("initialization(Bar.new())"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } @@ -546,7 +546,7 @@ public class ParserTestCase extends TestCase { public void testPreInitializationWithTypeVariables() { PatternParser parser = new PatternParser("preinitialization(Bar.new())"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } @@ -554,7 +554,7 @@ public class ParserTestCase extends TestCase { public void testStaticInitializationWithTypeVariables() { PatternParser parser = new PatternParser("staticinitialization(Bar)"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } @@ -562,7 +562,7 @@ public class ParserTestCase extends TestCase { public void testWithinWithTypeVariables() { PatternParser parser = new PatternParser("within(Bar)"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } @@ -580,7 +580,7 @@ public class ParserTestCase extends TestCase { public void testWithinCodeWithTypeVariables() { PatternParser parser = new PatternParser("withincode(Bar.new())"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("3 type patterns",3,tvs.length); assertEquals("T",tvs[0].getName()); assertEquals("S",tvs[1].getName()); @@ -590,7 +590,7 @@ public class ParserTestCase extends TestCase { public void testCallWithTypeVariables() { PatternParser parser = new PatternParser("call(* Bar.*(..))"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } @@ -598,7 +598,7 @@ public class ParserTestCase extends TestCase { public void testGetWithTypeVariables() { PatternParser parser = new PatternParser("get(* Bar.*)"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } @@ -606,7 +606,7 @@ public class ParserTestCase extends TestCase { public void testSetWithTypeVariables() { PatternParser parser = new PatternParser("set(* Bar.*)"); Pointcut pc = parser.parsePointcut(); - TypeVariable[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); + TypeVariablePattern[] tvs = pc.getTypeVariables().getTypeVariablePatterns(); assertEquals("1 type pattern",1,tvs.length); assertEquals("T",tvs[0].getName()); } -- 2.39.5