-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Describe the bug
Methods in Instrumentation currently return InstrumentationContext<Object>. This won't allow to return a more concrete object type. E.g. returning InstrumentationContext<String> does not compile.
I think these methods should return InstrumentationContext<?>.
To demonstrate this further, take this (plain Java) example:
interface Base {
Wrapper<Object> wrapped();
}
class Wrapper<T> {
T value;
}
class Impl implements Base {
@Override
//Won't Compile!!!!!
public Wrapper<String> wrapped() {
return new Wrapper<String>();
}
}This won't compile, String is an incompatible return type here.
However, if you change from object to ?, it's fine.
interface Base {
Wrapper<?> wrapped();
}
class Wrapper<T> {
T value;
}
class Impl implements Base {
@Override
//Now it's fine.
public Wrapper<String> wrapped() {
return new Wrapper<String>();
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels