summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-09 10:48:58 +0000
committeracolyer <acolyer>2005-09-09 10:48:58 +0000
commita9ca915dc39c87267a7a763d51e87a819e9799c7 (patch)
treea5918da4b73c3079ac5077312db1d3e27e2ca955
parentd2447a0cc3201a1792ffe19579e92e0e609de7e8 (diff)
downloadaspectj-a9ca915dc39c87267a7a763d51e87a819e9799c7.tar.gz
aspectj-a9ca915dc39c87267a7a763d51e87a819e9799c7.zip
tests and fix for pr109124, not correctly recognizing synthetic fields under 1.5
-rw-r--r--tests/bugs150/VerifyErrorOnSet.aj35
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml8
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelField.java8
4 files changed, 55 insertions, 0 deletions
diff --git a/tests/bugs150/VerifyErrorOnSet.aj b/tests/bugs150/VerifyErrorOnSet.aj
new file mode 100644
index 000000000..a37f027c3
--- /dev/null
+++ b/tests/bugs150/VerifyErrorOnSet.aj
@@ -0,0 +1,35 @@
+package test;
+public class VerifyErrorOnSet {
+
+ class Node {
+ int value;
+
+ Node(int v)
+ {
+ value = v;
+ }
+ }
+
+
+ public VerifyErrorOnSet()
+ {
+ new Node(1);
+ }
+
+ public static void main(String[] args) {
+ VerifyErrorOnSet l = new VerifyErrorOnSet();
+ }
+
+}
+
+
+aspect ListAspect {
+
+ pointcut setField(Object t) : target(t) && set(* VerifyErrorOnSet.Node+.*);
+
+ before(Object t) : setField(t) {
+ System.out.println("WRITE");
+ // Do something with t...
+ }
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index f129c6f9f..08dba80f3 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -409,6 +409,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testNoUnusedParameterWarningsForSyntheticAdviceArgs() {
runTest("no unused parameter warnings for synthetic advice args");
}
+
+ public void testNoVerifyErrorWithSetOnInnerType() {
+ runTest("no verify error with set on inner type");
+ }
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index c9e48d1b3..b8ba23212 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -522,6 +522,14 @@
<compile files="pr109042.aj" options="-warn:+unusedArgument -warn:+unusedPrivate -warn:+unusedImport -1.5">
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs150" pr="109124" title="no verify error with set on inner type">
+ <compile files="VerifyErrorOnSet.aj" options="-1.5" >
+ </compile>
+ <run class="test.VerifyErrorOnSet"/>
+ </ajc-test>
+
+
<!-- ============================================================================ -->
<!-- ============================================================================ -->
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/org/aspectj/weaver/bcel/BcelField.java
index ad8edab0d..0e6f0f162 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelField.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelField.java
@@ -34,6 +34,8 @@ import org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.GenericSigna
final class BcelField extends ResolvedMemberImpl {
+ private static int AccSynthetic = 0x1000;
+
private Field field;
private boolean isAjSynthetic;
private boolean isSynthetic = false;
@@ -78,6 +80,12 @@ final class BcelField extends ResolvedMemberImpl {
for (int i = attrs.length - 1; i >= 0; i--) {
if (attrs[i] instanceof Synthetic) isSynthetic = true;
}
+
+ // in 1.5, synthetic is a modifier, not an attribute
+ if ((field.getModifiers() & AccSynthetic) != 0) {
+ isSynthetic = true;
+ }
+
}