Fix some raw types warnings (#3300)
* Fix some raw types warnings * oops
This commit is contained in:
parent
b9eac531ea
commit
c79b5c5f1d
|
@ -62,8 +62,8 @@ public class AkkaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
||||||
* need to use that state.
|
* need to use that state.
|
||||||
*/
|
*/
|
||||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||||
public static Scope enter(@Advice.This ForkJoinTask thiz) {
|
public static Scope enter(@Advice.This ForkJoinTask<?> thiz) {
|
||||||
ContextStore<ForkJoinTask, State> contextStore =
|
ContextStore<ForkJoinTask<?>, State> contextStore =
|
||||||
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
||||||
Scope scope = AdviceUtils.startTaskScope(contextStore, thiz);
|
Scope scope = AdviceUtils.startTaskScope(contextStore, thiz);
|
||||||
if (thiz instanceof Runnable) {
|
if (thiz instanceof Runnable) {
|
||||||
|
@ -79,9 +79,9 @@ public class AkkaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (thiz instanceof Callable) {
|
if (thiz instanceof Callable) {
|
||||||
ContextStore<Callable, State> callableContextStore =
|
ContextStore<Callable<?>, State> callableContextStore =
|
||||||
InstrumentationContext.get(Callable.class, State.class);
|
InstrumentationContext.get(Callable.class, State.class);
|
||||||
Scope newScope = AdviceUtils.startTaskScope(callableContextStore, (Callable) thiz);
|
Scope newScope = AdviceUtils.startTaskScope(callableContextStore, (Callable<?>) thiz);
|
||||||
if (null != newScope) {
|
if (null != newScope) {
|
||||||
if (null != scope) {
|
if (null != scope) {
|
||||||
newScope.close();
|
newScope.close();
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class ResponseInstrumentation implements TypeInstrumentation {
|
||||||
public static Scope onEnter(
|
public static Scope onEnter(
|
||||||
@Advice.This AsyncCompletionHandler<?> handler, @Advice.Argument(0) Throwable throwable) {
|
@Advice.This AsyncCompletionHandler<?> handler, @Advice.Argument(0) Throwable throwable) {
|
||||||
|
|
||||||
ContextStore<AsyncHandler, Pair> contextStore =
|
ContextStore<AsyncHandler<?>, Pair> contextStore =
|
||||||
InstrumentationContext.get(AsyncHandler.class, Pair.class);
|
InstrumentationContext.get(AsyncHandler.class, Pair.class);
|
||||||
Pair<Context, Context> parentAndChildContext = contextStore.get(handler);
|
Pair<Context, Context> parentAndChildContext = contextStore.get(handler);
|
||||||
if (parentAndChildContext == null) {
|
if (parentAndChildContext == null) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class AsyncCompletionHandlerInstrumentation implements TypeInstrumentatio
|
||||||
public static Scope onEnter(
|
public static Scope onEnter(
|
||||||
@Advice.This AsyncCompletionHandler<?> handler, @Advice.Argument(0) Response response) {
|
@Advice.This AsyncCompletionHandler<?> handler, @Advice.Argument(0) Response response) {
|
||||||
|
|
||||||
ContextStore<AsyncHandler, AsyncHandlerData> contextStore =
|
ContextStore<AsyncHandler<?>, AsyncHandlerData> contextStore =
|
||||||
InstrumentationContext.get(AsyncHandler.class, AsyncHandlerData.class);
|
InstrumentationContext.get(AsyncHandler.class, AsyncHandlerData.class);
|
||||||
AsyncHandlerData data = contextStore.get(handler);
|
AsyncHandlerData data = contextStore.get(handler);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
|
@ -81,7 +81,7 @@ public class AsyncCompletionHandlerInstrumentation implements TypeInstrumentatio
|
||||||
public static Scope onEnter(
|
public static Scope onEnter(
|
||||||
@Advice.This AsyncCompletionHandler<?> handler, @Advice.Argument(0) Throwable throwable) {
|
@Advice.This AsyncCompletionHandler<?> handler, @Advice.Argument(0) Throwable throwable) {
|
||||||
|
|
||||||
ContextStore<AsyncHandler, AsyncHandlerData> contextStore =
|
ContextStore<AsyncHandler<?>, AsyncHandlerData> contextStore =
|
||||||
InstrumentationContext.get(AsyncHandler.class, AsyncHandlerData.class);
|
InstrumentationContext.get(AsyncHandler.class, AsyncHandlerData.class);
|
||||||
AsyncHandlerData data = contextStore.get(handler);
|
AsyncHandlerData data = contextStore.get(handler);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
|
|
|
@ -40,8 +40,8 @@ public class CallableInstrumentation implements TypeInstrumentation {
|
||||||
public static class CallableAdvice {
|
public static class CallableAdvice {
|
||||||
|
|
||||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||||
public static Scope enter(@Advice.This Callable thiz) {
|
public static Scope enter(@Advice.This Callable<?> thiz) {
|
||||||
ContextStore<Callable, State> contextStore =
|
ContextStore<Callable<?>, State> contextStore =
|
||||||
InstrumentationContext.get(Callable.class, State.class);
|
InstrumentationContext.get(Callable.class, State.class);
|
||||||
return AdviceUtils.startTaskScope(contextStore, thiz);
|
return AdviceUtils.startTaskScope(contextStore, thiz);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class FutureInstrumentation implements TypeInstrumentation {
|
||||||
// Try to clear parent span even if future was not cancelled:
|
// Try to clear parent span even if future was not cancelled:
|
||||||
// the expectation is that parent span should be cleared after 'cancel'
|
// the expectation is that parent span should be cleared after 'cancel'
|
||||||
// is called, one way or another
|
// is called, one way or another
|
||||||
ContextStore<Future, State> contextStore =
|
ContextStore<Future<?>, State> contextStore =
|
||||||
InstrumentationContext.get(Future.class, State.class);
|
InstrumentationContext.get(Future.class, State.class);
|
||||||
State state = contextStore.get(future);
|
State state = contextStore.get(future);
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class JavaExecutorInstrumentation extends AbstractExecutorInstrumentation
|
||||||
public static State enterJobSubmit(
|
public static State enterJobSubmit(
|
||||||
@Advice.Argument(value = 0, readOnly = false) ForkJoinTask<?> task) {
|
@Advice.Argument(value = 0, readOnly = false) ForkJoinTask<?> task) {
|
||||||
if (ExecutorInstrumentationUtils.shouldAttachStateToTask(task)) {
|
if (ExecutorInstrumentationUtils.shouldAttachStateToTask(task)) {
|
||||||
ContextStore<ForkJoinTask, State> contextStore =
|
ContextStore<ForkJoinTask<?>, State> contextStore =
|
||||||
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
||||||
return ExecutorInstrumentationUtils.setupState(
|
return ExecutorInstrumentationUtils.setupState(
|
||||||
contextStore, task, Java8BytecodeBridge.currentContext());
|
contextStore, task, Java8BytecodeBridge.currentContext());
|
||||||
|
@ -132,7 +132,7 @@ public class JavaExecutorInstrumentation extends AbstractExecutorInstrumentation
|
||||||
@Advice.Thrown Throwable throwable,
|
@Advice.Thrown Throwable throwable,
|
||||||
@Advice.Return Future<?> future) {
|
@Advice.Return Future<?> future) {
|
||||||
if (state != null && future != null) {
|
if (state != null && future != null) {
|
||||||
ContextStore<Future, State> contextStore =
|
ContextStore<Future<?>, State> contextStore =
|
||||||
InstrumentationContext.get(Future.class, State.class);
|
InstrumentationContext.get(Future.class, State.class);
|
||||||
contextStore.put(future, state);
|
contextStore.put(future, state);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ public class JavaExecutorInstrumentation extends AbstractExecutorInstrumentation
|
||||||
@Advice.Argument(value = 0, readOnly = false) Callable<?> task) {
|
@Advice.Argument(value = 0, readOnly = false) Callable<?> task) {
|
||||||
if (ExecutorInstrumentationUtils.shouldAttachStateToTask(task)) {
|
if (ExecutorInstrumentationUtils.shouldAttachStateToTask(task)) {
|
||||||
task = CallableWrapper.wrapIfNeeded(task);
|
task = CallableWrapper.wrapIfNeeded(task);
|
||||||
ContextStore<Callable, State> contextStore =
|
ContextStore<Callable<?>, State> contextStore =
|
||||||
InstrumentationContext.get(Callable.class, State.class);
|
InstrumentationContext.get(Callable.class, State.class);
|
||||||
return ExecutorInstrumentationUtils.setupState(
|
return ExecutorInstrumentationUtils.setupState(
|
||||||
contextStore, task, Java8BytecodeBridge.currentContext());
|
contextStore, task, Java8BytecodeBridge.currentContext());
|
||||||
|
@ -162,7 +162,7 @@ public class JavaExecutorInstrumentation extends AbstractExecutorInstrumentation
|
||||||
@Advice.Thrown Throwable throwable,
|
@Advice.Thrown Throwable throwable,
|
||||||
@Advice.Return Future<?> future) {
|
@Advice.Return Future<?> future) {
|
||||||
if (state != null && future != null) {
|
if (state != null && future != null) {
|
||||||
ContextStore<Future, State> contextStore =
|
ContextStore<Future<?>, State> contextStore =
|
||||||
InstrumentationContext.get(Future.class, State.class);
|
InstrumentationContext.get(Future.class, State.class);
|
||||||
contextStore.put(future, state);
|
contextStore.put(future, state);
|
||||||
}
|
}
|
||||||
|
@ -180,9 +180,9 @@ public class JavaExecutorInstrumentation extends AbstractExecutorInstrumentation
|
||||||
Collection<Callable<?>> wrappedTasks = new ArrayList<>(tasks.size());
|
Collection<Callable<?>> wrappedTasks = new ArrayList<>(tasks.size());
|
||||||
for (Callable<?> task : tasks) {
|
for (Callable<?> task : tasks) {
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
Callable newTask = CallableWrapper.wrapIfNeeded(task);
|
Callable<?> newTask = CallableWrapper.wrapIfNeeded(task);
|
||||||
wrappedTasks.add(newTask);
|
wrappedTasks.add(newTask);
|
||||||
ContextStore<Callable, State> contextStore =
|
ContextStore<Callable<?>, State> contextStore =
|
||||||
InstrumentationContext.get(Callable.class, State.class);
|
InstrumentationContext.get(Callable.class, State.class);
|
||||||
ExecutorInstrumentationUtils.setupState(
|
ExecutorInstrumentationUtils.setupState(
|
||||||
contextStore, newTask, Java8BytecodeBridge.currentContext());
|
contextStore, newTask, Java8BytecodeBridge.currentContext());
|
||||||
|
@ -210,7 +210,7 @@ public class JavaExecutorInstrumentation extends AbstractExecutorInstrumentation
|
||||||
if (null != throwable) {
|
if (null != throwable) {
|
||||||
for (Callable<?> task : wrappedTasks) {
|
for (Callable<?> task : wrappedTasks) {
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
ContextStore<Callable, State> contextStore =
|
ContextStore<Callable<?>, State> contextStore =
|
||||||
InstrumentationContext.get(Callable.class, State.class);
|
InstrumentationContext.get(Callable.class, State.class);
|
||||||
State state = contextStore.get(task);
|
State state = contextStore.get(task);
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
|
|
|
@ -55,8 +55,8 @@ public class JavaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
||||||
* need to use that state.
|
* need to use that state.
|
||||||
*/
|
*/
|
||||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||||
public static Scope enter(@Advice.This ForkJoinTask thiz) {
|
public static Scope enter(@Advice.This ForkJoinTask<?> thiz) {
|
||||||
ContextStore<ForkJoinTask, State> contextStore =
|
ContextStore<ForkJoinTask<?>, State> contextStore =
|
||||||
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
||||||
Scope scope = AdviceUtils.startTaskScope(contextStore, thiz);
|
Scope scope = AdviceUtils.startTaskScope(contextStore, thiz);
|
||||||
if (thiz instanceof Runnable) {
|
if (thiz instanceof Runnable) {
|
||||||
|
@ -72,9 +72,9 @@ public class JavaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (thiz instanceof Callable) {
|
if (thiz instanceof Callable) {
|
||||||
ContextStore<Callable, State> callableContextStore =
|
ContextStore<Callable<?>, State> callableContextStore =
|
||||||
InstrumentationContext.get(Callable.class, State.class);
|
InstrumentationContext.get(Callable.class, State.class);
|
||||||
Scope newScope = AdviceUtils.startTaskScope(callableContextStore, (Callable) thiz);
|
Scope newScope = AdviceUtils.startTaskScope(callableContextStore, (Callable<?>) thiz);
|
||||||
if (null != newScope) {
|
if (null != newScope) {
|
||||||
if (null != scope) {
|
if (null != scope) {
|
||||||
newScope.close();
|
newScope.close();
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class ScalaForkJoinPoolInstrumentation implements TypeInstrumentation {
|
||||||
public static State enterJobSubmit(
|
public static State enterJobSubmit(
|
||||||
@Advice.Argument(value = 0, readOnly = false) ForkJoinTask<?> task) {
|
@Advice.Argument(value = 0, readOnly = false) ForkJoinTask<?> task) {
|
||||||
if (ExecutorInstrumentationUtils.shouldAttachStateToTask(task)) {
|
if (ExecutorInstrumentationUtils.shouldAttachStateToTask(task)) {
|
||||||
ContextStore<ForkJoinTask, State> contextStore =
|
ContextStore<ForkJoinTask<?>, State> contextStore =
|
||||||
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
||||||
return ExecutorInstrumentationUtils.setupState(
|
return ExecutorInstrumentationUtils.setupState(
|
||||||
contextStore, task, Java8BytecodeBridge.currentContext());
|
contextStore, task, Java8BytecodeBridge.currentContext());
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class ScalaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
||||||
*/
|
*/
|
||||||
@Advice.OnMethodEnter(suppress = Throwable.class)
|
@Advice.OnMethodEnter(suppress = Throwable.class)
|
||||||
public static Scope enter(@Advice.This ForkJoinTask<?> thiz) {
|
public static Scope enter(@Advice.This ForkJoinTask<?> thiz) {
|
||||||
ContextStore<ForkJoinTask, State> contextStore =
|
ContextStore<ForkJoinTask<?>, State> contextStore =
|
||||||
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
InstrumentationContext.get(ForkJoinTask.class, State.class);
|
||||||
Scope scope = AdviceUtils.startTaskScope(contextStore, thiz);
|
Scope scope = AdviceUtils.startTaskScope(contextStore, thiz);
|
||||||
if (thiz instanceof Runnable) {
|
if (thiz instanceof Runnable) {
|
||||||
|
@ -80,9 +80,9 @@ public class ScalaForkJoinTaskInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (thiz instanceof Callable) {
|
if (thiz instanceof Callable) {
|
||||||
ContextStore<Callable, State> callableContextStore =
|
ContextStore<Callable<?>, State> callableContextStore =
|
||||||
InstrumentationContext.get(Callable.class, State.class);
|
InstrumentationContext.get(Callable.class, State.class);
|
||||||
Scope newScope = AdviceUtils.startTaskScope(callableContextStore, (Callable) thiz);
|
Scope newScope = AdviceUtils.startTaskScope(callableContextStore, (Callable<?>) thiz);
|
||||||
if (null != newScope) {
|
if (null != newScope) {
|
||||||
if (null != scope) {
|
if (null != scope) {
|
||||||
newScope.close();
|
newScope.close();
|
||||||
|
|
|
@ -26,7 +26,8 @@ public class InstrumentationContext {
|
||||||
* @param <C> context class
|
* @param <C> context class
|
||||||
* @return The instance of context store for given arguments.
|
* @return The instance of context store for given arguments.
|
||||||
*/
|
*/
|
||||||
public static <K, C> ContextStore<K, C> get(Class<K> keyClass, Class<C> contextClass) {
|
public static <Q extends K, K, C> ContextStore<Q, C> get(
|
||||||
|
Class<K> keyClass, Class<C> contextClass) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Calls to this method will be rewritten by Instrumentation Context Provider (e.g. FieldBackedProvider)");
|
"Calls to this method will be rewritten by Instrumentation Context Provider (e.g. FieldBackedProvider)");
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class ContextTestInstrumentation implements TypeInstrumentation {
|
||||||
named("removeContextCount"), this.getClass().getName() + "$RemoveApiUsageAdvice");
|
named("removeContextCount"), this.getClass().getName() + "$RemoveApiUsageAdvice");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class MarkInstrumentedAdvice {
|
public static class MarkInstrumentedAdvice {
|
||||||
@Advice.OnMethodExit
|
@Advice.OnMethodExit
|
||||||
public static void methodExit(@Advice.Return(readOnly = false) boolean isInstrumented) {
|
public static void methodExit(@Advice.Return(readOnly = false) boolean isInstrumented) {
|
||||||
|
@ -45,6 +46,7 @@ public class ContextTestInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class StoreAndIncrementApiUsageAdvice {
|
public static class StoreAndIncrementApiUsageAdvice {
|
||||||
@Advice.OnMethodExit
|
@Advice.OnMethodExit
|
||||||
public static void methodExit(
|
public static void methodExit(
|
||||||
|
@ -56,6 +58,7 @@ public class ContextTestInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class StoreAndIncrementWithFactoryApiUsageAdvice {
|
public static class StoreAndIncrementWithFactoryApiUsageAdvice {
|
||||||
@Advice.OnMethodExit
|
@Advice.OnMethodExit
|
||||||
public static void methodExit(
|
public static void methodExit(
|
||||||
|
@ -67,6 +70,7 @@ public class ContextTestInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class GetApiUsageAdvice {
|
public static class GetApiUsageAdvice {
|
||||||
@Advice.OnMethodExit
|
@Advice.OnMethodExit
|
||||||
public static void methodExit(
|
public static void methodExit(
|
||||||
|
@ -78,6 +82,7 @@ public class ContextTestInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class PutApiUsageAdvice {
|
public static class PutApiUsageAdvice {
|
||||||
@Advice.OnMethodExit
|
@Advice.OnMethodExit
|
||||||
public static void methodExit(@Advice.This KeyClass thiz, @Advice.Argument(0) int value) {
|
public static void methodExit(@Advice.This KeyClass thiz, @Advice.Argument(0) int value) {
|
||||||
|
@ -89,6 +94,7 @@ public class ContextTestInstrumentation implements TypeInstrumentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public static class RemoveApiUsageAdvice {
|
public static class RemoveApiUsageAdvice {
|
||||||
@Advice.OnMethodExit
|
@Advice.OnMethodExit
|
||||||
public static void methodExit(@Advice.This KeyClass thiz) {
|
public static void methodExit(@Advice.This KeyClass thiz) {
|
||||||
|
|
Loading…
Reference in New Issue