Mercurial > hg > graal-jvmci-8
annotate test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java @ 22992:7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
Reviewed-by: kvn
author | bmoloden |
---|---|
date | Thu, 30 Apr 2015 11:45:20 -0700 |
parents | |
children | 0b7060827bca |
rev | line source |
---|---|
22992
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
1 /* |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
4 * |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
8 * |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
13 * accompanied this code). |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
14 * |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
18 * |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
21 * questions. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
22 */ |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
23 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
24 import com.oracle.java.testlibrary.Asserts; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
25 import com.oracle.java.testlibrary.Platform; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
26 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
27 import java.lang.reflect.InvocationTargetException; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
28 import java.lang.reflect.Method; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
29 import java.util.Arrays; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
30 import java.util.Collections; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
31 import java.util.EnumSet; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
32 import java.util.HashSet; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
33 import java.util.List; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
34 import java.util.Set; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
35 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
36 /** |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
37 * @test |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
38 * @summary Verify that for each group of mutually exclusive predicates defined |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
39 * in com.oracle.java.testlibrary.Platform one and only one predicate |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
40 * evaluates to true. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
41 * @library /testlibrary |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
42 * @run main TestMutuallyExclusivePlatformPredicates |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
43 */ |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
44 public class TestMutuallyExclusivePlatformPredicates { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
45 private static enum MethodGroup { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
46 ARCH("isARM", "isPPC", "isSparc", "isX86", "isX64"), |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
47 BITNESS("is32bit", "is64bit"), |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
48 OS("isAix", "isLinux", "isSolaris", "isWindows", "isOSX"), |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
49 VM_TYPE("isClient", "isServer", "isGraal", "isMinimal"), |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
50 IGNORED("isEmbedded", "isDebugBuild", "shouldSAAttach", |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
51 "canPtraceAttachLinux", "canAttachOSX"); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
52 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
53 public final List<String> methodNames; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
54 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
55 private MethodGroup(String... methodNames) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
56 this.methodNames = Collections.unmodifiableList( |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
57 Arrays.asList(methodNames)); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
58 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
59 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
60 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
61 public static void main(String args[]) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
62 EnumSet<MethodGroup> notIgnoredMethodGroups |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
63 = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED)); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
64 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
65 notIgnoredMethodGroups.forEach( |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
66 TestMutuallyExclusivePlatformPredicates::verifyPredicates); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
67 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
68 TestMutuallyExclusivePlatformPredicates.verifyCoverage(); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
69 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
70 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
71 /** |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
72 * Verifies that one and only one predicate method defined in |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
73 * {@link com.oracle.java.testlibrary.Platform}, whose name included into |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
74 * methodGroup will return {@code true}. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
75 * @param methodGroup The group of methods that should be tested. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
76 */ |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
77 private static void verifyPredicates(MethodGroup methodGroup) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
78 System.out.println("Verifying method group: " + methodGroup.name()); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
79 long truePredicatesCount = methodGroup.methodNames.stream() |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
80 .filter(TestMutuallyExclusivePlatformPredicates |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
81 ::evaluatePredicate) |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
82 .count(); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
83 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
84 Asserts.assertEQ(truePredicatesCount, 1L, String.format( |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
85 "Only one predicate from group %s should be evaluated to true " |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
86 + "(Actually %d predicates were evaluated to true).", |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
87 methodGroup.name(), truePredicatesCount)); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
88 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
89 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
90 /** |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
91 * Verifies that all predicates defined in |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
92 * {@link com.oracle.java.testlibrary.Platform} were either tested or |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
93 * explicitly ignored. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
94 */ |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
95 private static void verifyCoverage() { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
96 Set<String> allMethods = new HashSet<>(); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
97 for (MethodGroup group : MethodGroup.values()) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
98 allMethods.addAll(group.methodNames); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
99 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
100 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
101 for (Method m : Platform.class.getMethods()) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
102 if (m.getParameterCount() == 0 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
103 && m.getReturnType() == boolean.class) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
104 Asserts.assertTrue(allMethods.contains(m.getName()), |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
105 "All Platform's methods with signature '():Z' should " |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
106 + "be tested "); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
107 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
108 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
109 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
110 |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
111 /** |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
112 * Evaluates predicate method with name {@code name} defined in |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
113 * {@link com.oracle.java.testlibrary.Platform}. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
114 * |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
115 * @param name The name of a predicate to be evaluated. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
116 * @return evaluated predicate's value. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
117 * @throws java.lang.Error if predicate is not defined or could not be |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
118 * evaluated. |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
119 */ |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
120 private static boolean evaluatePredicate(String name) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
121 try { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
122 System.out.printf("Trying to evaluate predicate with name %s%n", |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
123 name); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
124 boolean value |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
125 = (Boolean) Platform.class.getMethod(name).invoke(null); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
126 System.out.printf("Predicate evaluated to: %s%n", value); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
127 return value; |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
128 } catch (NoSuchMethodException e) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
129 throw new Error("Predicate with name " + name |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
130 + " is not defined in " + Platform.class.getName(), e); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
131 } catch (IllegalAccessException | InvocationTargetException e) { |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
132 throw new Error("Unable to evaluate predicate " + name, e); |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
133 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
134 } |
7bc99c1a5fee
8058846: c.o.j.t.Platform::isX86 and isX64 may simultaneously return true
bmoloden
parents:
diff
changeset
|
135 } |