Ensure that 055 checks we don't cheat on the library side...
Class.isEnum is expensive, but we need to make sure that it's cached
rather than skipped.
Change-Id: I130c683e3b48ccb2fd93dfca8e6ae3e73c8393f6
diff --git a/test/055-enum-performance/src/Main.java b/test/055-enum-performance/src/Main.java
index 43f45f1..d5903af 100644
--- a/test/055-enum-performance/src/Main.java
+++ b/test/055-enum-performance/src/Main.java
@@ -1,10 +1,30 @@
import otherpackage.OtherPackagePublicEnum;
+import java.lang.reflect.*;
+
public class Main {
/** used by {@link #basisCall} */
static private int basisTestValue = 12;
static public void main(String[] args) throws Exception {
+ try {
+ Class<?> enumClass = Enum.class;
+ Method enumValueOf = null;
+ for (Method m : enumClass.getDeclaredMethods()) {
+ if (m.getName().equals("valueOf")) {
+ enumValueOf = m;
+ break;
+ }
+ }
+ enumValueOf.invoke(null, String.class, "blah");
+ throw new AssertionError();
+ } catch (InvocationTargetException expected) {
+ IllegalArgumentException iae = (IllegalArgumentException) expected.getCause();
+ if (!iae.getMessage().equals("class java.lang.String is not an enum type")) {
+ throw new AssertionError();
+ }
+ }
+
boolean timing = (args.length >= 1) && args[0].equals("--timing");
run(timing);
}