author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 45699 | hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java@db25787b8969 |
child 48159 | 11b6d69215ec |
permissions | -rw-r--r-- |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
1 |
/* |
40015
524230a0f4ca
8140723: Remove source code conditionalized on JAVASE_EMBEDDED
dholmes
parents:
36851
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
4 |
* |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
8 |
* |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
13 |
* accompanied this code). |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
14 |
* |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
18 |
* |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
21 |
* questions. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
22 |
*/ |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
23 |
|
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30146
diff
changeset
|
24 |
import jdk.test.lib.Asserts; |
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30146
diff
changeset
|
25 |
import jdk.test.lib.Platform; |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
26 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
27 |
import java.lang.reflect.InvocationTargetException; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
28 |
import java.lang.reflect.Method; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
29 |
import java.util.Arrays; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
30 |
import java.util.Collections; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
31 |
import java.util.EnumSet; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
32 |
import java.util.HashSet; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
33 |
import java.util.List; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
34 |
import java.util.Set; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
35 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
36 |
/** |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
37 |
* @test |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
38 |
* @summary Verify that for each group of mutually exclusive predicates defined |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30146
diff
changeset
|
39 |
* in jdk.test.lib.Platform one and only one predicate |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
40 |
* evaluates to true. |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40093
diff
changeset
|
41 |
* @library /test/lib |
36851 | 42 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
28489
diff
changeset
|
43 |
* java.management |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
44 |
* @run main TestMutuallyExclusivePlatformPredicates |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
45 |
*/ |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
46 |
public class TestMutuallyExclusivePlatformPredicates { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
47 |
private static enum MethodGroup { |
42543 | 48 |
ARCH("isAArch64", "isARM", "isPPC", "isS390x", "isSparc", "isX64", "isX86"), |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
49 |
BITNESS("is32bit", "is64bit"), |
28489
f395f4b55ea1
8068013: [TESTBUG] Aix support in hotspot jtreg tests
goetz
parents:
28389
diff
changeset
|
50 |
OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"), |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40093
diff
changeset
|
51 |
VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"), |
40067
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
36851
diff
changeset
|
52 |
MODE("isInt", "isMixed", "isComp"), |
43455
96560cffef4d
8166002: Emulate client build on platforms with reduced virtual address space
jcm
parents:
42543
diff
changeset
|
53 |
IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild", |
45699
db25787b8969
8182154: merge jdk.testlibrary.Platform and jdk.test.lib.Platform
iignatyev
parents:
43455
diff
changeset
|
54 |
"shouldSAAttach", "isTieredSupported"); |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
55 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
56 |
public final List<String> methodNames; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
57 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
58 |
private MethodGroup(String... methodNames) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
59 |
this.methodNames = Collections.unmodifiableList( |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
60 |
Arrays.asList(methodNames)); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
61 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
62 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
63 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
64 |
public static void main(String args[]) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
65 |
EnumSet<MethodGroup> notIgnoredMethodGroups |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
66 |
= EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
67 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
68 |
notIgnoredMethodGroups.forEach( |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
69 |
TestMutuallyExclusivePlatformPredicates::verifyPredicates); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
70 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
71 |
TestMutuallyExclusivePlatformPredicates.verifyCoverage(); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
72 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
73 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
74 |
/** |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
75 |
* Verifies that one and only one predicate method defined in |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30146
diff
changeset
|
76 |
* {@link jdk.test.lib.Platform}, whose name included into |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
77 |
* methodGroup will return {@code true}. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
78 |
* @param methodGroup The group of methods that should be tested. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
79 |
*/ |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
80 |
private static void verifyPredicates(MethodGroup methodGroup) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
81 |
System.out.println("Verifying method group: " + methodGroup.name()); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
82 |
long truePredicatesCount = methodGroup.methodNames.stream() |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
83 |
.filter(TestMutuallyExclusivePlatformPredicates |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
84 |
::evaluatePredicate) |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
85 |
.count(); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
86 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
87 |
Asserts.assertEQ(truePredicatesCount, 1L, String.format( |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
88 |
"Only one predicate from group %s should be evaluated to true " |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
89 |
+ "(Actually %d predicates were evaluated to true).", |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
90 |
methodGroup.name(), truePredicatesCount)); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
91 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
92 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
93 |
/** |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
94 |
* Verifies that all predicates defined in |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30146
diff
changeset
|
95 |
* {@link jdk.test.lib.Platform} were either tested or |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
96 |
* explicitly ignored. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
97 |
*/ |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
98 |
private static void verifyCoverage() { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
99 |
Set<String> allMethods = new HashSet<>(); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
100 |
for (MethodGroup group : MethodGroup.values()) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
101 |
allMethods.addAll(group.methodNames); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
102 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
103 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
104 |
for (Method m : Platform.class.getMethods()) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
105 |
if (m.getParameterCount() == 0 |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
106 |
&& m.getReturnType() == boolean.class) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
107 |
Asserts.assertTrue(allMethods.contains(m.getName()), |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
108 |
"All Platform's methods with signature '():Z' should " |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
109 |
+ "be tested "); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
110 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
111 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
112 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
113 |
|
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
114 |
/** |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
115 |
* Evaluates predicate method with name {@code name} defined in |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30146
diff
changeset
|
116 |
* {@link jdk.test.lib.Platform}. |
27912
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
117 |
* |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
118 |
* @param name The name of a predicate to be evaluated. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
119 |
* @return evaluated predicate's value. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
120 |
* @throws java.lang.Error if predicate is not defined or could not be |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
121 |
* evaluated. |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
122 |
*/ |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
123 |
private static boolean evaluatePredicate(String name) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
124 |
try { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
125 |
System.out.printf("Trying to evaluate predicate with name %s%n", |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
126 |
name); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
127 |
boolean value |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
128 |
= (Boolean) Platform.class.getMethod(name).invoke(null); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
129 |
System.out.printf("Predicate evaluated to: %s%n", value); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
130 |
return value; |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
131 |
} catch (NoSuchMethodException e) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
132 |
throw new Error("Predicate with name " + name |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
133 |
+ " is not defined in " + Platform.class.getName(), e); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
134 |
} catch (IllegalAccessException | InvocationTargetException e) { |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
135 |
throw new Error("Unable to evaluate predicate " + name, e); |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
136 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
137 |
} |
65f83707f1ca
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
fzhinkin
parents:
diff
changeset
|
138 |
} |