Package com.ibm.websphere.ras.annotation
Annotation Type IgnoreNonStaticTraceComponent
Indicates that a non-static TraceComponent field should be ignored by the
Liberty bytecode instrumentation tool. This annotation is used in cases where
a TraceComponent must be instance-specific (non-static) for legitimate reasons,
such as when different instances need different trace channels or configurations.
Without this annotation, the instrumentation tool will issue a warning and fail
instrumentation when it encounters a non-static TraceComponent field, as the
standard pattern requires TraceComponent fields to be declared as
private static final.
Example usage:
public class MyClass {
// Dummy static TraceComponent to satisfy instrumentation
private static final TraceComponent tc = Tr.register(MyClass.class);
// Instance-specific TraceComponent that won't trigger instrumentation errors
@IgnoreNonStaticTraceComponent
private final TraceComponent instanceTc;
public MyClass(String channelName) {
this.instanceTc = Tr.register(channelName, MyClass.class, TRACE_GROUP);
}
}
- See Also: