changeset 54510:c97a91097f9f

8221913: Add GC.selected() jtreg-ext function Reviewed-by: kbarrett, pliden
author stefank
date Wed, 10 Apr 2019 15:41:03 +0200
parents 6c291f12969f
children fbfcebad8e66
files test/lib/sun/hotspot/gc/GC.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/lib/sun/hotspot/gc/GC.java	Thu Apr 11 14:20:16 2019 +0530
+++ b/test/lib/sun/hotspot/gc/GC.java	Wed Apr 10 15:41:03 2019 +0200
@@ -70,4 +70,16 @@
     public static boolean isSelectedErgonomically() {
         return WB.isGCSelectedErgonomically();
     }
+
+    /**
+     * @return the selected GC.
+     */
+    public static GC selected() {
+      for (GC gc : values()) {
+        if (gc.isSelected()) {
+          return gc;
+        }
+      }
+      throw new IllegalStateException("No selected GC found");
+    }
 }