@@ -0,0 +1,41 @@ | |||
import java.lang.annotation.*; | |||
enum Store {YES,NO;} | |||
@Retention(RetentionPolicy.RUNTIME) | |||
@interface SearchableProperty { Store store(); } | |||
public class FieldJP { | |||
@SearchableProperty(store=Store.YES) | |||
public static int fieldOne; | |||
@SearchableProperty(store=Store.NO) | |||
public static int fieldTwo; | |||
public static int fieldThree; | |||
public static void main(String[] args) { | |||
System.err.println("fone="+fieldOne); | |||
System.err.println("ftwo="+fieldTwo); | |||
System.err.println("fthr="+fieldThree); | |||
fieldOne = 5; | |||
fieldTwo = 6; | |||
fieldThree = 7; | |||
} | |||
} | |||
aspect X { | |||
before(): get(@SearchableProperty(store=Store.YES) * *) { | |||
System.err.println("get of YES field"); | |||
} | |||
before(): get(@SearchableProperty(store=Store.NO) * *) { | |||
System.err.println("get of NO field"); | |||
} | |||
before(): set(@SearchableProperty(store=Store.YES) * *) { | |||
System.err.println("set of YES field"); | |||
} | |||
before(): set(@SearchableProperty(store=Store.NO) * *) { | |||
System.err.println("set of NO field"); | |||
} | |||
} |
@@ -0,0 +1,5 @@ | |||
package concrete; | |||
public interface Cement { | |||
public int getWeight(); | |||
} |
@@ -0,0 +1,19 @@ | |||
package concrete; | |||
import java.util.Vector; | |||
public class ConcreteClass extends SuperClass<WetCement> { | |||
@Override | |||
public Vector<WetCement> getSomeTs() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
@Override | |||
public void addSomeTs(Vector<WetCement> newTs) { | |||
// TODO Auto-generated method stub | |||
someTs.addAll(newTs); | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
package concrete; | |||
import java.util.*; | |||
public class Main { | |||
public static void main(String[] args) { | |||
ConcreteClass cc = new ConcreteClass(); | |||
WetCement wc = new WetCement(); | |||
Vector<WetCement> v = new Vector<WetCement>(); | |||
v.add(wc); | |||
cc.addSomeTs(v); | |||
System.out.println("ran!"); | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
package concrete; | |||
import java.util.Vector; | |||
public abstract class SuperClass<T extends Cement> { | |||
Vector<T> someTs = new Vector<T>(); | |||
public abstract Vector<T> getSomeTs(); | |||
public abstract void addSomeTs(Vector<T> newTs); | |||
} |
@@ -0,0 +1,12 @@ | |||
package concrete; | |||
import java.util.Vector; | |||
public aspect SuperClassAspect { | |||
declare parents : WetCement implements Cement; | |||
after(SuperClass sc, Vector cm) returning: execution(void SuperClass.addSomeTs(Vector)) && target(sc) && args(cm) { | |||
// System.out.println(cm); | |||
} | |||
} |
@@ -0,0 +1,6 @@ | |||
package concrete; | |||
public class WetCement { | |||
boolean wet = true; | |||
public int getWeight() { return 5; } | |||
} |
@@ -0,0 +1,5 @@ | |||
package concrete; | |||
public interface Cement { | |||
public int getWeight(); | |||
} |
@@ -0,0 +1,19 @@ | |||
package concrete; | |||
import java.util.Vector; | |||
public class ConcreteClass extends SuperClass<WetCement> { | |||
@Override | |||
public Vector<WetCement> getSomeTs() { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
@Override | |||
public void addSomeTs(Vector<WetCement> newTs) { | |||
// TODO Auto-generated method stub | |||
someTs.addAll(newTs); | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
package concrete; | |||
import java.util.*; | |||
public class Main { | |||
public static void main(String[] args) { | |||
ConcreteClass cc = new ConcreteClass(); | |||
WetCement wc = new WetCement(); | |||
Vector<WetCement> v = new Vector<WetCement>(); | |||
v.add(wc); | |||
cc.addSomeTs(v); | |||
System.out.println("ran!"); | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
package concrete; | |||
import java.util.Vector; | |||
public abstract class SuperClass<T extends Cement> { | |||
Vector<T> someTs = new Vector<T>(); | |||
public abstract Vector<T> getSomeTs(); | |||
public abstract void addSomeTs(Vector<T> newTs); | |||
} |
@@ -0,0 +1,12 @@ | |||
package concrete; | |||
import java.util.Vector; | |||
public aspect SuperClassAspect { | |||
declare parents : WetCement implements Cement; | |||
after(SuperClass sc, Vector cm) returning: execution(void SuperClass.addSomeTs(Vector)) && target(sc) && args(cm) { | |||
// System.out.println(cm); | |||
} | |||
} |
@@ -0,0 +1,6 @@ | |||
package concrete; | |||
public class WetCement { | |||
boolean wet = true; | |||
public int getWeight() { return 5; } | |||
} |
@@ -0,0 +1 @@ | |||
abstract aspect AbstractComponent<C extends Base> {} |
@@ -0,0 +1 @@ | |||
abstract aspect AbstractWindow<W extends Sub> extends AbstractComponent<W> {} |
@@ -0,0 +1 @@ | |||
class Base {} |
@@ -0,0 +1 @@ | |||
class Sub extends Base {} |
@@ -0,0 +1,38 @@ | |||
/******************************************************************************* | |||
* Copyright (c) 2008 Contributors | |||
* All rights reserved. This program and the accompanying materials | |||
* are made available under the terms of the Eclipse Public License v1.0 | |||
* which accompanies this distribution, and is available at | |||
* http://www.eclipse.org/legal/epl-v10.html | |||
* | |||
* Contributors: | |||
* Andy Clement - initial API and implementation | |||
*******************************************************************************/ | |||
package org.aspectj.systemtest.ajc161; | |||
import java.io.File; | |||
import junit.framework.Test; | |||
import org.aspectj.testing.XMLBasedAjcTestCase; | |||
public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase { | |||
// AspectJ1.6.1 | |||
public void testGenericAbstractAspects_pr231478() { runTest("generic abstract aspects"); } | |||
public void testFieldJoinpointsAndAnnotationValues_pr227993() { runTest("field jp anno value"); } | |||
public void testGenericsBoundsDecp_pr231187() { runTest("generics bounds decp"); } | |||
public void testGenericsBoundsDecp_pr231187_2() { runTest("generics bounds decp - 2"); } | |||
public void testLtwInheritedCflow_pr230134() { runTest("ltw inherited cflow"); } | |||
public void testAroundAdviceOnFieldSet_pr229910() { runTest("around advice on field set"); } | |||
public void testPipelineCompilationGenericReturnType_pr226567() { runTest("pipeline compilation and generic return type"); } | |||
public static Test suite() { | |||
return XMLBasedAjcTestCase.loadSuite(Ajc161Tests.class); | |||
} | |||
protected File getSpecFile() { | |||
return new File("../tests/src/org/aspectj/systemtest/ajc161/ajc161.xml"); | |||
} | |||
} |
@@ -0,0 +1,60 @@ | |||
<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> | |||
<!-- AspectJ v1.6.1 Tests --> | |||
<suite> | |||
<ajc-test dir="bugs161/pr231478" title="generic abstract aspects"> | |||
<compile files="Base.java Sub.java AbstractComponent.java AbstractWindow.java" options="-1.5"/> | |||
</ajc-test> | |||
<ajc-test dir="bugs161/pr227993" title="field jp anno value"> | |||
<compile files="FieldJP.java" options="-1.5"/> | |||
<run class="FieldJP"> | |||
<stderr> | |||
<line text="get of YES field"/> | |||
<line text="fone=0"/> | |||
<line text="get of NO field"/> | |||
<line text="ftwo=0"/> | |||
<line text="fthr=0"/> | |||
<line text="set of YES field"/> | |||
<line text="set of NO field"/> | |||
</stderr> | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="bugs161/pr231187x" title="generics bounds decp"> | |||
<compile files="Cement.java ConcreteClass.java SuperClass.java SuperClassAspect.aj WetCement.java Main.java" options="-1.5"/> | |||
<run class="concrete.Main"> | |||
<stdout> | |||
<line text="ran!"/> | |||
</stdout> | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="bugs161/pr231187x" title="generics bounds decp - 2"> | |||
<compile files="Cement.java ConcreteClass.java SuperClass.java WetCement.java" options="-1.5"> | |||
<message kind="error" text="The type WetCement is not a valid substitute for the bounded parameter"/> | |||
</compile> | |||
</ajc-test> | |||
<ajc-test dir="bugs161/pr230134" title="ltw inherited cflow"> | |||
<compile files="HW.java"/> | |||
<compile files="SimpleTracing.java Tracing.java HelloWorldTracing.java" outjar="foo.jar"/> | |||
<run class="hello.HW" classpath="$sandbox/foo.jar" ltw="aop.xml"> | |||
<stdout> | |||
<line text="Hello World"/> | |||
</stdout> | |||
</run> | |||
</ajc-test> | |||
<ajc-test dir="bugs161/pr229910" title="around advice on field set"> | |||
<compile files="Test.java" options="-1.5"/> | |||
<run class="Test"/> | |||
</ajc-test> | |||
<ajc-test dir="bugs161/pr226567" title="pipeline compilation and generic return type"> | |||
<compile files="BarAspect.aj Foo.java Bar.java" options="-1.5"/> | |||
<compile files="BarAspect.aj Bar.java Foo.java" options="-1.5"/> | |||
</ajc-test> | |||
</suite> |