8144526: Remove Marlin logging use of deleted internal API
Reviewed-by: flar
This commit is contained in:
parent
214c48d9d2
commit
7e996b873c
@ -25,8 +25,6 @@
|
|||||||
|
|
||||||
package sun.java2d.marlin;
|
package sun.java2d.marlin;
|
||||||
|
|
||||||
import jdk.internal.misc.JavaLangAccess;
|
|
||||||
import jdk.internal.misc.SharedSecrets;
|
|
||||||
|
|
||||||
public final class MarlinUtils {
|
public final class MarlinUtils {
|
||||||
// TODO: use sun.util.logging.PlatformLogger once in JDK9
|
// TODO: use sun.util.logging.PlatformLogger once in JDK9
|
||||||
@ -70,31 +68,6 @@ public final class MarlinUtils {
|
|||||||
String sourceClassName = null;
|
String sourceClassName = null;
|
||||||
String sourceMethodName = null;
|
String sourceMethodName = null;
|
||||||
|
|
||||||
JavaLangAccess access = SharedSecrets.getJavaLangAccess();
|
|
||||||
Throwable throwable = new Throwable();
|
|
||||||
int depth = access.getStackTraceDepth(throwable);
|
|
||||||
|
|
||||||
boolean lookingForClassName = true;
|
|
||||||
for (int ix = 0; ix < depth; ix++) {
|
|
||||||
// Calling getStackTraceElement directly prevents the VM
|
|
||||||
// from paying the cost of building the entire stack frame.
|
|
||||||
StackTraceElement frame = access.getStackTraceElement(throwable, ix);
|
|
||||||
String cname = frame.getClassName();
|
|
||||||
if (lookingForClassName) {
|
|
||||||
// Skip all frames until we have found the first frame having the class name.
|
|
||||||
if (cname.equals(className)) {
|
|
||||||
lookingForClassName = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!cname.equals(className)) {
|
|
||||||
// We've found the relevant frame.
|
|
||||||
sourceClassName = cname;
|
|
||||||
sourceMethodName = frame.getMethodName();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceClassName != null) {
|
if (sourceClassName != null) {
|
||||||
return sourceClassName + " " + sourceMethodName;
|
return sourceClassName + " " + sourceMethodName;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user