Mercurial > hg > graal-jvmci-8
comparison jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java @ 22757:f4c4cc22a31c
tightened signature of ConstantReflectionProvider methods for reading fields
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sun, 20 Dec 2015 23:15:24 +0100 |
parents | 1bbd4a7c274b |
children | 30af491f98c5 |
comparison
equal
deleted
inserted
replaced
22756:d52d25716994 | 22757:f4c4cc22a31c |
---|---|
47 import java.util.TreeMap; | 47 import java.util.TreeMap; |
48 import java.util.stream.Collectors; | 48 import java.util.stream.Collectors; |
49 | 49 |
50 import jdk.vm.ci.meta.ConstantReflectionProvider; | 50 import jdk.vm.ci.meta.ConstantReflectionProvider; |
51 import jdk.vm.ci.meta.JavaConstant; | 51 import jdk.vm.ci.meta.JavaConstant; |
52 import jdk.vm.ci.meta.JavaField; | |
53 import jdk.vm.ci.meta.MetaAccessProvider; | 52 import jdk.vm.ci.meta.MetaAccessProvider; |
53 import jdk.vm.ci.meta.ResolvedJavaField; | |
54 import jdk.vm.ci.meta.ResolvedJavaType; | 54 import jdk.vm.ci.meta.ResolvedJavaType; |
55 import jdk.vm.ci.meta.TrustedInterface; | 55 import jdk.vm.ci.meta.TrustedInterface; |
56 import jdk.vm.ci.runtime.JVMCI; | 56 import jdk.vm.ci.runtime.JVMCI; |
57 | 57 |
58 import org.junit.Test; | 58 import org.junit.Test; |
177 public static List<ConstantValue> readConstants(Class<?> fromClass) { | 177 public static List<ConstantValue> readConstants(Class<?> fromClass) { |
178 try { | 178 try { |
179 List<ConstantValue> res = new ArrayList<>(); | 179 List<ConstantValue> res = new ArrayList<>(); |
180 for (Field field : fromClass.getDeclaredFields()) { | 180 for (Field field : fromClass.getDeclaredFields()) { |
181 if (isStatic(field.getModifiers()) && isFinal(field.getModifiers())) { | 181 if (isStatic(field.getModifiers()) && isFinal(field.getModifiers())) { |
182 JavaField javaField = metaAccess.lookupJavaField(field); | 182 ResolvedJavaField javaField = metaAccess.lookupJavaField(field); |
183 Object boxed = field.get(null); | 183 Object boxed = field.get(null); |
184 if (boxed instanceof JavaConstant) { | 184 if (boxed instanceof JavaConstant) { |
185 res.add(new ConstantValue(javaField.format("%H.%n"), (JavaConstant) boxed, boxed)); | 185 res.add(new ConstantValue(javaField.format("%H.%n"), (JavaConstant) boxed, boxed)); |
186 } else { | 186 } else { |
187 JavaConstant value = constantReflection.readConstantFieldValue(javaField, null); | 187 JavaConstant value = constantReflection.readConstantFieldValue(javaField, null); |