From: Alexander Kriegisch Date: Fri, 26 Nov 2021 06:34:01 +0000 (+0100) Subject: Incorporate JDT Core fix + test for #105 X-Git-Tag: V1_9_8_RC3~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cbdb8e067c1c2b0d8ac19015ea4f7aa224eb54de;p=aspectj.git Incorporate JDT Core fix + test for #105 Signed-off-by: Alexander Kriegisch --- diff --git a/pom.xml b/pom.xml index 7a4aa2e91..2a816afb2 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ true - 1.9.8.RC2 + 1.9.8.RC3 9.2 1.6.3 2.6.2 diff --git a/tests/bugs198/github_105/Application.java b/tests/bugs198/github_105/Application.java new file mode 100644 index 000000000..bcf4f5624 --- /dev/null +++ b/tests/bugs198/github_105/Application.java @@ -0,0 +1,18 @@ +import java.lang.annotation.Annotation; + +/** + * {@code FooAspect} should add {@code @BarAnnotation(name = "from FooAspect")}. + *

+ * This fails in AspectJ 1.9.5 to 1.9.8.RC2 due to a removed safeguard in JDT Core, + * if the aspect is in a separate library on the aspectpath. + *

+ * See https://github.com/eclipse/org.aspectj/issues/105 + */ +@FooAnnotation +public class Application { + public static void main(String[] args) { + for (Annotation annotation : Application.class.getDeclaredAnnotations()) { + System.out.println(annotation); + } + } +} diff --git a/tests/bugs198/github_105/BarAnnotation.java b/tests/bugs198/github_105/BarAnnotation.java new file mode 100644 index 000000000..eaee4af2a --- /dev/null +++ b/tests/bugs198/github_105/BarAnnotation.java @@ -0,0 +1,11 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +public @interface BarAnnotation { + // Note: no default value + String name(); +} diff --git a/tests/bugs198/github_105/FooAnnotation.java b/tests/bugs198/github_105/FooAnnotation.java new file mode 100644 index 000000000..17e79deb4 --- /dev/null +++ b/tests/bugs198/github_105/FooAnnotation.java @@ -0,0 +1,8 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface FooAnnotation {} diff --git a/tests/bugs198/github_105/FooAspect.aj b/tests/bugs198/github_105/FooAspect.aj new file mode 100644 index 000000000..0d8e10d9b --- /dev/null +++ b/tests/bugs198/github_105/FooAspect.aj @@ -0,0 +1,4 @@ +public aspect FooAspect { + declare @type:(@FooAnnotation *) : + @BarAnnotation(name = "from FooAspect"); +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java new file mode 100644 index 000000000..69d484590 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc198; + +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Alexander Kriegisch + */ +public class Bugs198Tests extends XMLBasedAjcTestCase { + + public void testGitHub_105() { + runTest("ITD annotation with mandatory parameter via aspectpath"); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc198.xml"); + } + +} diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml index c182b58b9..dfe86e2a9 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml @@ -3,6 +3,12 @@ + + + + + +