changeset 47275:65640af28197

8187376: test issue in java/lang/invoke/VarHandles/VarHandleBaseTest.java Reviewed-by: psandoz
author mli
date Tue, 26 Sep 2017 12:47:49 +0800
parents bbbf1b1e36e9
children fae0bf9e361f
files test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java
diffstat 1 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java	Tue Sep 26 07:00:43 2017 +0530
+++ b/test/jdk/java/lang/invoke/VarHandles/VarHandleBaseTest.java	Tue Sep 26 12:47:49 2017 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -203,10 +203,8 @@
 
     static List<TestAccessMode> testAccessModesOfType(TestAccessType... ats) {
         Stream<TestAccessMode> s = Stream.of(TestAccessMode.values());
-        for (TestAccessType at : ats) {
-            s = s.filter(e -> e.isOfType(at));
-        }
-        return s.collect(toList());
+        return s.filter(e -> Stream.of(ats).anyMatch(e::isOfType))
+                .collect(toList());
     }
 
     static List<VarHandle.AccessMode> accessModes() {
@@ -215,10 +213,9 @@
 
     static List<VarHandle.AccessMode> accessModesOfType(TestAccessType... ats) {
         Stream<TestAccessMode> s = Stream.of(TestAccessMode.values());
-        for (TestAccessType at : ats) {
-            s = s.filter(e -> e.isOfType(at));
-        }
-        return s.map(TestAccessMode::toAccessMode).collect(toList());
+        return s.filter(e -> Stream.of(ats).anyMatch(e::isOfType))
+                .map(TestAccessMode::toAccessMode)
+                .collect(toList());
     }
 
     static MethodHandle toMethodHandle(VarHandle vh, TestAccessMode tam, MethodType mt) {