*/ | */ | ||||
private static ReferenceQueue adaptorQueue = new ReferenceQueue(); | private static ReferenceQueue adaptorQueue = new ReferenceQueue(); | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(Aj.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(Aj.class); | |||||
public Aj() { | public Aj() { | ||||
this(null); | this(null); |
private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<>(); | private List<ConcreteAspectCodeGen> concreteAspects = new ArrayList<>(); | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(ClassLoaderWeavingAdaptor.class); | |||||
public ClassLoaderWeavingAdaptor() { | public ClassLoaderWeavingAdaptor() { | ||||
super(); | super(); |
protected BcelWeakClassLoaderReference loaderRef; | protected BcelWeakClassLoaderReference loaderRef; | ||||
private String shortName; | private String shortName; | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(DefaultWeavingContext.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(DefaultWeavingContext.class); | |||||
/** | /** | ||||
* Construct a new WeavingContext to use the specified ClassLoader This is the constructor which should be used. | * Construct a new WeavingContext to use the specified ClassLoader This is the constructor which should be used. |
private boolean initializingAdaptor; | private boolean initializingAdaptor; | ||||
private Map generatedClasses = new HashMap(); /* String -> byte[] */ | private Map generatedClasses = new HashMap(); /* String -> byte[] */ | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(WeavingURLClassLoader.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(WeavingURLClassLoader.class); | |||||
/* | /* | ||||
* This constructor is needed when using "-Djava.system.class.loader". | * This constructor is needed when using "-Djava.system.class.loader". |
private static boolean preserveOnNextReset = false; | private static boolean preserveOnNextReset = false; | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(Dump.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(Dump.class); | |||||
/** | /** | ||||
* for testing only, so that we can verify dump contents after compilation has completely finished | * for testing only, so that we can verify dump contents after compilation has completely finished |
public final Kind missingAspectForReweaving = new Kind("missingAspectForReweaving", | public final Kind missingAspectForReweaving = new Kind("missingAspectForReweaving", | ||||
"aspect {0} cannot be found when reweaving {1}"); | "aspect {0} cannot be found when reweaving {1}"); | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(Lint.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(Lint.class); | |||||
public Lint(World world) { | public Lint(World world) { | ||||
if (trace.isTraceEnabled()) { | if (trace.isTraceEnabled()) { |
public int infoMessagesEnabled = 0; // 0=uninitialized, 1=no, 2=yes | public int infoMessagesEnabled = 0; // 0=uninitialized, 1=no, 2=yes | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(World.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(World.class); | |||||
private boolean errorThreshold; | private boolean errorThreshold; | ||||
private boolean warningThreshold; | private boolean warningThreshold; |
public final static String DEFAULT_FACTORY_NAME = "default"; | public final static String DEFAULT_FACTORY_NAME = "default"; | ||||
protected static boolean debug = getBoolean(DEBUG_PROPERTY,false); | protected static boolean debug = getBoolean(DEBUG_PROPERTY,false); | ||||
private static TraceFactory instance; | |||||
private static final TraceFactory instance; | |||||
public Trace getTrace (Class clazz) { | |||||
return instance.getTrace(clazz); | |||||
public Trace getTrace(Class clazz) { | |||||
return instance.getTrace(clazz); | |||||
} | } | ||||
public static TraceFactory getTraceFactory () { | |||||
return instance; | |||||
public static TraceFactory getTraceFactory() { | |||||
return instance; | |||||
} | } | ||||
protected static boolean getBoolean(String name, boolean def) { | protected static boolean getBoolean(String name, boolean def) { | ||||
return Boolean.parseBoolean(value); | return Boolean.parseBoolean(value); | ||||
} | } | ||||
static { | |||||
/* | |||||
* Allow user to override default behaviour or specify their own factory | |||||
*/ | |||||
String factoryName = System.getProperty(FACTORY_PROPERTY); | |||||
if (factoryName != null) try { | |||||
if (factoryName.equals(DEFAULT_FACTORY_NAME)) { | |||||
instance = new DefaultTraceFactory(); | |||||
} | |||||
else { | |||||
Class<?> factoryClass = Class.forName(factoryName); | |||||
instance = (TraceFactory)factoryClass.getDeclaredConstructor().newInstance(); | |||||
} | |||||
} | |||||
catch (Throwable th) { | |||||
if (debug) th.printStackTrace(); | |||||
} | |||||
static { | |||||
instance = createInstance(); | |||||
if (debug) System.err.println("TraceFactory.instance=" + instance); | |||||
} | |||||
/* | |||||
* Try to load external trace infrastructure using supplied factories | |||||
*/ | |||||
if (instance == null) try { | |||||
{ | |||||
Class<?> factoryClass = Class.forName("org.aspectj.weaver.tools.Jdk14TraceFactory"); | |||||
instance = (TraceFactory)factoryClass.getDeclaredConstructor().newInstance(); | |||||
} | |||||
} | |||||
catch (Throwable th) { | |||||
if (debug) th.printStackTrace(); | |||||
} | |||||
private static TraceFactory createInstance() { | |||||
/* | |||||
* Allow user to override default behaviour or specify their own factory | |||||
*/ | |||||
String factoryName = System.getProperty(FACTORY_PROPERTY); | |||||
if (factoryName != null) try { | |||||
if (factoryName.equals(DEFAULT_FACTORY_NAME)) { | |||||
return new DefaultTraceFactory(); | |||||
} else { | |||||
Class<?> factoryClass = Class.forName(factoryName); | |||||
return (TraceFactory)factoryClass.getDeclaredConstructor().newInstance(); | |||||
} | |||||
} catch (Throwable th) { | |||||
if (debug) th.printStackTrace(); | |||||
} | |||||
/* | |||||
* Use default trace | |||||
*/ | |||||
if (instance == null) { | |||||
instance = new DefaultTraceFactory(); | |||||
} | |||||
/* | |||||
* Try to load external trace infrastructure using supplied factories | |||||
*/ | |||||
try { | |||||
Class<?> factoryClass = Class.forName("org.aspectj.weaver.tools.Jdk14TraceFactory"); | |||||
return (TraceFactory)factoryClass.getDeclaredConstructor().newInstance(); | |||||
} catch (Throwable th) { | |||||
if (debug) th.printStackTrace(); | |||||
} | |||||
if (debug) System.err.println("TraceFactory.instance=" + instance); | |||||
/* | |||||
* Use default trace | |||||
*/ | |||||
return new DefaultTraceFactory(); | |||||
} | } | ||||
} | } |
class BcelClassWeaver implements IClassWeaver { | class BcelClassWeaver implements IClassWeaver { | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelClassWeaver.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(BcelClassWeaver.class); | |||||
// Name of helper method generated by JDT compiler. Javac uses a separate inner class. | // Name of helper method generated by JDT compiler. Javac uses a separate inner class. | ||||
private static final String SWITCH_TABLE_SYNTHETIC_METHOD_PREFIX = "$SWITCH_TABLE$"; | private static final String SWITCH_TABLE_SYNTHETIC_METHOD_PREFIX = "$SWITCH_TABLE$"; |
*/ | */ | ||||
public class BcelGenericSignatureToTypeXConverter { | public class BcelGenericSignatureToTypeXConverter { | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelGenericSignatureToTypeXConverter.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(BcelGenericSignatureToTypeXConverter.class); | |||||
public static ResolvedType classTypeSignature2TypeX(GenericSignature.ClassTypeSignature aClassTypeSignature, | public static ResolvedType classTypeSignature2TypeX(GenericSignature.ClassTypeSignature aClassTypeSignature, | ||||
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { | GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { |
public static final String CLOSURE_CLASS_PREFIX = "$Ajc"; | public static final String CLOSURE_CLASS_PREFIX = "$Ajc"; | ||||
public static final String SYNTHETIC_CLASS_POSTFIX = "$ajc"; | public static final String SYNTHETIC_CLASS_POSTFIX = "$ajc"; | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelWeaver.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(BcelWeaver.class); | |||||
private transient final BcelWorld world; | private transient final BcelWorld world; | ||||
private final CrosscuttingMembersSet xcutSet; | private final CrosscuttingMembersSet xcutSet; |
private WeavingXmlConfig xmlConfiguration; | private WeavingXmlConfig xmlConfiguration; | ||||
private List<TypeDelegateResolver> typeDelegateResolvers; | private List<TypeDelegateResolver> typeDelegateResolvers; | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(BcelWorld.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(BcelWorld.class); | |||||
public BcelWorld() { | public BcelWorld() { | ||||
this(""); | this(""); |
*/ | */ | ||||
public class ClassPathManager { | public class ClassPathManager { | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(ClassPathManager.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(ClassPathManager.class); | |||||
private static int maxOpenArchives = -1; | private static int maxOpenArchives = -1; | ||||
private static final int WEAVE_JAVA_PACKAGE = 0x2; | private static final int WEAVE_JAVA_PACKAGE = 0x2; | ||||
private static final int WEAVE_JAVAX_PACKAGE = 0x4; | private static final int WEAVE_JAVAX_PACKAGE = 0x4; | ||||
private static Trace trace = TraceFactory.getTraceFactory().getTrace(WeavingAdaptor.class); | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(WeavingAdaptor.class); | |||||
protected WeavingAdaptor() { | protected WeavingAdaptor() { | ||||
} | } |
private static int DEF_STORING_TIMER = 60000; //ms | private static int DEF_STORING_TIMER = 60000; //ms | ||||
private int storingTimer; | private int storingTimer; | ||||
private transient Trace trace; | |||||
private void initTrace(){ | |||||
trace = TraceFactory.getTraceFactory().getTrace(StoreableCachingMap.class); | |||||
} | |||||
private static final Trace trace = TraceFactory.getTraceFactory().getTrace(StoreableCachingMap.class); | |||||
// private StoreableCachingMap(String folder) { | // private StoreableCachingMap(String folder) { | ||||
// this.folder = folder; | // this.folder = folder; | ||||
private StoreableCachingMap(String folder, int storingTimer){ | private StoreableCachingMap(String folder, int storingTimer){ | ||||
this.folder = folder; | this.folder = folder; | ||||
initTrace(); | |||||
this.storingTimer = storingTimer; | this.storingTimer = storingTimer; | ||||
} | } | ||||
new FileInputStream(file)); | new FileInputStream(file)); | ||||
// Deserialize the object | // Deserialize the object | ||||
StoreableCachingMap sm = (StoreableCachingMap) in.readObject(); | StoreableCachingMap sm = (StoreableCachingMap) in.readObject(); | ||||
sm.initTrace(); | |||||
in.close(); | in.close(); | ||||
return sm; | return sm; | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
Trace trace = TraceFactory.getTraceFactory().getTrace(StoreableCachingMap.class); | |||||
trace.error("Error reading Storable Cache", e); | trace.error("Error reading Storable Cache", e); | ||||
} | } | ||||
} | } |