Browse Source

382189 and 382435

tags/V1_7_0
Andy Clement 12 years ago
parent
commit
a7483038e8
40 changed files with 249 additions and 32 deletions
  1. 7
    6
      org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java
  2. 2
    0
      tests/bugs170/pr382189/covbug/A.java
  3. 12
    0
      tests/bugs170/pr382189/covbug/A_ITD.aj
  4. 3
    0
      tests/bugs170/pr382189/covbug/B.java
  5. 6
    0
      tests/bugs170/pr382189/covbug/SuperA.java
  6. 3
    0
      tests/bugs170/pr382189/covbug/SuperB.java
  7. BIN
      tests/bugs170/pr382189/covbug/cc/covbug/A.class
  8. 10
    0
      tests/bugs170/pr382189/covbug/cc/covbug/A.java
  9. 12
    0
      tests/bugs170/pr382189/covbug/cc/covbug/A_ITD.aj
  10. BIN
      tests/bugs170/pr382189/covbug/cc/covbug/B.class
  11. 8
    0
      tests/bugs170/pr382189/covbug/cc/covbug/B.java
  12. BIN
      tests/bugs170/pr382189/covbug/cc/covbug/SuperA.class
  13. 7
    0
      tests/bugs170/pr382189/covbug/cc/covbug/SuperA.java
  14. BIN
      tests/bugs170/pr382189/covbug/cc/covbug/SuperB.class
  15. 5
    0
      tests/bugs170/pr382189/covbug/cc/covbug/SuperB.java
  16. BIN
      tests/bugs170/pr382189/covbug/pj/A.class
  17. BIN
      tests/bugs170/pr382189/covbug/pj/B.class
  18. 26
    0
      tests/bugs170/pr382189/covbug/pj/Foo.java
  19. BIN
      tests/bugs170/pr382189/covbug/pj/SuperA.class
  20. BIN
      tests/bugs170/pr382189/covbug/pj/SuperB.class
  21. 1
    0
      tests/bugs170/pr382189/one/A.java
  22. 6
    0
      tests/bugs170/pr382189/one/A_ITD.aj
  23. 1
    0
      tests/bugs170/pr382189/one/B.java
  24. 5
    0
      tests/bugs170/pr382189/one/SuperA.java
  25. 2
    0
      tests/bugs170/pr382189/one/SuperB.java
  26. 6
    0
      tests/bugs170/pr382189/three/A.java
  27. 7
    0
      tests/bugs170/pr382189/three/A_ITD.aj
  28. 2
    0
      tests/bugs170/pr382189/three/B.java
  29. 5
    0
      tests/bugs170/pr382189/three/SuperA.java
  30. 2
    0
      tests/bugs170/pr382189/three/SuperB.java
  31. 1
    0
      tests/bugs170/pr382189/two/A.java
  32. 7
    0
      tests/bugs170/pr382189/two/A_ITD.aj
  33. 1
    0
      tests/bugs170/pr382189/two/B.java
  34. 5
    0
      tests/bugs170/pr382189/two/SuperA.java
  35. 2
    0
      tests/bugs170/pr382189/two/SuperB.java
  36. 17
    0
      tests/bugs170/pr382435/one/bug/A.java
  37. 21
    0
      tests/bugs170/pr382435/two/bug/A.java
  38. 24
    3
      tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java
  39. 26
    0
      tests/src/org/aspectj/systemtest/ajc170/ajc170.xml
  40. 7
    23
      weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java

+ 7
- 6
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java View File

@@ -2402,19 +2402,18 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
}

/**
* Iff I am a parameterized type, and any of my parameters are type variable references, return a version with those type
* parameters replaced in accordance with the passed bindings.
* Iff I am a parameterized type, and any of my parameters are type variable references (or nested parameterized types),
* return a version with those type parameters replaced in accordance with the passed bindings.
*/
@Override
public UnresolvedType parameterize(Map<String, UnresolvedType> typeBindings) {
if (!isParameterizedType()) {
return this;// throw new IllegalStateException(
// throw new IllegalStateException("Can't parameterize a type that is not a parameterized type");
return this;
}
// "Can't parameterize a type that is not a parameterized type"
// );
boolean workToDo = false;
for (int i = 0; i < typeParameters.length; i++) {
if (typeParameters[i].isTypeVariableReference() || (typeParameters[i] instanceof BoundedReferenceType)) {
if (typeParameters[i].isTypeVariableReference() || (typeParameters[i] instanceof BoundedReferenceType) || typeParameters[i].isParameterizedType()) {
workToDo = true;
}
}
@@ -2434,6 +2433,8 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
BoundedReferenceType brType = (BoundedReferenceType) newTypeParams[i];
newTypeParams[i] = brType.parameterize(typeBindings);
// brType.parameterize(typeBindings)
} else if (newTypeParams[i].isParameterizedType()) {
newTypeParams[i] = newTypeParams[i].parameterize(typeBindings);
}
}
return TypeFactory.createParameterizedType(getGenericType(), newTypeParams, getWorld());

+ 2
- 0
tests/bugs170/pr382189/covbug/A.java View File

@@ -0,0 +1,2 @@
package covbug;
public class A { }

+ 12
- 0
tests/bugs170/pr382189/covbug/A_ITD.aj View File

@@ -0,0 +1,12 @@
package covbug;
public privileged aspect A_ITD {
declare parents: A extends SuperA<String>;
public B A.getSomeB(SuperB<String> b){
return null;
}
}

+ 3
- 0
tests/bugs170/pr382189/covbug/B.java View File

@@ -0,0 +1,3 @@
package covbug;

public class B extends SuperB<String> { }

+ 6
- 0
tests/bugs170/pr382189/covbug/SuperA.java View File

@@ -0,0 +1,6 @@
package covbug;
import java.util.List;
public abstract class SuperA<T> {
public abstract SuperB<T> getSomeB(SuperB<T> b);
}

+ 3
- 0
tests/bugs170/pr382189/covbug/SuperB.java View File

@@ -0,0 +1,3 @@
package covbug;
public class SuperB<T> { }

BIN
tests/bugs170/pr382189/covbug/cc/covbug/A.class View File


+ 10
- 0
tests/bugs170/pr382189/covbug/cc/covbug/A.java View File

@@ -0,0 +1,10 @@
package covbug;


public class A extends SuperA<String> {
public B getSomeB(SuperB<String> b){
return null;
}


}

+ 12
- 0
tests/bugs170/pr382189/covbug/cc/covbug/A_ITD.aj View File

@@ -0,0 +1,12 @@
package covbug;
public privileged aspect A_ITD {
declare parents: A extends SuperA<String>;
public B A.getSomeB(SuperB<String> b){
return null;
}
}

BIN
tests/bugs170/pr382189/covbug/cc/covbug/B.class View File


+ 8
- 0
tests/bugs170/pr382189/covbug/cc/covbug/B.java View File

@@ -0,0 +1,8 @@
package covbug;


public class B extends SuperB<String> {



}

BIN
tests/bugs170/pr382189/covbug/cc/covbug/SuperA.class View File


+ 7
- 0
tests/bugs170/pr382189/covbug/cc/covbug/SuperA.java View File

@@ -0,0 +1,7 @@
package covbug;

import java.util.List;

public abstract class SuperA<T> {
public abstract SuperB<T> getSomeB(SuperB<T> b);
}

BIN
tests/bugs170/pr382189/covbug/cc/covbug/SuperB.class View File


+ 5
- 0
tests/bugs170/pr382189/covbug/cc/covbug/SuperB.java View File

@@ -0,0 +1,5 @@
package covbug;

public class SuperB<T> {

}

BIN
tests/bugs170/pr382189/covbug/pj/A.class View File


BIN
tests/bugs170/pr382189/covbug/pj/B.class View File


+ 26
- 0
tests/bugs170/pr382189/covbug/pj/Foo.java View File

@@ -0,0 +1,26 @@
import java.util.List;

class A extends SuperA<String> {
public B getSomeB(SuperB<String> b) { return null; }
public static void main(String []argv) {
A a = new A();
System.out.println(a.getSomeB(null));
}
}

class B extends SuperB<String> {
}

abstract class SuperA<T> {
public abstract SuperB<T> getSomeB(SuperB<T> b);
}

class SuperB<T> { }

/*
public privileged aspect A_ITD {
declare parents: A extends SuperA<String>;
public B A.getSomeB(SuperB<String> b) { return null; }
}
*/

BIN
tests/bugs170/pr382189/covbug/pj/SuperA.class View File


BIN
tests/bugs170/pr382189/covbug/pj/SuperB.class View File


+ 1
- 0
tests/bugs170/pr382189/one/A.java View File

@@ -0,0 +1 @@
public class A extends SuperA<String> { }

+ 6
- 0
tests/bugs170/pr382189/one/A_ITD.aj View File

@@ -0,0 +1,6 @@

public privileged aspect A_ITD {
public B A.getSomeB(SuperB<String> b){
return null;
}
}

+ 1
- 0
tests/bugs170/pr382189/one/B.java View File

@@ -0,0 +1 @@
public class B extends SuperB<String> { }

+ 5
- 0
tests/bugs170/pr382189/one/SuperA.java View File

@@ -0,0 +1,5 @@
import java.util.List;

public abstract class SuperA<T> {
public abstract SuperB<T> getSomeB(SuperB<T> b);
}

+ 2
- 0
tests/bugs170/pr382189/one/SuperB.java View File

@@ -0,0 +1,2 @@

public class SuperB<T> { }

+ 6
- 0
tests/bugs170/pr382189/three/A.java View File

@@ -0,0 +1,6 @@
public class A {
public static void main(String []argv) {
A a = new A();
System.out.println(a.getSomeB(null));
}
}

+ 7
- 0
tests/bugs170/pr382189/three/A_ITD.aj View File

@@ -0,0 +1,7 @@

public privileged aspect A_ITD {
declare parents: A extends SuperA<String>;
public B A.getSomeB(SuperB<String> b){
return null;
}
}

+ 2
- 0
tests/bugs170/pr382189/three/B.java View File

@@ -0,0 +1,2 @@
public class B extends SuperB<String> {
}

+ 5
- 0
tests/bugs170/pr382189/three/SuperA.java View File

@@ -0,0 +1,5 @@
import java.util.List;

public abstract class SuperA<T> {
public abstract SuperB<T> getSomeB(SuperB<T> b);
}

+ 2
- 0
tests/bugs170/pr382189/three/SuperB.java View File

@@ -0,0 +1,2 @@

public class SuperB<T> { }

+ 1
- 0
tests/bugs170/pr382189/two/A.java View File

@@ -0,0 +1 @@
public class A {}

+ 7
- 0
tests/bugs170/pr382189/two/A_ITD.aj View File

@@ -0,0 +1,7 @@

public privileged aspect A_ITD {
declare parents: A extends SuperA<String>;
public B A.getSomeB(SuperB<String> b){
return null;
}
}

+ 1
- 0
tests/bugs170/pr382189/two/B.java View File

@@ -0,0 +1 @@
public class B extends SuperB<String> { }

+ 5
- 0
tests/bugs170/pr382189/two/SuperA.java View File

@@ -0,0 +1,5 @@
import java.util.List;

public abstract class SuperA<T> {
public abstract SuperB<T> getSomeB(SuperB<T> b);
}

+ 2
- 0
tests/bugs170/pr382189/two/SuperB.java View File

@@ -0,0 +1,2 @@

public class SuperB<T> { }

+ 17
- 0
tests/bugs170/pr382435/one/bug/A.java View File

@@ -0,0 +1,17 @@
package bug;

import java.util.List;

public class A {}//extends B<String> { }

abstract class B<T> {
public abstract List<List<T>> getList();
}

privileged aspect A_ITD {
declare parents: A extends B<String>;

public List<List<String>> A.getList(){
return null;
}
}

+ 21
- 0
tests/bugs170/pr382435/two/bug/A.java View File

@@ -0,0 +1,21 @@
package bug;

import java.util.List;

public class A {
public static void main(String[] argv) {
new A().getList();
}
}//extends B<String> { }

abstract class B<T> {
public abstract List<List<T>> getList();
}

privileged aspect A_ITD {
declare parents: A extends B<String>;

public List<List<String>> A.getList(){
return null;
}
}

+ 24
- 3
tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java View File

@@ -39,6 +39,30 @@ public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// runTest("missing annos on priv aspects - 2");
// }
public void testCovariantGenerics382435_1() {
runTest("covariant generic itds 1");
}
public void testCovariantGenerics382435_2() {
runTest("covariant generic itds 2");
}

public void testCovariantGenericsItd382189_1() {
runTest("covariant generics 1");
}
public void testCovariantGenericsItd382189_2() {
runTest("covariant generics 2");
}

public void testCovariantGenericsItd382189_3() {
runTest("covariant generics 3");
}
public void testCovariantGenericsItd382189() {
runTest("covariant generics");
}
public void testGenericAspectAround382723() {
runTest("generic aspect");
}
@@ -55,9 +79,6 @@ public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("generic aspect 4");
}
// public void testCovariantGenericsItd382189() {
// runTest("covariant generics");
// }

public void testAttributeErrorJ7() {
runTest("attribute issue with J7");

+ 26
- 0
tests/src/org/aspectj/systemtest/ajc170/ajc170.xml View File

@@ -27,6 +27,32 @@
</run>
</ajc-test>
<!-- no declare parents, only ITD -->
<ajc-test dir="bugs170/pr382189/one" title="covariant generics 1">
<compile files="A.java A_ITD.aj B.java SuperA.java SuperB.java" options="-1.5"/>
</ajc-test>
<!-- now declare parents and ITD -->
<ajc-test dir="bugs170/pr382189/two" title="covariant generics 2">
<compile files="A.java A_ITD.aj B.java SuperA.java SuperB.java" options="-1.5"/>
</ajc-test>
<!-- now run it -->
<ajc-test dir="bugs170/pr382189/three" title="covariant generics 3">
<compile files="A.java A_ITD.aj B.java SuperA.java SuperB.java" options="-1.5"/>
<run class="A"/>
</ajc-test>
<ajc-test dir="bugs170/pr382435/one" title="covariant generic itds 1">
<compile files="bug/A.java" options="-1.5"/>
</ajc-test>
<ajc-test dir="bugs170/pr382435/two" title="covariant generic itds 2">
<compile files="bug/A.java" options="-1.5"/>
<run class="bug.A"/>
</ajc-test>
<ajc-test dir="bugs170/pr382189" title="covariant generics">
<compile files="covbug/A.java covbug/A_ITD.aj covbug/B.java covbug/SuperA.java covbug/SuperB.java" options="-1.5"/>
<!-- <run class="Foo">

+ 7
- 23
weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java View File

@@ -1240,7 +1240,9 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
boolean quitRightNow = false;

String localMethodName = unMangledInterMethod.getName();
String localParameterSig = unMangledInterMethod.getParameterSignature();
String erasedSig = unMangledInterMethod.getSignatureErased(); // will be something like (LSuperB;)LFoo;
String localParameterSig = erasedSig.substring(0,erasedSig.lastIndexOf(')')+1);//unMangledInterMethod.getParameterSignature();
// getParameterSignatureErased() does not include parens, which we do need.
String localReturnTypeESig = unMangledInterMethod.getReturnType().getErasureSignature();

// Step1
@@ -1295,28 +1297,10 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
InstructionFactory fact;
int pos = 0;

LazyMethodGen bridgeMethod = makeMethodGen(clazz, theBridgeMethod); // The
// bridge
// method
// in
// this
// type
// will
// have
// the
// same
// signature
// as
// the
// one
// in
// the
// supertype
bridgeMethod.setAccessFlags(bridgeMethod.getAccessFlags() | 0x00000040 /*
* BRIDGE = 0x00000040
*/);
// UnresolvedType[] newParams =
// munger.getSignature().getParameterTypes();
// The bridge method in this type will have the same signature as the one in the supertype
LazyMethodGen bridgeMethod = makeMethodGen(clazz, theBridgeMethod);
bridgeMethod.setAccessFlags(bridgeMethod.getAccessFlags() | 0x00000040 /* BRIDGE = 0x00000040 */);
// UnresolvedType[] newParams = munger.getSignature().getParameterTypes();
Type returnType = BcelWorld.makeBcelType(theBridgeMethod.getReturnType());
body = bridgeMethod.getBody();
fact = clazz.getFactory();

Loading…
Cancel
Save