[OpenJDK 2D-Dev] RFR: 8144526: Remove Marlin logging use of deleted internal API

Laurent Bourgès bourges.laurent at gmail.com
Wed Dec 2 19:04:48 UTC 2015


Phil,
No problem. I mentioned some time ago that this tracing method is somewhat
not really useful anymore.

I will take care of the clean up afterwards.

Laurent
Le 2 déc. 2015 19:41, "Phil Race" <philip.race at oracle.com> a écrit :

> https://bugs.openjdk.java.net/browse/JDK-8144526
>
> MarlinUtils uses internal API that has been deleted as part of the new
> StackWalker.
> I need to integrate right now and I don't have time to re-write this.
> In any case it is only used to get a class name to put into a logging
> message which
> is currently completely disabled anyway (no way to enable without
> recompiling).
>
> So I changing the method that it always returns unknown and we can rework
> afterwards.
>
> My diff is below :-
>
> -phil.
>
> hg diff MarlinUtils.java
> diff --git
> a/src/java.desktop/share/classes/sun/java2d/marlin/MarlinUtils.java
> b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinUtils.java
> --- a/src/java.desktop/share/classes/sun/java2d/marlin/MarlinUtils.java
> +++ b/src/java.desktop/share/classes/sun/java2d/marlin/MarlinUtils.java
> @@ -25,8 +25,6 @@
>
>  package sun.java2d.marlin;
>
> -import jdk.internal.misc.JavaLangAccess;
> -import jdk.internal.misc.SharedSecrets;
>
>  public final class MarlinUtils {
>      // TODO: use sun.util.logging.PlatformLogger once in JDK9
> @@ -70,31 +68,6 @@
>          String sourceClassName = 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) {
>              return sourceClassName + " " + sourceMethodName;
>          } else {
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20151202/67bebce8/attachment.html>


More information about the 2d-dev mailing list