Browse Source

it's a whole new compiler in there...

tags/PRE_ANDY
acolyer 19 years ago
parent
commit
0b7744f560

BIN
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip View File


BIN
org.eclipse.jdt.core/jdtcore-for-aspectj.jar View File


+ 5
- 5
tests/java5/ataspectj/annotationGen/BasicAdvice.aj View File

@@ -67,19 +67,19 @@ public aspect BasicAdvice {
}
private static void checkBefore(Method method) {
assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
assertTrue("expecting 2 annotations on before",method.getAnnotations().length == 2);
Before beforeAnnotation = method.getAnnotation(Before.class);
assertTrue("expecting execution(* *.*(..))",beforeAnnotation.value().equals("execution(* *.*(..))"));
}

private static void checkAfter(Method method) {
assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
assertTrue("expecting 2 annotations on after",method.getAnnotations().length == 2);
After afterAnnotation = method.getAnnotation(After.class);
assertTrue("expecting call(* Integer.*(..))",afterAnnotation.value().equals("call(* Integer.*(..))"));
}
private static void checkAfterReturning(Method method) {
assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
assertTrue("expecting 2 annotations on after returning",method.getAnnotations().length == 2);
AfterReturning afterAnnotation = method.getAnnotation(AfterReturning.class);
if (method.getParameterTypes().length == 1) {
// form with returning arg
@@ -95,7 +95,7 @@ public aspect BasicAdvice {
}

private static void checkAfterThrowing(Method method) {
assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
assertTrue("expecting 2 annotations on after throwing",method.getAnnotations().length == 2);
AfterThrowing afterAnnotation = method.getAnnotation(AfterThrowing.class);
if (method.getParameterTypes().length == 1) {
// form with returning arg
@@ -111,7 +111,7 @@ public aspect BasicAdvice {
}

private static void checkAround(Method method) {
assertTrue("expecting 2 annotations",method.getAnnotations().length == 2);
assertTrue("expecting 2 annotations on around",method.getAnnotations().length == 2);
Around aroundAnnotation = method.getAnnotation(Around.class);
assertTrue("expecting set(* foo)",aroundAnnotation.value().equals("set(* foo)"));
}

+ 19
- 0
tests/java5/ataspectj/annotationGen/Deow.aj View File

@@ -0,0 +1,19 @@
import org.aspectj.lang.reflect.*;

public aspect Deow {

declare warning : call(* System.*(..)) : "dont call system methods";
declare error : call(* System.*(..)) : "dont call system methods";
public static void main(String[] args) {
AjType myType = AjTypeSystem.getAjType(Deow.class);
DeclareErrorOrWarning[] deows = myType.getDeclareErrorOrWarnings();
if (deows.length != 2) throw new RuntimeException("Excepting 2 deows, got: " + deows.length);
if (deows[0].isError()) throw new RuntimeException("Expecting a warning");
if (!deows[1].isError()) throw new RuntimeException("Expecting an error");
if (!deows[0].getMessage().equals("dont call system methods")) throw new RuntimeException("Bad message");
if (!deows[1].getMessage().equals("dont call system methods")) throw new RuntimeException("Bad message");
if (!deows[0].getPointcutExpression().equals("call(* java.lang.System.*(..))")) throw new RuntimeException("Bad pc: " + deows[0].getPointcutExpression());
if (!deows[1].getPointcutExpression().equals("call(* java.lang.System.*(..))")) throw new RuntimeException("Bad pc: " + deows[0].getPointcutExpression());
}
}

+ 4
- 0
tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjAnnotationGenTests.java View File

@@ -122,5 +122,9 @@ public class AtAjAnnotationGenTests extends XMLBasedAjcTestCase {
public void testAdviceDeclaredInClass() {
runTest("advice in a class");
}
public void testDeows() {
runTest("ann gen for deows");
}
}


+ 6
- 0
tests/src/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml View File

@@ -137,4 +137,10 @@
</compile>
</ajc-test>

<ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for deows">
<compile files="Deow.aj" options="-1.5">
</compile>
<run class="Deow"/>
</ajc-test>
</suite>

+ 1
- 1
tests/src/org/aspectj/systemtest/ajc150/ataspectj/atajc150-tests.xml View File

@@ -205,4 +205,4 @@
<message kind="error" line="6" text="Advice must be declared inside an aspect type"/>
</compile>
</ajc-test>

+ 1
- 1
weaver/src/org/aspectj/weaver/NameMangler.java View File

@@ -22,7 +22,7 @@ public class NameMangler {
}
public static final String PREFIX = "ajc$";
public static final String ITD_PREFIX = PREFIX + "interType$";
public static final String CFLOW_STACK_TYPE = "org.aspectj.runtime.internal.CFlowStack";
public static final String CFLOW_COUNTER_TYPE="org.aspectj.runtime.internal.CFlowCounter";

+ 1
- 3
weaver/src/org/aspectj/weaver/patterns/Declare.java View File

@@ -63,7 +63,5 @@ public abstract class Declare extends PatternNode {
* this 'getNameSuffix()' method - depending on whether, at weave time, we
* want to easily differentiate between the declare methods.
*/
public String getNameSuffix() {
return "";
}
public abstract String getNameSuffix();
}

+ 3
- 0
weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java View File

@@ -98,4 +98,7 @@ public class DeclareErrorOrWarning extends Declare {
return true;
}

public String getNameSuffix() {
return "eow";
}
}

+ 3
- 0
weaver/src/org/aspectj/weaver/patterns/DeclareParents.java View File

@@ -245,4 +245,7 @@ public class DeclareParents extends Declare {
return ret;
}

public String getNameSuffix() {
return "parents";
}
}

+ 3
- 0
weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java View File

@@ -148,4 +148,7 @@ public class DeclarePrecedence extends Declare {
return false;
}

public String getNameSuffix() {
return "precedence";
}
}

+ 4
- 0
weaver/src/org/aspectj/weaver/patterns/DeclareSoft.java View File

@@ -109,4 +109,8 @@ public class DeclareSoft extends Declare {
public boolean isAdviceLike() {
return true;
}
public String getNameSuffix() {
return "soft";
}
}

Loading…
Cancel
Save