diff options
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/MemberImpl.java | 4 | ||||
-rw-r--r-- | testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java | 17 | ||||
-rw-r--r-- | tests/bugs185/455608/Code2.java | 16 | ||||
-rw-r--r-- | tests/bugs185/455608/Code3.java | 17 | ||||
-rw-r--r-- | tests/bugs185/456357/DummyClass.java | 13 | ||||
-rw-r--r-- | tests/bugs185/456357/LogMe.java | 5 | ||||
-rw-r--r-- | tests/bugs185/456357/SampleAspect.java | 10 | ||||
-rw-r--r-- | tests/bugs185/456357/SampleUtil.java | 5 | ||||
-rw-r--r-- | tests/multiIncremental/456801/base/src/Code.java | 5 | ||||
-rw-r--r-- | tests/multiIncremental/456801/base/src/X.java | 5 | ||||
-rw-r--r-- | tests/multiIncremental/456801/inc1/src/X.java | 5 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java | 29 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc185/ajc185.xml | 17 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java | 13 |
14 files changed, 159 insertions, 2 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/MemberImpl.java b/org.aspectj.matcher/src/org/aspectj/weaver/MemberImpl.java index 7fc1c6524..fbf497ed2 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/MemberImpl.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/MemberImpl.java @@ -105,14 +105,14 @@ public class MemberImpl implements Member { StringBuilder buf = new StringBuilder(); buf.append("("); for (UnresolvedType paramType : paramTypes) { - if (eraseGenerics && (paramType.isParameterizedType() || paramType.isTypeVariableReference())) { + if (eraseGenerics) { buf.append(paramType.getErasureSignature()); } else { buf.append(paramType.getSignature()); } } buf.append(")"); - if (eraseGenerics && (returnType.isParameterizedType() || returnType.isTypeVariableReference())) { + if (eraseGenerics) { buf.append(returnType.getErasureSignature()); } else { buf.append(returnType.getSignature()); diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java index 0126d29b3..14952a537 100644 --- a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -11,6 +11,7 @@ * ******************************************************************/ package org.aspectj.testing; +import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FilenameFilter; @@ -313,6 +314,22 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { ClassPath cp = new ClassPath(cpentry + File.pathSeparator + System.getProperty("java.class.path")); return SyntheticRepository.getInstance(cp); } + + protected byte[] loadFileAsByteArray(File f) { + try { + byte[] bs = new byte[100000]; + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f)); + int pos = 0; + int len = 0; + while ((len=bis.read(bs, pos, 100000-pos))!=-1) { + pos+=len; + } + bis.close(); + return bs; + } catch (Exception e) { + return null; + } + } public JavaClass getClassFrom(File where, String clazzname) throws ClassNotFoundException { SyntheticRepository repos = createRepos(where); diff --git a/tests/bugs185/455608/Code2.java b/tests/bugs185/455608/Code2.java new file mode 100644 index 000000000..6622b7b3e --- /dev/null +++ b/tests/bugs185/455608/Code2.java @@ -0,0 +1,16 @@ +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Bar(String) +@Foo("abc") +public class Code2 { + +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Foo { String value();} + +@Retention(RetentionPolicy.RUNTIME) +@interface Bar { + Class<?>[] value(); +} diff --git a/tests/bugs185/455608/Code3.java b/tests/bugs185/455608/Code3.java new file mode 100644 index 000000000..a6271fb14 --- /dev/null +++ b/tests/bugs185/455608/Code3.java @@ -0,0 +1,17 @@ +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Bar(value=String,i=4) +//@Foo("abc") +public class Code3 { + +} + +@Retention(RetentionPolicy.RUNTIME) +@interface Foo { String value();} + +@Retention(RetentionPolicy.RUNTIME) +@interface Bar { + Class<?>[] value(); +int i(); +} diff --git a/tests/bugs185/456357/DummyClass.java b/tests/bugs185/456357/DummyClass.java new file mode 100644 index 000000000..f3d8572ec --- /dev/null +++ b/tests/bugs185/456357/DummyClass.java @@ -0,0 +1,13 @@ +public class DummyClass { + @LogMe + public void doSomething() { + SampleUtil sampleUtil = new SampleUtil(); + // pass null for simplicity ! + sampleUtil.sampleMethod(null); + System.out.println("Do Something"); + } + + public static void main(String[] args) { + new DummyClass().doSomething(); + } +} diff --git a/tests/bugs185/456357/LogMe.java b/tests/bugs185/456357/LogMe.java new file mode 100644 index 000000000..a16ca765a --- /dev/null +++ b/tests/bugs185/456357/LogMe.java @@ -0,0 +1,5 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface LogMe {} diff --git a/tests/bugs185/456357/SampleAspect.java b/tests/bugs185/456357/SampleAspect.java new file mode 100644 index 000000000..15b52fa71 --- /dev/null +++ b/tests/bugs185/456357/SampleAspect.java @@ -0,0 +1,10 @@ +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.*; + +aspect SampleAspect { +//@Aspect public class SampleAspect { + //@Before("@annotation(logMe)") public void beforeAdvice(JoinPoint thisJoinPoint, LogMe logMe) { +before(LogMe logMe): @annotation(logMe) { + System.out.println(thisJoinPoint); + } +} diff --git a/tests/bugs185/456357/SampleUtil.java b/tests/bugs185/456357/SampleUtil.java new file mode 100644 index 000000000..1ed161c42 --- /dev/null +++ b/tests/bugs185/456357/SampleUtil.java @@ -0,0 +1,5 @@ +import java.util.Map; + +public class SampleUtil { + public void sampleMethod(Map<String, Object>[] mapArray) {} +} diff --git a/tests/multiIncremental/456801/base/src/Code.java b/tests/multiIncremental/456801/base/src/Code.java new file mode 100644 index 000000000..5df0fe35e --- /dev/null +++ b/tests/multiIncremental/456801/base/src/Code.java @@ -0,0 +1,5 @@ +public class Code { + public static void run() { + System.out.println("run() running"); + } +} diff --git a/tests/multiIncremental/456801/base/src/X.java b/tests/multiIncremental/456801/base/src/X.java new file mode 100644 index 000000000..9f31b068e --- /dev/null +++ b/tests/multiIncremental/456801/base/src/X.java @@ -0,0 +1,5 @@ +aspect X { + before(): execution(* run(..)) { + System.out.println("advice runnning"); + } +} diff --git a/tests/multiIncremental/456801/inc1/src/X.java b/tests/multiIncremental/456801/inc1/src/X.java new file mode 100644 index 000000000..cb45d40ea --- /dev/null +++ b/tests/multiIncremental/456801/inc1/src/X.java @@ -0,0 +1,5 @@ +aspect X { + before(): execution(* run(..)) { + System.out.println("advice running"); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java b/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java index 135eb8464..cc9800043 100644 --- a/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc185/Ajc185Tests.java @@ -10,10 +10,15 @@ *******************************************************************************/ package org.aspectj.systemtest.ajc185; +import java.io.BufferedInputStream; import java.io.File; +import java.io.FileInputStream; import junit.framework.Test; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen; +import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.aspectj.testing.XMLBasedAjcTestCase; /** @@ -21,6 +26,30 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class Ajc185Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testUnresolvableMember_456357() throws Exception { + runTest("unresolvable member"); + } + + // Waiting on JDT fix. Second test is a 'variant' that is also causing me issues but not JDT it seems. Let's + // see what happens when we pick up the real fixes. +// public void testBadAnnos_455608() throws Exception { +// runTest("bad annos"); +// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code2"); +// File f = new File(ajc.getSandboxDirectory(), "Code2.class"); +// byte[] data = loadFileAsByteArray(f); +// // Will throw ClassFormatException if there is a problem +// new ClassFileReader(data, null); +// } +// +// public void testBadAnnos_455608_2() throws Exception { +// runTest("bad annos 2"); +// JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code3"); +// File f = new File(ajc.getSandboxDirectory(), "Code3.class"); +// byte[] data = loadFileAsByteArray(f); +// // Will throw ClassFormatException if there is a problem +// new ClassFileReader(data, null); +// } + public void testITDInterface_451966() throws Exception { runTest("itd interface"); } diff --git a/tests/src/org/aspectj/systemtest/ajc185/ajc185.xml b/tests/src/org/aspectj/systemtest/ajc185/ajc185.xml index 7c30d7bf4..15fee4e84 100644 --- a/tests/src/org/aspectj/systemtest/ajc185/ajc185.xml +++ b/tests/src/org/aspectj/systemtest/ajc185/ajc185.xml @@ -2,6 +2,23 @@ <suite> +<ajc-test dir="bugs185/456357" title="unresolvable member"> +<compile files="DummyClass.java LogMe.java SampleAspect.java SampleUtil.java" options="-1.7"> +</compile> +</ajc-test> + +<ajc-test dir="bugs185/455608" title="bad annos"> +<compile files="Code2.java" options="-1.8 -proceedOnError"> + <message kind="error" text="String cannot be resolved to a variable"/> +</compile> +</ajc-test> + +<ajc-test dir="bugs185/455608" title="bad annos 2"> +<compile files="Code3.java" options="-1.8 -proceedOnError"> + <message kind="error" text="String cannot be resolved to a variable"/> +</compile> +</ajc-test> + <ajc-test dir="bugs185/451966" title="itd interface"> <compile files="Code.java" options="-1.8"/> <run class="Code"> diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 40bc9322a..7080c03c9 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -3570,6 +3570,19 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa build("PR154054"); checkWasntFullBuild(); } + + public void testIncrementalBuildAdviceChange_456801() throws Exception { + initialiseProject("456801"); + build("456801"); + String output = runMethod("456801", "Code", "run"); + assertEquals("advice runnning\nrun() running\n",output); + alter("456801", "inc1"); + build("456801"); + output = runMethod("456801", "Code", "run"); + assertEquals("advice running\nrun() running\n",output); + checkCompileWeaveCount("456801", 1, 1); + checkWasntFullBuild(); + } // change exception type in around advice, does it notice? public void testShouldFullBuildOnExceptionChange_pr154054() { |