Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/model/CodeTypeMirror.java @ 16923:93e061157811
Truffle-DSL: better support for types with type arguments.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 25 Aug 2014 20:59:56 +0200 |
parents | 23415229349b |
children |
comparison
equal
deleted
inserted
replaced
16922:0ea0c4133b78 | 16923:93e061157811 |
---|---|
44 @Override | 44 @Override |
45 public <R, P> R accept(TypeVisitor<R, P> v, P p) { | 45 public <R, P> R accept(TypeVisitor<R, P> v, P p) { |
46 throw new UnsupportedOperationException(); | 46 throw new UnsupportedOperationException(); |
47 } | 47 } |
48 | 48 |
49 public static class WildcardTypeMirror extends CodeTypeMirror implements WildcardType { | |
50 | |
51 private final TypeMirror extendsBounds; | |
52 private final TypeMirror superBounds; | |
53 | |
54 public WildcardTypeMirror(TypeMirror extendsBounds, TypeMirror superBounds) { | |
55 super(TypeKind.WILDCARD); | |
56 this.extendsBounds = extendsBounds; | |
57 this.superBounds = superBounds; | |
58 } | |
59 | |
60 public TypeMirror getExtendsBound() { | |
61 return extendsBounds; | |
62 } | |
63 | |
64 public TypeMirror getSuperBound() { | |
65 return superBounds; | |
66 } | |
67 | |
68 } | |
69 | |
49 public static class ArrayCodeTypeMirror extends CodeTypeMirror implements ArrayType { | 70 public static class ArrayCodeTypeMirror extends CodeTypeMirror implements ArrayType { |
50 | 71 |
51 private final TypeMirror component; | 72 private final TypeMirror component; |
52 | 73 |
53 public ArrayCodeTypeMirror(TypeMirror component) { | 74 public ArrayCodeTypeMirror(TypeMirror component) { |
63 } | 84 } |
64 | 85 |
65 public static class DeclaredCodeTypeMirror extends CodeTypeMirror implements DeclaredType { | 86 public static class DeclaredCodeTypeMirror extends CodeTypeMirror implements DeclaredType { |
66 | 87 |
67 private final TypeElement clazz; | 88 private final TypeElement clazz; |
68 private final List<? extends TypeMirror> typeArguments; | 89 private final List<TypeMirror> typeArguments; |
69 | 90 |
70 public DeclaredCodeTypeMirror(TypeElement clazz) { | 91 public DeclaredCodeTypeMirror(TypeElement clazz) { |
71 this(clazz, Collections.<TypeMirror> emptyList()); | 92 this(clazz, Collections.<TypeMirror> emptyList()); |
72 } | 93 } |
73 | 94 |
74 public DeclaredCodeTypeMirror(TypeElement clazz, List<? extends TypeMirror> typeArguments) { | 95 public DeclaredCodeTypeMirror(TypeElement clazz, List<TypeMirror> typeArguments) { |
75 super(TypeKind.DECLARED); | 96 super(TypeKind.DECLARED); |
76 this.clazz = clazz; | 97 this.clazz = clazz; |
77 this.typeArguments = typeArguments; | 98 this.typeArguments = typeArguments; |
78 } | 99 } |
79 | 100 |
86 public TypeMirror getEnclosingType() { | 107 public TypeMirror getEnclosingType() { |
87 return clazz.getEnclosingElement().asType(); | 108 return clazz.getEnclosingElement().asType(); |
88 } | 109 } |
89 | 110 |
90 @Override | 111 @Override |
91 public List<? extends TypeMirror> getTypeArguments() { | 112 public List<TypeMirror> getTypeArguments() { |
92 return typeArguments; | 113 return typeArguments; |
93 } | 114 } |
94 | 115 |
95 @Override | 116 @Override |
96 public String toString() { | 117 public String toString() { |