diff options
author | Andy Clement <aclement@vmware.com> | 2012-03-02 14:31:45 -0800 |
---|---|---|
committer | Andy Clement <aclement@vmware.com> | 2012-03-02 14:31:45 -0800 |
commit | eec87199cd0fbba7a16a63b7db61d3a0a0fd58c6 (patch) | |
tree | 50e06ee16ac626abab66eea22f6507fb9207ba4d | |
parent | d4a8cc90482cb538a88f74a9aae99a323e547c84 (diff) | |
parent | 0cf0cb2dfb690891fe5eb7f4219e383ed666a0fc (diff) | |
download | aspectj-eec87199cd0fbba7a16a63b7db61d3a0a0fd58c6.tar.gz aspectj-eec87199cd0fbba7a16a63b7db61d3a0a0fd58c6.zip |
373130: transient tjps
5 files changed, 49 insertions, 4 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/org/aspectj/weaver/World.java index 9821f9ad5..ba0fa3a1f 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/World.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/World.java @@ -132,6 +132,7 @@ public abstract class World implements Dump.INode { private boolean synchronizationPointcutsInUse = false; // Xset'table options private boolean runMinimalMemory = false; + private boolean transientTjpFields = false; private boolean runMinimalMemorySet = false; private boolean shouldPipelineCompilation = true; private boolean shouldGenerateStackMaps = false; @@ -944,6 +945,7 @@ public abstract class World implements Dump.INode { // false public final static String xsetDEBUG_BRIDGING = "debugBridging"; // default // false + public final static String xsetTRANSIENT_TJP_FIELDS = "makeTjpFieldsTransient"; // default false public final static String xsetBCEL_REPOSITORY_CACHING = "bcelRepositoryCaching"; public final static String xsetPIPELINE_COMPILATION = "pipelineCompilation"; public final static String xsetGENERATE_STACKMAPS = "generateStackMaps"; @@ -1615,6 +1617,9 @@ public abstract class World implements Dump.INode { s = p.getProperty(xsetDEBUG_STRUCTURAL_CHANGES_CODE, "false"); forDEBUG_structuralChangesCode = s.equalsIgnoreCase("true"); + + s = p.getProperty(xsetTRANSIENT_TJP_FIELDS,"false"); + transientTjpFields = s.equalsIgnoreCase("true"); s = p.getProperty(xsetDEBUG_BRIDGING, "false"); forDEBUG_bridgingCode = s.equalsIgnoreCase("true"); @@ -1669,6 +1674,11 @@ public abstract class World implements Dump.INode { ensureAdvancedConfigurationProcessed(); return runMinimalMemory; } + + public boolean isTransientTjpFields() { + ensureAdvancedConfigurationProcessed(); + return transientTjpFields; + } public boolean isRunMinimalMemorySet() { ensureAdvancedConfigurationProcessed(); diff --git a/tests/bugs170/transientTjpFields/Code.java b/tests/bugs170/transientTjpFields/Code.java new file mode 100644 index 000000000..8b4c44e17 --- /dev/null +++ b/tests/bugs170/transientTjpFields/Code.java @@ -0,0 +1,12 @@ +public class Code { + public void m() { + } + + public void n() { + } + +} + +aspect X { + before(): execution(* Code.*(..)) {System.out.println(thisJoinPointStaticPart);} +} diff --git a/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java b/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java index 84add7bc6..bfb995d12 100644 --- a/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java @@ -14,17 +14,32 @@ import java.io.File; import junit.framework.Test; +import org.aspectj.apache.bcel.classfile.Field; +import org.aspectj.apache.bcel.classfile.JavaClass; import org.aspectj.testing.XMLBasedAjcTestCase; import org.aspectj.weaver.TypeFactory; import org.aspectj.weaver.UnresolvedType; /** * @author Andy Clement - */ + */ public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testBCExceptionAnnoDecp_371998() { runTest("BCException anno decp"); + } + + public void testTransientTjpFields()throws Exception { + runTest("transient tjp fields"); + JavaClass jc = getClassFrom(ajc.getSandboxDirectory(), "Code"); + Field[] fs = jc.getFields(); + //private static final org.aspectj.lang.JoinPoint$StaticPart ajc$tjp_0 [Synthetic] + //private static final org.aspectj.lang.JoinPoint$StaticPart ajc$tjp_1 [Synthetic] + for (Field f: fs) { + if (!f.isTransient()) { + fail("Field should be transient: "+f); + } + } } public void testGenericsWithTwoTypeParamsOneWildcard() { @@ -159,4 +174,4 @@ public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase { return new File("../tests/src/org/aspectj/systemtest/ajc170/ajc170.xml"); } -}
\ No newline at end of file +} diff --git a/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml b/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml index 8d4eedacf..b5ce9623c 100644 --- a/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml +++ b/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml @@ -12,6 +12,11 @@ <run class="AspectTest"/> </ajc-test> + <ajc-test dir="bugs170/transientTjpFields" title="transient tjp fields"> + <compile files="Code.java" options="-Xset:makeTjpFieldsTransient=true"> + </compile> + </ajc-test> + <ajc-test dir="bugs170/language" title="perthis"> <compile files="PerThis.java" options="-1.7"> </compile> @@ -142,4 +147,4 @@ </compile> </ajc-test> -</suite>
\ No newline at end of file +</suite> diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java index 6a41e410d..606bd2a96 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java @@ -981,7 +981,7 @@ public final class LazyClassGen { return tjpField; } - int modifiers = Modifier.STATIC | Modifier.FINAL; + int modifiers = Modifier.STATIC | Modifier.FINAL ; // XXX - Do we ever inline before or after advice? If we do, then we // better include them in the check below. (or just change it to @@ -1034,6 +1034,9 @@ public final class LazyClassGen { } } } + if (!isInterface() && world.isTransientTjpFields()) { + modifiers|=Modifier.TRANSIENT; + } FieldGen fGen = new FieldGen(modifiers, jpType, "ajc$tjp_" + tjpFieldsCounter++, getConstantPool()); addField(fGen); tjpField = fGen.getField(); |