summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-11-22 09:28:09 +0000
committeracolyer <acolyer>2005-11-22 09:28:09 +0000
commit554e73397c0b80ce32e56cf3adeb6921783e005d (patch)
tree8bfd42ffa88ab47a7787aedb5428ce12965cc9ff
parent735d94f91a02e08bf5a1a86185b9318de4bd4319 (diff)
downloadaspectj-554e73397c0b80ce32e56cf3adeb6921783e005d.tar.gz
aspectj-554e73397c0b80ce32e56cf3adeb6921783e005d.zip
tests and fix for pr103051 :- declare soft and adviceexecution
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java15
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java5
-rw-r--r--tests/bugs150/Pr103051.aj12
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml4
5 files changed, 36 insertions, 4 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
index 94a12aaca..92e37675b 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
@@ -448,6 +448,12 @@ public class EclipseFactory {
public ResolvedMember makeResolvedMember(MethodBinding binding) {
return makeResolvedMember(binding, binding.declaringClass);
}
+
+ public ResolvedMember makeResolvedMember(MethodBinding binding, Shadow.Kind shadowKind) {
+ Member.Kind memberKind = binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD;
+ if (shadowKind == Shadow.AdviceExecution) memberKind = Member.ADVICE;
+ return makeResolvedMember(binding,binding.declaringClass,memberKind);
+ }
/**
* Conversion from a methodbinding (eclipse) to a resolvedmember (aspectj) is now done
@@ -481,8 +487,13 @@ public class EclipseFactory {
}
return result;
}
-
+
public ResolvedMember makeResolvedMember(MethodBinding binding, TypeBinding declaringType) {
+ return makeResolvedMember(binding,declaringType,
+ binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD);
+ }
+
+ public ResolvedMember makeResolvedMember(MethodBinding binding, TypeBinding declaringType, Member.Kind memberKind) {
//System.err.println("member for: " + binding + ", " + new String(binding.declaringClass.sourceName));
// Convert the type variables and store them
@@ -501,7 +512,7 @@ public class EclipseFactory {
ResolvedType realDeclaringType = world.resolve(fromBinding(declaringType));
if (realDeclaringType.isRawType()) realDeclaringType = realDeclaringType.getGenericType();
ResolvedMemberImpl ret = new ResolvedMemberImpl(
- binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD,
+ memberKind,
realDeclaringType,
binding.modifiers,
fromBinding(binding.returnType),
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
index 4bb3a5829..88e765040 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java
@@ -166,8 +166,9 @@ public class EclipseShadow extends Shadow {
return null;
//throw new RuntimeException("unimplemented: " + e);
}
- return new EclipseShadow(world, kind,
- world.makeResolvedMember(e.binding), astNode, context);
+ return
+ new EclipseShadow(world, kind,
+ world.makeResolvedMember(e.binding,kind), astNode, context);
} else if (astNode instanceof TypeDeclaration) {
return new EclipseShadow(world, Shadow.StaticInitialization,
new MemberImpl(Member.STATIC_INITIALIZATION,
diff --git a/tests/bugs150/Pr103051.aj b/tests/bugs150/Pr103051.aj
new file mode 100644
index 000000000..99e810431
--- /dev/null
+++ b/tests/bugs150/Pr103051.aj
@@ -0,0 +1,12 @@
+import java.io.IOException;
+
+public aspect Pr103051 {
+ declare soft: IOException: within(Pr103051) && adviceexecution();
+
+ before() : execution(* main(..)) {
+ throw new IOException("test");
+ }
+
+ public static void main(String args[]) {
+ }
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index a0cf54cff..d5df0462c 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -725,6 +725,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testReflectionOfAbstractITDs() {
runTest("reflection on abstract ITDs (Billing example)");
}
+
+ public void testDeclareSoftWithAdviceExecution() {
+ runTest("declare soft and adviceexecution");
+ }
/*
* Load-time weaving bugs
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 7920840f4..120083cf7 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -80,6 +80,10 @@
</stdout>
</run>
</ajc-test>
+
+ <ajc-test dir="bugs150" title="declare soft and adviceexecution" pr="103051">
+ <compile files="Pr103051.aj" options="-Xdev:Pinpoint"/>
+ </ajc-test>
<ajc-test dir="bugs150/pr114436" title="ClassFormatError binary weaving perthis">
<compile files="SimpleTrace.aj,ConcreteSimpleTracing.aj" outjar="aspects.jar"/>