Mercurial > hg > graal-jvmci-8
diff jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java @ 23384:f102ee538647
Remove stable constant handling from ConstantReflectionProvider (JDK-8156552).
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 10 May 2016 14:55:40 +0200 |
parents | 1bbd4a7c274b |
children | c8cdf8d81475 |
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Mon May 02 14:57:11 2016 +0200 +++ b/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java Tue May 10 14:55:40 2016 +0200 @@ -32,7 +32,6 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.lang.annotation.Annotation; @@ -40,17 +39,15 @@ import java.lang.reflect.Method; import java.util.Arrays; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Set; -import jdk.vm.ci.meta.JavaConstant; +import org.junit.Test; + import jdk.vm.ci.meta.LocationIdentity; import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaMethod; -import org.junit.Test; - /** * Tests for {@link ResolvedJavaField}. */ @@ -106,35 +103,6 @@ } } - static class ReadConstantValueTestConstants { - String stringField = "field"; - final String constantStringField = "constantField"; - - static final Object CONST1 = new ReadConstantValueTestConstants(); - static final Object CONST2 = null; - static final Object CONST3 = new String(); - } - - @Test - public void readConstantValueTest() throws NoSuchFieldException { - ResolvedJavaField field = metaAccess.lookupJavaField(ReadConstantValueTestConstants.class.getDeclaredField("stringField")); - List<ConstantValue> receiverConstants = readConstants(ReadConstantValueTestConstants.class); - for (ConstantValue receiver : receiverConstants) { - JavaConstant value = constantReflection.readConstantFieldValue(field, receiver.value); - assertNull(value); - } - - ResolvedJavaField constField = metaAccess.lookupJavaField(ReadConstantValueTestConstants.class.getDeclaredField("constantStringField")); - for (ConstantValue receiver : receiverConstants) { - JavaConstant value = constantReflection.readConstantFieldValue(constField, receiver.value); - if (value != null) { - Object expected = "constantField"; - String actual = ((ReadConstantValueTestConstants) receiver.boxed).constantStringField; - assertTrue(actual + " != " + expected, actual == expected); - } - } - } - private Method findTestMethod(Method apiMethod) { String testName = apiMethod.getName() + "Test"; for (Method m : getClass().getDeclaredMethods()) {