Browse Source

support -Xset:makeTjpFieldsTransient=true

tags/V1_7_0RC1
Andy Clement 12 years ago
parent
commit
0cf0cb2dfb

+ 10
- 0
org.aspectj.matcher/src/org/aspectj/weaver/World.java View File

@@ -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();

+ 12
- 0
tests/bugs170/transientTjpFields/Code.java View File

@@ -0,0 +1,12 @@
public class Code {
public void m() {
}

public void n() {
}
}

aspect X {
before(): execution(* Code.*(..)) {System.out.println(thisJoinPointStaticPart);}
}

+ 15
- 9
tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java View File

@@ -11,27 +11,33 @@
package org.aspectj.systemtest.ajc170;

import java.io.File;
import java.util.List;

import junit.framework.Test;

import org.aspectj.apache.bcel.util.ClassPath;
import org.aspectj.apache.bcel.classfile.Field;
import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.testing.XMLBasedAjcTestCase;
import org.aspectj.weaver.CrosscuttingMembers;
import org.aspectj.weaver.ReferenceType;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.TypeFactory;
import org.aspectj.weaver.TypeVariable;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.World;
import org.aspectj.weaver.bcel.BcelWorld;

/**
* @author Andy Clement
*/
public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

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() {
UnresolvedType ut;

+ 5
- 0
tests/src/org/aspectj/systemtest/ajc170/ajc170.xml View File

@@ -2,6 +2,11 @@

<suite>

<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>

+ 4
- 1
weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java View File

@@ -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();

Loading…
Cancel
Save