Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/TypeSystemParser.java @ 22326:6cec0097107f
added workaround based on JDK-8075793 to allow compilation with JDK9 javac
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 26 Oct 2015 13:28:19 +0100 |
parents | dc83cc1f94f2 |
children | 4a43dc00a654 |
comparison
equal
deleted
inserted
replaced
22325:414e82b9fc35 | 22326:6cec0097107f |
---|---|
30 import com.oracle.truffle.dsl.processor.model.ImplicitCastData; | 30 import com.oracle.truffle.dsl.processor.model.ImplicitCastData; |
31 import com.oracle.truffle.dsl.processor.model.Template; | 31 import com.oracle.truffle.dsl.processor.model.Template; |
32 import com.oracle.truffle.dsl.processor.model.TypeCastData; | 32 import com.oracle.truffle.dsl.processor.model.TypeCastData; |
33 import com.oracle.truffle.dsl.processor.model.TypeCheckData; | 33 import com.oracle.truffle.dsl.processor.model.TypeCheckData; |
34 import com.oracle.truffle.dsl.processor.model.TypeSystemData; | 34 import com.oracle.truffle.dsl.processor.model.TypeSystemData; |
35 | |
35 import java.lang.annotation.Annotation; | 36 import java.lang.annotation.Annotation; |
36 import java.util.ArrayList; | 37 import java.util.ArrayList; |
37 import java.util.Arrays; | 38 import java.util.Arrays; |
38 import java.util.HashMap; | 39 import java.util.HashMap; |
39 import java.util.HashSet; | 40 import java.util.HashSet; |
40 import java.util.List; | 41 import java.util.List; |
41 import java.util.Map; | 42 import java.util.Map; |
42 import java.util.Set; | 43 import java.util.Set; |
44 | |
43 import javax.lang.model.element.AnnotationMirror; | 45 import javax.lang.model.element.AnnotationMirror; |
44 import javax.lang.model.element.Element; | 46 import javax.lang.model.element.Element; |
45 import javax.lang.model.element.ExecutableElement; | 47 import javax.lang.model.element.ExecutableElement; |
46 import javax.lang.model.element.Modifier; | 48 import javax.lang.model.element.Modifier; |
47 import javax.lang.model.element.TypeElement; | 49 import javax.lang.model.element.TypeElement; |
58 @Override | 60 @Override |
59 public Class<? extends Annotation> getAnnotationType() { | 61 public Class<? extends Annotation> getAnnotationType() { |
60 return TypeSystem.class; | 62 return TypeSystem.class; |
61 } | 63 } |
62 | 64 |
65 /** | |
66 * @see "https://bugs.openjdk.java.net/browse/JDK-8039214" | |
67 */ | |
68 private static List<Element> newElementList(List<? extends Element> src) { | |
69 List<Element> workaround = new ArrayList<>(src); | |
70 return workaround; | |
71 } | |
72 | |
63 @Override | 73 @Override |
64 protected TypeSystemData parse(Element element, AnnotationMirror mirror) { | 74 protected TypeSystemData parse(Element element, AnnotationMirror mirror) { |
65 TypeElement templateType = (TypeElement) element; | 75 TypeElement templateType = (TypeElement) element; |
66 AnnotationMirror templateTypeAnnotation = mirror; | 76 AnnotationMirror templateTypeAnnotation = mirror; |
67 DSLOptions options = element.getAnnotation(DSLOptions.class); | 77 DSLOptions options = element.getAnnotation(DSLOptions.class); |
92 return typeSystem; | 102 return typeSystem; |
93 } | 103 } |
94 | 104 |
95 verifyExclusiveMethodAnnotation(typeSystem, TypeCast.class, TypeCheck.class); | 105 verifyExclusiveMethodAnnotation(typeSystem, TypeCast.class, TypeCheck.class); |
96 | 106 |
97 List<Element> elements = new ArrayList<>(context.getEnvironment().getElementUtils().getAllMembers(templateType)); | 107 List<Element> elements = newElementList(context.getEnvironment().getElementUtils().getAllMembers(templateType)); |
98 List<ImplicitCastData> implicitCasts = new ImplicitCastParser(context, typeSystem).parse(elements); | 108 List<ImplicitCastData> implicitCasts = new ImplicitCastParser(context, typeSystem).parse(elements); |
99 List<TypeCastData> casts = new TypeCastParser(context, typeSystem).parse(elements); | 109 List<TypeCastData> casts = new TypeCastParser(context, typeSystem).parse(elements); |
100 List<TypeCheckData> checks = new TypeCheckParser(context, typeSystem).parse(elements); | 110 List<TypeCheckData> checks = new TypeCheckParser(context, typeSystem).parse(elements); |
101 | 111 |
102 if (casts == null || checks == null || implicitCasts == null) { | 112 if (casts == null || checks == null || implicitCasts == null) { |