Skip to content

Commit

Permalink
Delete native methods from java.lang.Thread
Browse files Browse the repository at this point in the history
'getStackTrace0' is only used in asyncGetStackTrace() which is deleted as well.
Thread.getStackTrace()  is replaced by PlatformThreads.getStackTrace(). So it's not
reachable.

'getNextThreadIdOffset()' is only used in ThreadIdentifiers private class which is
substituted in JDKs better than JDK 19 (which includes 21). So won't be reachable either.

Fixes: #28

This is a partial backport of:
"Introudce a mode to unconditionally include classes" oracle@369f0ff8
to address oracle#9672

Only take the java.lang.Thread native method deletions as that's sufficient to fix
the issue reported in #28.
  • Loading branch information
Karm committed Dec 20, 2024
1 parent dcd9e5d commit 3313d41
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,10 @@ private StackTraceElement[] getStackTrace() {
return JavaThreads.getStackTrace(false, JavaThreads.fromTarget(this));
}

@Delete
@SuppressWarnings({"static-method"})
private native Object getStackTrace0();

/** @see com.oracle.svm.core.jdk.StackTraceUtils#asyncGetStackTrace */
@Delete
@TargetElement(onlyWith = JDK19OrLater.class)
Expand Down Expand Up @@ -798,6 +802,9 @@ boolean isTerminated() {
@Alias
@TargetElement(onlyWith = JDK19OrLater.class)
native long threadId();

@Delete
static native long getNextThreadIdOffset();
}

@TargetClass(value = Thread.class, innerClass = "Builder", onlyWith = JDK19OrLater.class)
Expand Down

0 comments on commit 3313d41

Please sign in to comment.