--- /dev/null
+public class Pair<F, S> {
+ public Pair(F first, S second) { }
+}
+
+aspect IdempotentCache pertarget(cached()) {
+ pointcut cached(): execution(public * *(..)) && within(Pair);
+}
--- /dev/null
+public class Test {
+ public static void main (String args[]) {
+ Pair<String,String> pair = new Pair<String,String>("one","two");
+ }
+}
public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testFunkyGenericErrorWithITDs_pr126355() { runTest("bizarre generic error with itds");}
public void testConcretizingAbstractMethods_pr142466() { runTest("aop.xml aspect inheriting but not concretizing abstract method");}
public void testConcretizingAbstractMethods_pr142466_2() { runTest("aop.xml aspect inheriting but not concretizing abstract method - 2");}
public void testComplexGenericDecl_pr137568() { runTest("complicated generics declaration");}
public void testJarChecking_pr137235_2() { runTest("directory with .jar extension"); }
public void testMakePreMethodNPE_pr136393() { runTest("NPE in makePreMethod");}
+// public void testFunkyGenericErrorWithITDs_pr126355_2() {
+// runTest("bizarre generic error with itds - 2");
+// // public class Pair<F,S> affected by pertarget aspect
+// GenericsTests.verifyClassSignature(ajc,"Pair","<F:Ljava/lang/Object;S:Ljava/lang/Object;>Ljava/lang/Object;LIdempotentCache$ajcMightHaveAspect;;");
+// }
+
// tests that can't be included for some reason
// Not valid whilst the ajc compiler forces debug on (ignores -g:none) - it will be green but is invalid, trust me
</run>
</ajc-test>
+ <ajc-test dir="bugs152/pr126355" title="bizarre generic error with itds">
+ <compile files="Pair.java" options="-1.5"/>
+ <compile files="Test.java" options="-1.5"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr126355" title="bizarre generic error with itds - 2">
+ <compile files="Pair.java" options="-1.5"/>
+ <compile files="Test.java" options="-1.5"/>
+ </ajc-test>
+
<ajc-test dir="bugs152/pr132349" title="ITD on inner type of generic type">
<compile files="TopLevelType.java" options="-1.5"/>
<run class="TopLevelType"/>
superClass = newParent;
} else {
ResolvedType[] oldInterfaceNames = getDeclaredInterfaces();
- int len = oldInterfaceNames.length;
- ResolvedType[] newInterfaceNames = new ResolvedType[len+1];
- System.arraycopy(oldInterfaceNames, 0, newInterfaceNames, 0, len);
- newInterfaceNames[len] = newParent;
-
- interfaces = newInterfaceNames;
+ int exists = -1;
+ for (int i = 0; i < oldInterfaceNames.length; i++) {
+ ResolvedType type = oldInterfaceNames[i];
+ if (type.equals(newParent)) {exists = i;break; }
+ }
+ if (exists==-1) {
+ int len = oldInterfaceNames.length;
+ ResolvedType[] newInterfaceNames = new ResolvedType[len+1];
+ System.arraycopy(oldInterfaceNames, 0, newInterfaceNames, 0, len);
+ newInterfaceNames[len] = newParent;
+
+ interfaces = newInterfaceNames;
+ }
}
//System.err.println("javaClass: " + Arrays.asList(javaClass.getInterfaceNames()) + " super " + superclassName);
//if (lazyClassGen != null) lazyClassGen.print();
signature.append("<");
for (int i = 0; i < tVars.length; i++) {
TypeVariable variable = tVars[i];
- if (i!=0) signature.append(",");
signature.append(variable.getSignature());
}
signature.append(">");