-
Bug
-
Resolution: Fixed
-
P3
-
17
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8287054 | 17.0.5-oracle | Alex Menkov | P3 | Resolved | Fixed | b01 |
JDK-8288037 | 17.0.5 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
MacOS 11.6.3 (x64)/ Linux Debian 9 (x64 VM)
Java: Temurin 17.0.2 / Oracle 17.0.2
A DESCRIPTION OF THE PROBLEM :
At New Relic we instrument classes to send telemetry data to our servers. We use ASM for bytecode manipulation.
We instrument CompletableFuture, and since Java 17 it has returned an improper value when Class#getGenericSignature0() is called.
This works fine when the running on Java 16 or lower.
The following has a repro app and more information on the investigation done.
https://github.com/meiao/genericSignature-jdk17-bug
Note that the source code added in the ticket will not reproduce the issue by itself. Use the repro app that will download the New Relic agent and execute the app in a way that the bug will occur.
REGRESSION : Last worked in version 16
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Modify CompletableFuture using a Java agent.
Using reflection, call Class#getGenericSignature0() on CompletableFuture.class.
Check the returned String.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<T:Ljava/lang/Object;>Ljava/lang/Object;Ljava/util/concurrent/Future<TT;>;Ljava/util/concurrent/CompletionStage<TT;>;
ACTUAL -
java/util/concurrent/CompletableFuture
---------- BEGIN SOURCE ----------
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.reflect.Type;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public class Tester {
public static void main(String... args) throws Throwable {
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandles.Lookup classLookup = MethodHandles.privateLookupIn(Class.class, lookup);
MethodHandle getGenericSignature0 = classLookup.findVirtual(Class.class, "getGenericSignature0", MethodType.methodType(String.class));
Object genericSignature = getGenericSignature0.invoke(CompletableFuture.class);
System.out.println();
System.out.println("getGenericSignature0: " + genericSignature);
System.out.println("expected: <T:Ljava/lang/Object;>Ljava/lang/Object;Ljava/util/concurrent/Future<TT;>;Ljava/util/concurrent/CompletionStage<TT;>;");
System.out.println();
Type type = Tester.class.getDeclaredMethod("testing").getGenericReturnType();
System.out.println("TYPE: " + type);
}
public CompletableFuture<List<String>> testing() {
return null;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Not modifying the CompletableFuture class. Which is not desirable.
FREQUENCY : always
- backported by
-
JDK-8287054 [REDO] Invalid generic signature for redefined classes
- Resolved
-
JDK-8288037 [REDO] Invalid generic signature for redefined classes
- Resolved
- clones
-
JDK-8282241 Invalid generic signature for redefined classes
- Closed
- duplicates
-
JDK-8286566 Backport JDK-8283597 (Invalid generic signature on redefined classes) to 17,18
- Closed
- relates to
-
JDK-8267555 Fix class file version during redefinition after 8238048
- Resolved
-
CODETOOLS-7901986 RedefineClassTest randomly fails with NoClassDefFoundError
- Closed
-
JDK-8283587 [BACKOUT] Invalid generic signature for redefined classes
- Resolved
-
JDK-8286566 Backport JDK-8283597 (Invalid generic signature on redefined classes) to 17,18
- Closed
- links to
-
Commit openjdk/jdk17u-dev/3013100d
-
Commit openjdk/jdk/0cd46f65
-
Review openjdk/jdk17u-dev/439
-
Review openjdk/jdk/8007