Skip JVM for static final field for 959-invoke-polymorphic-accessors
Fixes: 242985782
Test: testrunner.py --host -b -t 959-invoke-polymorphic-accessors
Test: testrunner.py --host --jvm -b -t 959-invoke-polymorphic-accessors
Change-Id: Ib7b926b66431e80557a7f2b124593f8a2a391416
diff --git a/test/959-invoke-polymorphic-accessors/src/Main.java b/test/959-invoke-polymorphic-accessors/src/Main.java
index e4a6f94..73b7746 100644
--- a/test/959-invoke-polymorphic-accessors/src/Main.java
+++ b/test/959-invoke-polymorphic-accessors/src/Main.java
@@ -20,6 +20,8 @@
public class Main {
+ private static final boolean DALVIK_RUN = "Dalvik".equals(System.getProperty("java.vm.name"));
+
public static class ValueHolder {
public boolean m_z = false;
public byte m_b = 0;
@@ -959,8 +961,10 @@
MethodHandles.lookup().unreflectSetter(f).invokeExact(v, 'A');
assertEquals('A', (char) MethodHandles.lookup().unreflectGetter(f).invokeExact(v));
}
- {
+ if (DALVIK_RUN) {
// public static final field test
+ // for JVM it is not possible to get the unreflected setter for a static final
+ // field, see b/242985782
Field f = ValueHolder.class.getDeclaredField("s_fi");
try {
MethodHandles.lookup().unreflectSetter(f);
@@ -1011,8 +1015,10 @@
fail();
} catch (IllegalAccessException expected) {}
}
- {
+ if (DALVIK_RUN) {
// private static final field test
+ // for JVM it is not possible to get the unreflected setter for a static final
+ // field, see b/242985782
Field f = ValueHolder.class.getDeclaredField("s_fz"); // private static final field
try {
MethodHandles.lookup().unreflectSetter(f);