comparison truffle/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/model/CodeTypeMirror.java @ 21951:9c8c0937da41

Moving all sources into truffle subdirectory
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 17 Jun 2015 10:58:08 +0200
parents graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/model/CodeTypeMirror.java@93e061157811
children dc83cc1f94f2
comparison
equal deleted inserted replaced
21950:2a5011c7e641 21951:9c8c0937da41
1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.truffle.dsl.processor.java.model;
24
25 import java.lang.annotation.*;
26 import java.util.*;
27
28 import javax.lang.model.element.*;
29 import javax.lang.model.type.*;
30
31 public class CodeTypeMirror implements TypeMirror {
32
33 private final TypeKind kind;
34
35 public CodeTypeMirror(TypeKind kind) {
36 this.kind = kind;
37 }
38
39 @Override
40 public TypeKind getKind() {
41 return kind;
42 }
43
44 @Override
45 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
46 throw new UnsupportedOperationException();
47 }
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
70 public static class ArrayCodeTypeMirror extends CodeTypeMirror implements ArrayType {
71
72 private final TypeMirror component;
73
74 public ArrayCodeTypeMirror(TypeMirror component) {
75 super(TypeKind.ARRAY);
76 this.component = component;
77 }
78
79 @Override
80 public TypeMirror getComponentType() {
81 return component;
82 }
83
84 }
85
86 public static class DeclaredCodeTypeMirror extends CodeTypeMirror implements DeclaredType {
87
88 private final TypeElement clazz;
89 private final List<TypeMirror> typeArguments;
90
91 public DeclaredCodeTypeMirror(TypeElement clazz) {
92 this(clazz, Collections.<TypeMirror> emptyList());
93 }
94
95 public DeclaredCodeTypeMirror(TypeElement clazz, List<TypeMirror> typeArguments) {
96 super(TypeKind.DECLARED);
97 this.clazz = clazz;
98 this.typeArguments = typeArguments;
99 }
100
101 @Override
102 public Element asElement() {
103 return clazz;
104 }
105
106 @Override
107 public TypeMirror getEnclosingType() {
108 return clazz.getEnclosingElement().asType();
109 }
110
111 @Override
112 public List<TypeMirror> getTypeArguments() {
113 return typeArguments;
114 }
115
116 @Override
117 public String toString() {
118 return clazz.getQualifiedName().toString();
119 }
120
121 }
122
123 public List<? extends AnnotationMirror> getAnnotationMirrors() {
124 throw new UnsupportedOperationException();
125 }
126
127 /**
128 * @param annotationType
129 */
130 public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
131 throw new UnsupportedOperationException();
132 }
133
134 /**
135 * @param annotationType
136 */
137 public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
138 throw new UnsupportedOperationException();
139 }
140 }