Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/compiler/AbstractCompiler.java @ 16753:f78eafd5ba9e
Truffle-DSL: the processor compiler abstraction now supports declaration oder for enclosed elements of types for JDT which is not conforming to specification.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 15:53:05 +0200 |
parents | 288c23143d47 |
children |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/compiler/AbstractCompiler.java Mon Aug 11 15:53:05 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/compiler/AbstractCompiler.java Mon Aug 11 15:53:05 2014 +0200 @@ -42,7 +42,23 @@ if (o == null) { return null; } - Field field = o.getClass().getField(fieldName); + Class<?> clazz = o.getClass(); + Field field = null; + try { + field = clazz.getField(fieldName); + } catch (NoSuchFieldException e) { + while (clazz != null) { + try { + field = clazz.getDeclaredField(fieldName); + break; + } catch (NoSuchFieldException e1) { + clazz = clazz.getSuperclass(); + } + } + if (field == null) { + throw e; + } + } field.setAccessible(true); return field.get(o); }