< prev index next >

src/java.base/share/classes/jdk/internal/vm/ScopedValueContainer.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this
--- 1,7 ---
  /*
!  * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

*** 22,11 ***
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  package jdk.internal.vm;
  
! import java.util.concurrent.Callable;
  import java.util.concurrent.StructureViolationException;
  import jdk.internal.access.JavaLangAccess;
  import jdk.internal.access.SharedSecrets;
  import jdk.internal.misc.Unsafe;
  
--- 22,11 ---
   * or visit www.oracle.com if you need additional information or have any
   * questions.
   */
  package jdk.internal.vm;
  
! import java.lang.ScopedValue.CallableOp;
  import java.util.concurrent.StructureViolationException;
  import jdk.internal.access.JavaLangAccess;
  import jdk.internal.access.SharedSecrets;
  import jdk.internal.misc.Unsafe;
  

*** 139,11 ***
      }
  
      /**
       * For use by ScopedValue to call a value returning operation in a structured context.
       */
!     public static <V> V call(Callable<V> op) {
          if (head() == null) {
              // no need to push scope when stack is empty
              return callWithoutScope(op);
          } else {
              return new ScopedValueContainer().doCall(op);
--- 139,11 ---
      }
  
      /**
       * For use by ScopedValue to call a value returning operation in a structured context.
       */
!     public static <V, X extends Throwable> V call(CallableOp<V, X> op) {
          if (head() == null) {
              // no need to push scope when stack is empty
              return callWithoutScope(op);
          } else {
              return new ScopedValueContainer().doCall(op);

*** 151,11 ***
      }
  
      /**
       * Call an operation without a scope on the stack.
       */
!     private static <V> V callWithoutScope(Callable<V> op) {
          assert head() == null;
          Throwable ex;
          boolean atTop;
          V result;
          try {
--- 151,11 ---
      }
  
      /**
       * Call an operation without a scope on the stack.
       */
!     private static <V, X extends Throwable> V callWithoutScope(CallableOp<V, X> op) {
          assert head() == null;
          Throwable ex;
          boolean atTop;
          V result;
          try {

*** 173,11 ***
      }
  
      /**
       * Call an operation with this scope on the stack.
       */
!     private <V> V doCall(Callable<V> op) {
          Throwable ex;
          boolean atTop;
          V result;
          push();
          try {
--- 173,11 ---
      }
  
      /**
       * Call an operation with this scope on the stack.
       */
!     private <V, X extends Throwable> V doCall(CallableOp<V, X> op) {
          Throwable ex;
          boolean atTop;
          V result;
          push();
          try {
< prev index next >