< prev index next >

src/java.base/share/classes/java/lang/StackTraceElement.java

Print this page

        

@@ -64,10 +64,11 @@
     private String moduleName;
     private String moduleVersion;
     private String declaringClass;
     private String methodName;
     private String fileName;
+    private String contScopeName;
     private int    lineNumber;
     private byte   format = 0; // Default to show all
 
     /**
      * Creates a stack trace element representing the specified execution

@@ -351,15 +352,25 @@
                 s += "@" + moduleVersion;
             }
         }
         s = s.isEmpty() ? declaringClass : s + "/" + declaringClass;
 
-        return s + "." + methodName + "(" +
+        s = s + "." + methodName + "(" +
              (isNativeMethod() ? "Native Method)" :
               (fileName != null && lineNumber >= 0 ?
                fileName + ":" + lineNumber + ")" :
                 (fileName != null ?  ""+fileName+")" : "Unknown Source)")));
+
+        if (contScopeName != null && isContinuationEntry()) {
+            s = s + " " + contScopeName;
+        }
+
+        return s;
+    }
+
+    private boolean isContinuationEntry() {
+        return declaringClass.equals(Continuation.class.getName()) && methodName.equals("enter");
     }
 
     /**
      * Returns true if the specified object is another
      * {@code StackTraceElement} instance representing the same execution

@@ -396,11 +407,12 @@
             Objects.equals(moduleName, e.moduleName) &&
             Objects.equals(moduleVersion, e.moduleVersion) &&
             e.declaringClass.equals(declaringClass) &&
             e.lineNumber == lineNumber &&
             Objects.equals(methodName, e.methodName) &&
-            Objects.equals(fileName, e.fileName);
+            Objects.equals(fileName, e.fileName) &&
+            Objects.equals(contScopeName, e.contScopeName);
     }
 
     /**
      * Returns a hash code value for this stack trace element.
      */

@@ -408,10 +420,11 @@
         int result = 31*declaringClass.hashCode() + methodName.hashCode();
         result = 31*result + Objects.hashCode(classLoaderName);
         result = 31*result + Objects.hashCode(moduleName);
         result = 31*result + Objects.hashCode(moduleVersion);
         result = 31*result + Objects.hashCode(fileName);
+        result = 31*result + Objects.hashCode(contScopeName);
         result = 31*result + lineNumber;
         return result;
     }
 
 
< prev index next >