@@ -48,7 +48,7 @@ public class Aj implements ClassPreProcessor { | |||
*/ | |||
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() { | |||
this(null); |
@@ -97,7 +97,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { | |||
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() { | |||
super(); |
@@ -32,7 +32,7 @@ public class DefaultWeavingContext implements IWeavingContext { | |||
protected BcelWeakClassLoaderReference loaderRef; | |||
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. |
@@ -43,7 +43,7 @@ public class WeavingURLClassLoader extends ExtensibleURLClassLoader implements W | |||
private boolean initializingAdaptor; | |||
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". |
@@ -63,7 +63,7 @@ public class Dump { | |||
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 |
@@ -138,7 +138,7 @@ public class Lint { | |||
public final Kind missingAspectForReweaving = new Kind("missingAspectForReweaving", | |||
"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) { | |||
if (trace.isTraceEnabled()) { |
@@ -149,7 +149,7 @@ public abstract class World implements Dump.INode { | |||
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 warningThreshold; |
@@ -17,14 +17,14 @@ public abstract class TraceFactory { | |||
public final static String DEFAULT_FACTORY_NAME = "default"; | |||
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) { | |||
@@ -33,46 +33,41 @@ public abstract class TraceFactory { | |||
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(); | |||
} | |||
} |
@@ -91,7 +91,7 @@ import org.aspectj.weaver.tools.TraceFactory; | |||
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. | |||
private static final String SWITCH_TABLE_SYNTHETIC_METHOD_PREFIX = "$SWITCH_TABLE$"; |
@@ -33,7 +33,7 @@ import org.aspectj.weaver.tools.TraceFactory; | |||
*/ | |||
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, | |||
GenericSignature.FormalTypeParameter[] typeParams, World world) throws GenericSignatureFormatException { |
@@ -105,7 +105,7 @@ public class BcelWeaver { | |||
public static final String CLOSURE_CLASS_PREFIX = "$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 final CrosscuttingMembersSet xcutSet; |
@@ -94,7 +94,7 @@ public class BcelWorld extends World implements Repository { | |||
private WeavingXmlConfig xmlConfiguration; | |||
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() { | |||
this(""); |
@@ -53,7 +53,7 @@ import org.aspectj.weaver.tools.TraceFactory; | |||
*/ | |||
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; | |||
@@ -104,7 +104,7 @@ public class WeavingAdaptor implements IMessageContext { | |||
private static final int WEAVE_JAVA_PACKAGE = 0x2; | |||
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() { | |||
} |
@@ -120,10 +120,7 @@ public class SimpleCache { | |||
private static int DEF_STORING_TIMER = 60000; //ms | |||
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) { | |||
// this.folder = folder; | |||
@@ -132,7 +129,6 @@ public class SimpleCache { | |||
private StoreableCachingMap(String folder, int storingTimer){ | |||
this.folder = folder; | |||
initTrace(); | |||
this.storingTimer = storingTimer; | |||
} | |||
@@ -149,11 +145,9 @@ public class SimpleCache { | |||
new FileInputStream(file)); | |||
// Deserialize the object | |||
StoreableCachingMap sm = (StoreableCachingMap) in.readObject(); | |||
sm.initTrace(); | |||
in.close(); | |||
return sm; | |||
} catch (Exception e) { | |||
Trace trace = TraceFactory.getTraceFactory().getTrace(StoreableCachingMap.class); | |||
trace.error("Error reading Storable Cache", e); | |||
} | |||
} |