Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java @ 9227:6d92fdf1c999
Fixes several minor issues.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 22 Apr 2013 12:52:00 +0200 |
parents | 5e3d1a68664e |
children |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java Sat Apr 20 12:45:07 2013 +0200 +++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java Mon Apr 22 12:52:00 2013 +0200 @@ -29,7 +29,9 @@ import javax.annotation.processing.*; import javax.lang.model.element.*; import javax.lang.model.type.*; +import javax.lang.model.util.*; +import com.oracle.truffle.codegen.processor.ast.*; import com.oracle.truffle.codegen.processor.ast.CodeTypeMirror.ArrayCodeTypeMirror; import com.oracle.truffle.codegen.processor.template.*; @@ -185,4 +187,26 @@ } + public TypeMirror reloadTypeElement(TypeElement type) { + return getType(type.getQualifiedName().toString()); + } + + public TypeMirror reloadType(TypeMirror type) { + if (type instanceof CodeTypeMirror) { + return type; + } else if (type.getKind().isPrimitive()) { + return type; + } + Types types = getEnvironment().getTypeUtils(); + + switch (type.getKind()) { + case ARRAY: + return types.getArrayType(reloadType(((ArrayType) type).getComponentType())); + case WILDCARD: + return types.getWildcardType(((WildcardType) type).getExtendsBound(), ((WildcardType) type).getSuperBound()); + case DECLARED: + return reloadTypeElement((TypeElement) (((DeclaredType) type).asElement())); + } + return type; + } }