Bläddra i källkod

changed the serialized form of a WildTypePattern to remember generic info... standby for mass updates of binary comparison tests.

tags/V1_5_0M3
acolyer 19 år sedan
förälder
incheckning
40cf8dff34
38 ändrade filer med 143 tillägg och 1 borttagningar
  1. Binär
      ajde/testdata/DuplicateManifestTest/aspectjar.jar
  2. Binär
      ajde/testdata/DuplicateManifestTest/injar.jar
  3. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar
  4. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar
  5. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar
  6. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar
  7. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar
  8. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar
  9. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar
  10. Binär
      ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar
  11. Binär
      ajde/testdata/WeaveInfoMessagesTest/Simple.jar
  12. Binär
      org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar
  13. Binär
      org.aspectj.ajdt.core/testdata/OutjarTest/child.jar
  14. Binär
      org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar
  15. Binär
      tests/bugs/StringToString/helloworld.jar
  16. Binär
      tests/bugs/serialVersionUID/injar.jar
  17. Binär
      tests/new/options11/aspectlib1.jar
  18. Binär
      tests/new/options11/aspectlib2.jar
  19. Binär
      tests/new/options11/injar.jar
  20. 139
    1
      weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
  21. 1
    0
      weaver/testdata/AfterReturningFancyHelloWorld.txt
  22. 1
    0
      weaver/testdata/AfterReturningHelloWorld.txt
  23. 1
    0
      weaver/testdata/BeforeFancyHelloWorld.txt
  24. 1
    0
      weaver/testdata/BeforeHelloWorld.txt
  25. Binär
      weaver/testdata/dummyAspect.jar
  26. Binär
      weaver/testdata/ltw-acaspects.jar
  27. Binär
      weaver/testdata/ltw-aspects.jar
  28. Binär
      weaver/testdata/ltw-classes.jar
  29. Binär
      weaver/testdata/ltw-deaspects.jar
  30. Binär
      weaver/testdata/ltw-dwaspects.jar
  31. Binär
      weaver/testdata/ltw-itdaspects.jar
  32. Binär
      weaver/testdata/ltw-peraspects.jar
  33. Binär
      weaver/testdata/ltw-woven.jar
  34. Binär
      weaver/testdata/megatrace.jar
  35. Binär
      weaver/testdata/megatrace0easy.jar
  36. Binär
      weaver/testdata/megatrace0hard.jar
  37. Binär
      weaver/testdata/megatraceNoweave.jar
  38. Binär
      weaver/testdata/tracing.jar

Binär
ajde/testdata/DuplicateManifestTest/aspectjar.jar Visa fil


Binär
ajde/testdata/DuplicateManifestTest/injar.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectAdvice.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectAdvice_nodebug.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectDeclare.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectDeclareSoft_nodebug.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectDeclare_nodebug.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectITD.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/AspectITD_nodebug.jar Visa fil


Binär
ajde/testdata/WeaveInfoMessagesTest/Simple.jar Visa fil


Binär
org.aspectj.ajdt.core/testdata/OutjarTest/aspects.jar Visa fil


Binär
org.aspectj.ajdt.core/testdata/OutjarTest/child.jar Visa fil


Binär
org.aspectj.ajdt.core/testdata/OutjarTest/parent.jar Visa fil


Binär
tests/bugs/StringToString/helloworld.jar Visa fil


Binär
tests/bugs/serialVersionUID/injar.jar Visa fil


Binär
tests/new/options11/aspectlib1.jar Visa fil


Binär
tests/new/options11/aspectlib2.jar Visa fil


Binär
tests/new/options11/injar.jar Visa fil


+ 139
- 1
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java Visa fil

@@ -36,6 +36,102 @@ import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.WeaverMessages;

//XXX need to use dim in matching
/**
* The PatternParser always creates WildTypePatterns for type patterns in pointcut
* expressions (apart from *, which is sometimes directly turned into TypePattern.ANY).
* resolveBindings() tries to work out what we've really got and turn it into a type
* pattern that we can use for matching. This will normally be either an ExactTypePattern
* or a WildTypePattern.
*
* Here's how the process pans out for various generic and parameterized patterns:
* (see GenericsWildTypePatternResolvingTestCase)
*
* Foo where Foo exists and is generic
* Parser creates WildTypePattern namePatterns={Foo}
* resolveBindings resolves Foo to RT(Foo - raw)
* return ExactTypePattern(LFoo;)
*
* <E>... Foo<E> where Foo exists and has one unbound type var
* Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{E}
* resolveBindings requireExactType = true | false
* resolves typeParameters to ExactTypePattern(TVRT(E))
* resolves Foo to RT(Foo - raw)
* returns ExactTypePattern(<1:>LFoo; - generic) 1=E
*
* <E>... Foo<E> where Foo exists and is not generic (or has different bounds)
* Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{E}
* resolveBindings resolves typeParameters to ExactTypePattern(TVRT(E))
* resolves Foo to RT(Foo)
* finds that Foo is not generic / type var mismatch
* requireExactType = true ->returns TypePattern.NO (and issues error)
* = false -> XLint then return ExactTypePattern(<1:>LFoo;)
*
* <E>... Foo<E extends Number> where Foo exists and bounds match
* Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{E},uB=WTP{Number}
* resolveBindings resolves typeParameters to ExactTypePattern(TVRT(E extends Number))
* resolves Foo to RT(Foo)
* returns ExactTypePattern(<1:Ljava/lang/Number;>LFoo;) 1=E
*
* Foo<String> where Foo exists and String meets the bounds
* Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{String}
* resolveBindings resolves typeParameters to ExactTypePattern(String)
* resolves Foo to RT(Foo)
* returns ExactTypePattern(PFoo<String>; - parameterized)
*
* Foo<Str*> where Foo exists and takes one bound
* Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{Str*}
* resolveBindings resolves typeParameters to WTP{Str*}
* resolves Foo to RT(Foo)
* returns WildTypePattern(name = Foo, typeParameters = WTP{Str*} isGeneric=false)
*
* Fo*<String>
* Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{String}
* resolveBindings resolves typeParameters to ETP{String}
* returns WildTypePattern(name = Fo*, typeParameters = ETP{String} isGeneric=false)
*
* <E>... Fo*<E>
* Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{E}
* resolveBindings resolves typeParameters to ETP{TVRT(E)}
* returns WildTypePattern(name = Fo*, typeParameters = ETP{TVRT(E)} isGeneric=true)
*
* <E>... Fo*<E extends Number>
* Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{E,uB=WTP(Number)}
* resolveBindings resolves typeParameters to ETP{TVRT(E extends Number)}
* returns WildTypePattern(name = Fo*, typeParameters = ETP{TVRT(E extends Number)} isGeneric=true)
*
* <E>... Foo<E extends Number+> where Foo exists and takes one bound
* Parser creates WildTypePattern namePatterns = {Foo}, typeParameters=WTP{E,uB=WTP(Number+)}
* resolveBindings resolves typeParameters to WildTypeVariableReferencePattern{TVP(name="E",uB=Number+)}
* resolves Foo to RT(Foo)
* if requireExactType (but this doesn't allow + ? )
* if typeParameters.matches(RT(Foo - generic).getTypeVariables()
* return ETP(<1:Ljava/lang/Number;>LFoo;)
* else return TypePattern.NO and issue warning
* else
* if !typeParameters.matches(RT(Foo - generic).getTypeVariables()
* issue warning (XLint?)
* return WildTypePattern(name=Foo, typeParameters=WTVRP{TVP(E,Number+)} isGeneric=true
*
* <E>... Fo*<E extends Number+>
* Parser creates WildTypePattern namePatterns = {Fo*}, typeParameters=WTP{E,uB=WTP(Number+)}
* resolveBindings resolves typeParameters to WildTypeVariableReferencePattern{TVP(name="E",uB=Number+)}
* returns WildTypePattern(name=Fo*, typeParamters = WTVRP{TVP(name="E" ub=Number+)} isGeneric=true)
*
* TODO:
*
* <E>... Foo<E,String>
*
* <S,T>... Foo<S,T extends S>
*
* Foo<?>
*
* Foo<? extends Number>
*
* Foo<? extends Number+>
*
* Foo<? super Number>
*
*/
public class WildTypePattern extends TypePattern {
private NamePattern[] namePatterns;
int ellipsisCount;
@@ -168,10 +264,25 @@ public class WildTypePattern extends TypePattern {
annotationPattern.resolve(type.getWorld());
return matchesExactlyByName(targetTypeName) &&
// matchesParameters(type) &&
annotationPattern.matches(annotatedType).alwaysTrue();
}
// we've matched against the base (or raw) type, but if this type pattern specifies parameters or
// type variables we need to make sure we match against them too
private boolean matchesParameters(ResolvedType aType) {
if (isGeneric) {
if (!aType.isGenericType()) return false;
// we have to match type variables
} else if (typeParameters.size() > 0) {
if(!aType.isParameterizedType()) return false;
// we have to match type parameters
}
return true;
}
/**
* Used in conjunction with checks on 'isStar()' to tell you if this pattern represents '*' or '*[]' which are
* different !
@@ -479,7 +590,7 @@ public class WildTypePattern extends TypePattern {
// use a special variant of Any TypePattern called
// AnyWithAnnotation
if (annotationPattern == AnnotationTypePattern.ANY) {
if (dim == 0 && !isVarArgs) { // pr72531
if (dim == 0 && !isVarArgs && upperBound == null && lowerBound == null && (additionalInterfaceBounds == null || additionalInterfaceBounds.length==0)) { // pr72531
return TypePattern.ANY; //??? loses source location
}
} else {
@@ -889,6 +1000,18 @@ public class WildTypePattern extends TypePattern {
FileUtil.writeStringArray(importedPrefixes, s);
writeLocation(s);
annotationPattern.write(s);
// generics info, new in M3
s.writeBoolean(isGeneric);
s.writeBoolean(upperBound != null);
if (upperBound != null) upperBound.write(s);
s.writeBoolean(lowerBound != null);
if (lowerBound != null) lowerBound.write(s);
s.writeInt(additionalInterfaceBounds == null ? 0 : additionalInterfaceBounds.length);
if (additionalInterfaceBounds != null) {
for (int i = 0; i < additionalInterfaceBounds.length; i++) {
additionalInterfaceBounds[i].write(s);
}
}
}
public static TypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException {
@@ -918,6 +1041,21 @@ public class WildTypePattern extends TypePattern {
ret.importedPrefixes = FileUtil.readStringArray(s);
ret.readLocation(context, s);
ret.setAnnotationTypePattern(AnnotationTypePattern.read(s,context));
// generics info, new in M3
ret.isGeneric = s.readBoolean();
if (s.readBoolean()) {
ret.upperBound = TypePattern.read(s,context);
}
if (s.readBoolean()) {
ret.lowerBound = TypePattern.read(s,context);
}
int numIfBounds = s.readInt();
if (numIfBounds > 0) {
ret.additionalInterfaceBounds = new TypePattern[numIfBounds];
for (int i = 0; i < numIfBounds; i++) {
ret.additionalInterfaceBounds[i] = TypePattern.read(s,context);
}
}
return ret;
}

+ 1
- 0
weaver/testdata/AfterReturningFancyHelloWorld.txt Visa fil

@@ -98,4 +98,5 @@ public abstract class FancyHelloWorld extends java.lang.Object:
| ARETURN
method-execution(java.lang.String FancyHelloWorld.getName())
end public static String getName()

end public abstract class FancyHelloWorld

+ 1
- 0
weaver/testdata/AfterReturningHelloWorld.txt Visa fil

@@ -27,4 +27,5 @@ public class HelloWorld extends java.lang.Object:
| RETURN
method-execution(void HelloWorld.main(java.lang.String[]))
end public static void main(String[])

end public class HelloWorld

+ 1
- 0
weaver/testdata/BeforeFancyHelloWorld.txt Visa fil

@@ -87,4 +87,5 @@ public abstract class FancyHelloWorld extends java.lang.Object:
| ARETURN
method-execution(java.lang.String FancyHelloWorld.getName())
end public static String getName()

end public abstract class FancyHelloWorld

+ 1
- 0
weaver/testdata/BeforeHelloWorld.txt Visa fil

@@ -23,4 +23,5 @@ public class HelloWorld extends java.lang.Object:
| RETURN (line 11)
method-execution(void HelloWorld.main(java.lang.String[]))
end public static void main(String[])

end public class HelloWorld

Binär
weaver/testdata/dummyAspect.jar Visa fil


Binär
weaver/testdata/ltw-acaspects.jar Visa fil


Binär
weaver/testdata/ltw-aspects.jar Visa fil


Binär
weaver/testdata/ltw-classes.jar Visa fil


Binär
weaver/testdata/ltw-deaspects.jar Visa fil


Binär
weaver/testdata/ltw-dwaspects.jar Visa fil


Binär
weaver/testdata/ltw-itdaspects.jar Visa fil


Binär
weaver/testdata/ltw-peraspects.jar Visa fil


Binär
weaver/testdata/ltw-woven.jar Visa fil


Binär
weaver/testdata/megatrace.jar Visa fil


Binär
weaver/testdata/megatrace0easy.jar Visa fil


Binär
weaver/testdata/megatrace0hard.jar Visa fil


Binär
weaver/testdata/megatraceNoweave.jar Visa fil


Binär
weaver/testdata/tracing.jar Visa fil


Laddar…
Avbryt
Spara