From: aclement Date: Tue, 10 Jan 2006 09:44:47 +0000 (+0000) Subject: test and fix for pr112458 - also created the 151 test areas and driving junit infrast... X-Git-Tag: POST_MEMORY_CHANGES~194 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=53284da53f628e7c5071b87888f0624aa7528697;p=aspectj.git test and fix for pr112458 - also created the 151 test areas and driving junit infrastructure. --- diff --git a/tests/bugs151/pr112458.aj b/tests/bugs151/pr112458.aj new file mode 100644 index 000000000..d99f09c36 --- /dev/null +++ b/tests/bugs151/pr112458.aj @@ -0,0 +1,6 @@ +public class pr112458 +{ + public void setInnerClasses(InnerClass[] classes){}; + + public static class InnerClass {} +} diff --git a/tests/bugs151/pr112458_2.aj b/tests/bugs151/pr112458_2.aj new file mode 100644 index 000000000..f17abfead --- /dev/null +++ b/tests/bugs151/pr112458_2.aj @@ -0,0 +1,15 @@ +public class pr112458_2 +{ + public void setInnerClasses(InnerClass[] classes){}; + + public static class InnerClass {} + + public static void main(String []argv) { + new pr112458_2(); + } +} + +aspect X { + before(pr112458_2.InnerClass[] ics): execution(void setInnerClasses(..)) && args(ics) { + } +} diff --git a/tests/src/org/aspectj/systemtest/AllTests15.java b/tests/src/org/aspectj/systemtest/AllTests15.java index 6390e42a9..fec875785 100644 --- a/tests/src/org/aspectj/systemtest/AllTests15.java +++ b/tests/src/org/aspectj/systemtest/AllTests15.java @@ -8,6 +8,7 @@ import junit.framework.TestSuite; import org.aspectj.systemtest.ajc150.AllTestsAspectJ150; import org.aspectj.systemtest.ajc150.ataspectj.AtAjAnnotationGenTests; +import org.aspectj.systemtest.ajc151.AllTestsAspectJ151; public class AllTests15 { @@ -16,6 +17,7 @@ public class AllTests15 { //$JUnit-BEGIN$ suite.addTest(AllTests14.suite()); suite.addTest(AllTestsAspectJ150.suite()); + suite.addTest(AllTestsAspectJ151.suite()); suite.addTest(AtAjAnnotationGenTests.suite()); //$JUnit-END$ return suite; diff --git a/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java b/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java index 32748c455..11bfca888 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java +++ b/tests/src/org/aspectj/systemtest/ajc150/AllTestsAspectJ150.java @@ -24,7 +24,7 @@ import junit.framework.TestSuite; public class AllTestsAspectJ150 { public static Test suite() { - TestSuite suite = new TestSuite("Java5/AspectJ5 tests"); + TestSuite suite = new TestSuite("AspectJ1.5.0 tests"); //$JUnit-BEGIN$ suite.addTestSuite(MigrationTests.class); suite.addTest(Ajc150Tests.suite()); diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java new file mode 100644 index 000000000..fb6dfeaeb --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * Andy Clement - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc151; + +import java.io.File; + +import junit.framework.Test; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + + public void testMemberTypesInGenericTypes_pr112458() { runTest("member types in generic types");} + public void testMemberTypesInGenericTypes_pr112458_2() { runTest("member types in generic types - 2");} + + + ///////////////////////////////////////// + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc151Tests.class); + } + + protected File getSpecFile() { + return new File("../tests/src/org/aspectj/systemtest/ajc151/ajc151.xml"); + } + +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java b/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java new file mode 100644 index 000000000..31d37c5d5 --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc151/AllTestsAspectJ151.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * Andy Clement - initial API and implementation + *******************************************************************************/ +package org.aspectj.systemtest.ajc151; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllTestsAspectJ151 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.5.1 tests"); + //$JUnit-BEGIN$ + suite.addTest(Ajc151Tests.suite()); + //$JUnit-END$ + return suite; + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml new file mode 100644 index 000000000..ac841e12e --- /dev/null +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/TypeFactory.java b/weaver/src/org/aspectj/weaver/TypeFactory.java index c90672bd3..9ca5d7ba9 100644 --- a/weaver/src/org/aspectj/weaver/TypeFactory.java +++ b/weaver/src/org/aspectj/weaver/TypeFactory.java @@ -81,11 +81,23 @@ public class TypeFactory { if (signature.startsWith(ResolvedType.PARAMETERIZED_TYPE_IDENTIFIER)) { // parameterized type, calculate signature erasure and type parameters + + // (see pr112458) It is possible for a parameterized type to have *no* type parameters visible in its signature. + // This happens for an inner type of a parameterized type which simply inherits the type parameters + // of its parent. In this case it is parameterized but theres no < in the signature. + int startOfParams = signature.indexOf('<'); int endOfParams = signature.lastIndexOf('>'); - String signatureErasure = "L" + signature.substring(1,startOfParams) + ";"; - UnresolvedType[] typeParams = createTypeParams(signature.substring(startOfParams +1, endOfParams)); - return new UnresolvedType(signature,signatureErasure,typeParams); + if (startOfParams==-1) { + // Should be an inner type of a parameterized type - could assert there is a '$' in the signature.... + String signatureErasure = "L" + signature.substring(1); + UnresolvedType[] typeParams = new UnresolvedType[0]; + return new UnresolvedType(signature,signatureErasure,typeParams); + } else { + String signatureErasure = "L" + signature.substring(1,startOfParams) + ";"; + UnresolvedType[] typeParams = createTypeParams(signature.substring(startOfParams +1, endOfParams)); + return new UnresolvedType(signature,signatureErasure,typeParams); + } } else if (signature.equals("?")){ UnresolvedType ret = UnresolvedType.SOMETHING; ret.typeKind = TypeKind.WILDCARD;