|
1 |
| package edu.rice.cs.dynamicjava.symbol; |
|
2 |
| |
|
3 |
| import edu.rice.cs.dynamicjava.symbol.type.*; |
|
4 |
| import koala.dynamicjava.tree.Expression; |
|
5 |
| |
|
6 |
| import edu.rice.cs.plt.tuple.Pair; |
|
7 |
| import edu.rice.cs.plt.tuple.Option; |
|
8 |
| import edu.rice.cs.plt.iter.IterUtil; |
|
9 |
| import edu.rice.cs.plt.lambda.Thunk; |
|
10 |
| import edu.rice.cs.plt.lambda.Lambda; |
|
11 |
| import edu.rice.cs.plt.object.ObjectUtil; |
|
12 |
| |
|
13 |
| import java.io.Serializable; |
|
14 |
| |
|
15 |
| import static edu.rice.cs.plt.debug.DebugUtil.debug; |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| public abstract class TypeSystem { |
|
25 |
| |
|
26 |
| public static final BooleanType BOOLEAN = new BooleanType(); |
|
27 |
| public static final CharType CHAR = new CharType(); |
|
28 |
| public static final ByteType BYTE = new ByteType(); |
|
29 |
| public static final ShortType SHORT = new ShortType(); |
|
30 |
| public static final IntType INT = new IntType(); |
|
31 |
| public static final LongType LONG = new LongType(); |
|
32 |
| public static final FloatType FLOAT = new FloatType(); |
|
33 |
| public static final DoubleType DOUBLE = new DoubleType(); |
|
34 |
| public static final NullType NULL = new NullType(); |
|
35 |
| public static final VoidType VOID = new VoidType(); |
|
36 |
| public static final TopType TOP = new TopType(); |
|
37 |
| public static final BottomType BOTTOM = new BottomType(); |
|
38 |
| |
|
39 |
| public static final SimpleClassType OBJECT = new SimpleClassType(SymbolUtil.wrapClass(Object.class)); |
|
40 |
| public static final SimpleClassType STRING = new SimpleClassType(SymbolUtil.wrapClass(String.class)); |
|
41 |
| public static final SimpleClassType CLONEABLE = new SimpleClassType(SymbolUtil.wrapClass(Cloneable.class)); |
|
42 |
| public static final SimpleClassType SERIALIZABLE = new SimpleClassType(SymbolUtil.wrapClass(Serializable.class)); |
|
43 |
| public static final SimpleClassType THROWABLE = new SimpleClassType(SymbolUtil.wrapClass(Throwable.class)); |
|
44 |
| public static final SimpleClassType EXCEPTION = new SimpleClassType(SymbolUtil.wrapClass(Exception.class)); |
|
45 |
| public static final SimpleClassType RUNTIME_EXCEPTION = |
|
46 |
| new SimpleClassType(SymbolUtil.wrapClass(RuntimeException.class)); |
|
47 |
| public static final SimpleClassType BOOLEAN_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Boolean.class)); |
|
48 |
| public static final SimpleClassType CHARACTER_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Character.class)); |
|
49 |
| public static final SimpleClassType BYTE_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Byte.class)); |
|
50 |
| public static final SimpleClassType SHORT_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Short.class)); |
|
51 |
| public static final SimpleClassType INTEGER_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Integer.class)); |
|
52 |
| public static final SimpleClassType LONG_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Long.class)); |
|
53 |
| public static final SimpleClassType FLOAT_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Float.class)); |
|
54 |
| public static final SimpleClassType DOUBLE_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Double.class)); |
|
55 |
| public static final SimpleClassType VOID_CLASS = new SimpleClassType(SymbolUtil.wrapClass(Void.class)); |
|
56 |
| |
|
57 |
| protected static final Type[] EMPTY_TYPE_ARRAY = new Type[0]; |
|
58 |
| protected static final Iterable<Type> EMPTY_TYPE_ITERABLE = IterUtil.empty(); |
|
59 |
| protected static final Iterable<Expression> EMPTY_EXPRESSION_ITERABLE = IterUtil.empty(); |
|
60 |
| protected static final Option<Type> NONE_TYPE_OPTION = Option.none(); |
|
61 |
| |
|
62 |
3887
| public TypeWrapper wrap(Type t) { return (t == null) ? null : new TypeWrapper(t); }
|
|
63 |
| |
|
64 |
1104
| public Iterable<TypeWrapper> wrap(Iterable<? extends Type> ts) {
|
|
65 |
1104
| return (ts == null) ? null : IterUtil.map(ts, WRAP_TYPE);
|
|
66 |
| } |
|
67 |
| |
|
68 |
| private final Lambda<Type, TypeWrapper> WRAP_TYPE = new Lambda<Type, TypeWrapper>() { |
|
69 |
0
| public TypeWrapper value(Type t) { return (t == null) ? null : new TypeWrapper(t); }
|
|
70 |
| }; |
|
71 |
| |
|
72 |
552
| public Option<TypeWrapper> wrap(Option<Type> t) {
|
|
73 |
0
| if (t == null) return null;
|
|
74 |
552
| else return t.isSome() ? Option.some(new TypeWrapper(t.unwrap())) : Option.<TypeWrapper>none();
|
|
75 |
| } |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| public class TypeWrapper { |
|
83 |
| private Type _t; |
|
84 |
4055
| public TypeWrapper(Type t) { _t = t; }
|
|
85 |
| |
|
86 |
0
| public String toString() { return typePrinter().print(_t); }
|
|
87 |
| |
|
88 |
0
| public boolean equals(Object o) {
|
|
89 |
0
| if (this == o) { return true; }
|
|
90 |
0
| else if (!(o instanceof TypeWrapper)) { return false; }
|
|
91 |
0
| else { return isEqual(_t, ((TypeWrapper) o)._t); }
|
|
92 |
| } |
|
93 |
| |
|
94 |
0
| public int hashCode() { throw new UnsupportedOperationException(); }
|
|
95 |
| } |
|
96 |
| |
|
97 |
| |
|
98 |
| public abstract TypePrinter typePrinter(); |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
| public abstract boolean isPrimitive(Type t); |
|
104 |
| |
|
105 |
| |
|
106 |
| public abstract boolean isReference(Type t); |
|
107 |
| |
|
108 |
| |
|
109 |
| public abstract boolean isArray(Type t); |
|
110 |
| |
|
111 |
| |
|
112 |
| |
|
113 |
| public abstract boolean isWellFormed(Type t); |
|
114 |
| |
|
115 |
| |
|
116 |
| |
|
117 |
| |
|
118 |
| |
|
119 |
| public abstract boolean isIterable(Type t); |
|
120 |
| |
|
121 |
| |
|
122 |
| |
|
123 |
| |
|
124 |
| |
|
125 |
| public abstract boolean isEnum(Type t); |
|
126 |
| |
|
127 |
| |
|
128 |
| public abstract boolean isReifiable(Type t); |
|
129 |
| |
|
130 |
| |
|
131 |
| |
|
132 |
| |
|
133 |
| |
|
134 |
| public abstract boolean isConcrete(Type t); |
|
135 |
| |
|
136 |
| |
|
137 |
| public abstract boolean isExtendable(Type t); |
|
138 |
| |
|
139 |
| |
|
140 |
| public abstract boolean isImplementable(Type t); |
|
141 |
| |
|
142 |
| |
|
143 |
| |
|
144 |
| |
|
145 |
| |
|
146 |
| public abstract boolean isEqual(Type t1, Type t2); |
|
147 |
| |
|
148 |
| |
|
149 |
| |
|
150 |
| |
|
151 |
| |
|
152 |
| public abstract boolean isSubtype(Type subT, Type superT); |
|
153 |
| |
|
154 |
| |
|
155 |
| public abstract boolean isDisjoint(Type t1, Type t2); |
|
156 |
| |
|
157 |
| |
|
158 |
| public abstract boolean isAssignable(Type target, Type expT); |
|
159 |
| |
|
160 |
| |
|
161 |
| public abstract boolean isAssignable(Type target, Type expT, Object expValue); |
|
162 |
| |
|
163 |
| |
|
164 |
| public abstract boolean isPrimitiveConvertible(Type t); |
|
165 |
| |
|
166 |
| |
|
167 |
| public abstract boolean isReferenceConvertible(Type t); |
|
168 |
| |
|
169 |
| |
|
170 |
| public abstract Type join(Iterable<? extends Type> ts); |
|
171 |
| |
|
172 |
| |
|
173 |
0
| public Type join(Type t1, Type t2) { return join(IterUtil.make(t1, t2)); }
|
|
174 |
| |
|
175 |
| |
|
176 |
| public abstract Type meet(Iterable<? extends Type> ts); |
|
177 |
| |
|
178 |
| |
|
179 |
0
| public Type meet(Type t1, Type t2) { return meet(IterUtil.make(t1, t2)); }
|
|
180 |
| |
|
181 |
| |
|
182 |
| |
|
183 |
| |
|
184 |
| |
|
185 |
| |
|
186 |
| |
|
187 |
| |
|
188 |
| public abstract Type capture(Type t); |
|
189 |
| |
|
190 |
| |
|
191 |
| |
|
192 |
| |
|
193 |
| |
|
194 |
| public abstract Type erase(Type t); |
|
195 |
| |
|
196 |
| |
|
197 |
| |
|
198 |
| |
|
199 |
| |
|
200 |
| |
|
201 |
| public abstract Thunk<Class<?>> erasedClass(Type t); |
|
202 |
| |
|
203 |
| |
|
204 |
| |
|
205 |
| |
|
206 |
| |
|
207 |
| public abstract Type reflectionClassOf(Type t); |
|
208 |
| |
|
209 |
| |
|
210 |
| |
|
211 |
| |
|
212 |
| |
|
213 |
| |
|
214 |
| public abstract Type arrayElementType(Type t); |
|
215 |
| |
|
216 |
| |
|
217 |
| public abstract Option<Type> dynamicallyEnclosingType(Type t); |
|
218 |
| |
|
219 |
| |
|
220 |
| |
|
221 |
| |
|
222 |
| public abstract ClassType makeClassType(DJClass c); |
|
223 |
| |
|
224 |
| |
|
225 |
| |
|
226 |
| |
|
227 |
| |
|
228 |
| |
|
229 |
| |
|
230 |
| |
|
231 |
| |
|
232 |
| |
|
233 |
| |
|
234 |
| |
|
235 |
| public abstract ClassType makeClassType(DJClass c, Iterable<? extends Type> args) |
|
236 |
| throws InvalidTypeArgumentException; |
|
237 |
| |
|
238 |
| |
|
239 |
| |
|
240 |
| |
|
241 |
| |
|
242 |
| |
|
243 |
| |
|
244 |
| |
|
245 |
| |
|
246 |
| |
|
247 |
| |
|
248 |
| |
|
249 |
| public abstract Expression makePrimitive(Expression e) throws UnsupportedConversionException; |
|
250 |
| |
|
251 |
| |
|
252 |
| |
|
253 |
| |
|
254 |
| |
|
255 |
| |
|
256 |
| |
|
257 |
| |
|
258 |
| |
|
259 |
| public abstract Expression makeReference(Expression e) throws UnsupportedConversionException; |
|
260 |
| |
|
261 |
| |
|
262 |
| |
|
263 |
| |
|
264 |
| |
|
265 |
| |
|
266 |
| |
|
267 |
| |
|
268 |
| public abstract Expression unaryPromote(Expression e) throws UnsupportedConversionException; |
|
269 |
| |
|
270 |
| |
|
271 |
| |
|
272 |
| |
|
273 |
| |
|
274 |
| |
|
275 |
| |
|
276 |
| |
|
277 |
| |
|
278 |
| |
|
279 |
| public abstract Pair<Expression, Expression> binaryPromote(Expression e1, Expression e2) |
|
280 |
| throws UnsupportedConversionException; |
|
281 |
| |
|
282 |
| |
|
283 |
| |
|
284 |
| |
|
285 |
| |
|
286 |
| |
|
287 |
| |
|
288 |
| |
|
289 |
| |
|
290 |
| |
|
291 |
| public abstract Pair<Expression, Expression> mergeConditional(Expression e1, Expression e2) |
|
292 |
| throws UnsupportedConversionException; |
|
293 |
| |
|
294 |
| |
|
295 |
| |
|
296 |
| |
|
297 |
| |
|
298 |
| |
|
299 |
| |
|
300 |
| |
|
301 |
| public abstract Expression cast(Type target, Expression e) throws UnsupportedConversionException; |
|
302 |
| |
|
303 |
| |
|
304 |
| |
|
305 |
| |
|
306 |
| |
|
307 |
| |
|
308 |
| |
|
309 |
| public abstract Expression assign(Type target, Expression e) throws UnsupportedConversionException; |
|
310 |
| |
|
311 |
| |
|
312 |
| |
|
313 |
| |
|
314 |
| |
|
315 |
| |
|
316 |
| |
|
317 |
| |
|
318 |
| |
|
319 |
| |
|
320 |
| |
|
321 |
| |
|
322 |
| |
|
323 |
| |
|
324 |
| |
|
325 |
| |
|
326 |
| public abstract ConstructorInvocation lookupConstructor(Type t, Iterable<? extends Type> typeArgs, |
|
327 |
| Iterable<? extends Expression> args, |
|
328 |
| Option<Type> expected, Access.Module accessModule) |
|
329 |
| throws InvalidTypeArgumentException, UnmatchedLookupException; |
|
330 |
| |
|
331 |
| |
|
332 |
| public abstract boolean containsMethod(Type t, String name, Access.Module accessModule); |
|
333 |
| |
|
334 |
| public abstract boolean containsStaticMethod(Type t, String name, Access.Module accessModule); |
|
335 |
| |
|
336 |
| |
|
337 |
| |
|
338 |
| |
|
339 |
| |
|
340 |
| |
|
341 |
| |
|
342 |
| |
|
343 |
| |
|
344 |
| |
|
345 |
| |
|
346 |
| |
|
347 |
| |
|
348 |
| public abstract ObjectMethodInvocation lookupMethod(Expression object, String name, |
|
349 |
| Iterable<? extends Type> typeArgs, |
|
350 |
| Iterable<? extends Expression> args, |
|
351 |
| Option<Type> expected, Access.Module accessModule) |
|
352 |
| throws InvalidTypeArgumentException, UnmatchedLookupException; |
|
353 |
| |
|
354 |
| |
|
355 |
| |
|
356 |
| |
|
357 |
| |
|
358 |
| |
|
359 |
| |
|
360 |
| |
|
361 |
| |
|
362 |
| |
|
363 |
| |
|
364 |
| |
|
365 |
| |
|
366 |
| |
|
367 |
| public abstract StaticMethodInvocation lookupStaticMethod(Type t, String name, |
|
368 |
| Iterable<? extends Type> typeArgs, |
|
369 |
| Iterable<? extends Expression> args, |
|
370 |
| Option<Type> expected, Access.Module accessModule) |
|
371 |
| throws InvalidTypeArgumentException, UnmatchedLookupException; |
|
372 |
| |
|
373 |
| |
|
374 |
| public abstract boolean containsField(Type t, String name, Access.Module accessModule); |
|
375 |
| |
|
376 |
| public abstract boolean containsStaticField(Type t, String name, Access.Module accessModule); |
|
377 |
| |
|
378 |
| |
|
379 |
| |
|
380 |
| |
|
381 |
| |
|
382 |
| |
|
383 |
| |
|
384 |
| |
|
385 |
| public abstract ObjectFieldReference lookupField(Expression object, String name, Access.Module accessModule) |
|
386 |
| throws UnmatchedLookupException; |
|
387 |
| |
|
388 |
| |
|
389 |
| |
|
390 |
| |
|
391 |
| |
|
392 |
| |
|
393 |
| |
|
394 |
| |
|
395 |
| public abstract StaticFieldReference lookupStaticField(Type t, String name, Access.Module accessModule) |
|
396 |
| throws UnmatchedLookupException; |
|
397 |
| |
|
398 |
| |
|
399 |
| public abstract boolean containsClass(Type t, String name, Access.Module accessModule); |
|
400 |
| |
|
401 |
| public abstract boolean containsStaticClass(Type t, String name, Access.Module accessModule); |
|
402 |
| |
|
403 |
| |
|
404 |
| |
|
405 |
| |
|
406 |
| |
|
407 |
| |
|
408 |
| |
|
409 |
| |
|
410 |
| |
|
411 |
| |
|
412 |
| |
|
413 |
| |
|
414 |
| public abstract ClassType lookupClass(Expression object, String name, Iterable<? extends Type> typeArgs, |
|
415 |
| Access.Module accessModule) |
|
416 |
| throws InvalidTypeArgumentException, UnmatchedLookupException; |
|
417 |
| |
|
418 |
| |
|
419 |
| |
|
420 |
| |
|
421 |
| |
|
422 |
| |
|
423 |
| |
|
424 |
| |
|
425 |
| |
|
426 |
| |
|
427 |
| |
|
428 |
| |
|
429 |
| public abstract ClassType lookupClass(Type t, String name, Iterable<? extends Type> typeArgs, |
|
430 |
| Access.Module accessModule) |
|
431 |
| throws InvalidTypeArgumentException, UnmatchedLookupException; |
|
432 |
| |
|
433 |
| |
|
434 |
| |
|
435 |
| |
|
436 |
| |
|
437 |
| |
|
438 |
| |
|
439 |
| |
|
440 |
| |
|
441 |
| |
|
442 |
| |
|
443 |
| |
|
444 |
| public abstract ClassType lookupStaticClass(Type t, String name, Iterable<? extends Type> typeArgs, |
|
445 |
| Access.Module accessModule) |
|
446 |
| throws InvalidTypeArgumentException, UnmatchedLookupException; |
|
447 |
| |
|
448 |
| |
|
449 |
| public static interface TypePrinter { |
|
450 |
| |
|
451 |
| public String print(Type t); |
|
452 |
| |
|
453 |
| public String print(Iterable<? extends Type> ts); |
|
454 |
| |
|
455 |
| public String print(Function f); |
|
456 |
| } |
|
457 |
| |
|
458 |
| |
|
459 |
| public static abstract class FunctionInvocation { |
|
460 |
| private final Iterable<? extends Type> _typeArgs; |
|
461 |
| private final Iterable<? extends Expression> _args; |
|
462 |
| private final Iterable<? extends Type> _thrown; |
|
463 |
| |
|
464 |
821
| protected FunctionInvocation(Iterable<? extends Type> typeArgs, Iterable<? extends Expression> args,
|
|
465 |
| Iterable<? extends Type> thrown) { |
|
466 |
821
| _typeArgs = typeArgs;
|
|
467 |
821
| _args = args;
|
|
468 |
821
| _thrown = thrown;
|
|
469 |
| } |
|
470 |
| |
|
471 |
| |
|
472 |
0
| public Iterable<? extends Type> typeArgs() { return _typeArgs; }
|
|
473 |
| |
|
474 |
| |
|
475 |
| |
|
476 |
| |
|
477 |
| |
|
478 |
815
| public Iterable<? extends Expression> args() { return _args; }
|
|
479 |
| |
|
480 |
| |
|
481 |
789
| public Iterable<? extends Type> thrown() { return _thrown; }
|
|
482 |
| } |
|
483 |
| |
|
484 |
| |
|
485 |
| |
|
486 |
| public static class ConstructorInvocation extends FunctionInvocation { |
|
487 |
| private final DJConstructor _constructor; |
|
488 |
| |
|
489 |
551
| public ConstructorInvocation(DJConstructor constructor, Iterable<? extends Type> typeArgs,
|
|
490 |
| Iterable<? extends Expression> args, Iterable<? extends Type> thrown) { |
|
491 |
551
| super(typeArgs, args, thrown);
|
|
492 |
551
| _constructor = constructor;
|
|
493 |
| } |
|
494 |
| |
|
495 |
| |
|
496 |
551
| public DJConstructor constructor() { return _constructor; }
|
|
497 |
| } |
|
498 |
| |
|
499 |
| |
|
500 |
| |
|
501 |
| public static abstract class MethodInvocation extends FunctionInvocation { |
|
502 |
| private final DJMethod _method; |
|
503 |
| private final Type _returnType; |
|
504 |
| |
|
505 |
270
| protected MethodInvocation(DJMethod method, Type returnType, Iterable<? extends Type> typeArgs,
|
|
506 |
| Iterable<? extends Expression> args, Iterable<? extends Type> thrown) { |
|
507 |
270
| super(typeArgs, args, thrown);
|
|
508 |
270
| _method = method;
|
|
509 |
270
| _returnType = returnType;
|
|
510 |
| } |
|
511 |
| |
|
512 |
| |
|
513 |
502
| public DJMethod method() { return _method; }
|
|
514 |
| |
|
515 |
| |
|
516 |
270
| public Type returnType() { return _returnType; }
|
|
517 |
| |
|
518 |
| } |
|
519 |
| |
|
520 |
| |
|
521 |
| |
|
522 |
| public static class ObjectMethodInvocation extends MethodInvocation { |
|
523 |
| private final Expression _object; |
|
524 |
| |
|
525 |
97
| public ObjectMethodInvocation(DJMethod method, Type returnType, Expression object,
|
|
526 |
| Iterable<? extends Type> typeArgs, Iterable<? extends Expression> args, |
|
527 |
| Iterable<? extends Type> thrown) { |
|
528 |
97
| super(method, returnType, typeArgs, args, thrown);
|
|
529 |
97
| _object = object;
|
|
530 |
| } |
|
531 |
| |
|
532 |
| |
|
533 |
| |
|
534 |
| |
|
535 |
| |
|
536 |
91
| public Expression object() { return _object; }
|
|
537 |
| } |
|
538 |
| |
|
539 |
| |
|
540 |
| |
|
541 |
| public static class StaticMethodInvocation extends MethodInvocation { |
|
542 |
173
| public StaticMethodInvocation(DJMethod method, Type returnType, Iterable<? extends Type> typeArgs,
|
|
543 |
| Iterable<? extends Expression> args, Iterable<? extends Type> thrown) { |
|
544 |
173
| super(method, returnType, typeArgs, args, thrown);
|
|
545 |
| } |
|
546 |
| } |
|
547 |
| |
|
548 |
| |
|
549 |
| |
|
550 |
| public static abstract class FieldReference { |
|
551 |
| private final DJField _field; |
|
552 |
| private final Type _type; |
|
553 |
| |
|
554 |
432
| protected FieldReference(DJField field, Type type) {
|
|
555 |
432
| _field = field;
|
|
556 |
432
| _type = type;
|
|
557 |
| } |
|
558 |
| |
|
559 |
| |
|
560 |
426
| public DJField field() { return _field; }
|
|
561 |
| |
|
562 |
| |
|
563 |
356
| public Type type() { return _type; }
|
|
564 |
| |
|
565 |
0
| public boolean equals(Object that) {
|
|
566 |
0
| if (this == that) { return true; }
|
|
567 |
0
| else if (!(that instanceof FieldReference)) { return false; }
|
|
568 |
| else { |
|
569 |
0
| FieldReference r = (FieldReference) that;
|
|
570 |
0
| return _field.equals(r._field) && _type.equals(r._type);
|
|
571 |
| } |
|
572 |
| } |
|
573 |
| |
|
574 |
1728
| public int hashCode() { return ObjectUtil.hash(FieldReference.class, _field, _type); }
|
|
575 |
| |
|
576 |
| } |
|
577 |
| |
|
578 |
| |
|
579 |
| |
|
580 |
| public static class ObjectFieldReference extends FieldReference { |
|
581 |
| private final Expression _object; |
|
582 |
| |
|
583 |
177
| public ObjectFieldReference(DJField field, Type type, Expression object) {
|
|
584 |
177
| super(field, type);
|
|
585 |
177
| _object = object;
|
|
586 |
| } |
|
587 |
| |
|
588 |
| |
|
589 |
| |
|
590 |
| |
|
591 |
| |
|
592 |
108
| public Expression object() { return _object; }
|
|
593 |
| } |
|
594 |
| |
|
595 |
| |
|
596 |
| |
|
597 |
| public static class StaticFieldReference extends FieldReference { |
|
598 |
1
| public StaticFieldReference(DJField field, Type type) {
|
|
599 |
1
| super(field, type);
|
|
600 |
| } |
|
601 |
| } |
|
602 |
| |
|
603 |
| public static class TypeSystemException extends Exception { |
|
604 |
| } |
|
605 |
| |
|
606 |
| public static class InvalidTypeArgumentException extends TypeSystemException { |
|
607 |
| } |
|
608 |
| |
|
609 |
| public static class UnsupportedConversionException extends TypeSystemException { |
|
610 |
| } |
|
611 |
| |
|
612 |
| public static class UnmatchedLookupException extends TypeSystemException { |
|
613 |
| private final int _matches; |
|
614 |
17
| public UnmatchedLookupException(int matches) { _matches = matches; }
|
|
615 |
17
| public int matches() { return _matches; }
|
|
616 |
| } |
|
617 |
| |
|
618 |
| |
|
619 |
| public static class UnmatchedFunctionLookupException extends UnmatchedLookupException { |
|
620 |
| private final Iterable<? extends Function> _candidates; |
|
621 |
17
| public UnmatchedFunctionLookupException(Iterable<? extends Function> candidates) {
|
|
622 |
17
| super(0);
|
|
623 |
17
| _candidates = candidates;
|
|
624 |
| } |
|
625 |
17
| public Iterable<? extends Function> candidates() { return _candidates; }
|
|
626 |
| } |
|
627 |
| |
|
628 |
| |
|
629 |
| public static class AmbiguousFunctionLookupException extends UnmatchedLookupException { |
|
630 |
| private final Iterable<? extends Function> _candidates; |
|
631 |
0
| public AmbiguousFunctionLookupException(Iterable<? extends Function> candidates) {
|
|
632 |
0
| super(IterUtil.sizeOf(candidates));
|
|
633 |
0
| _candidates = candidates;
|
|
634 |
| } |
|
635 |
0
| public Iterable<? extends Function> candidates() { return _candidates; }
|
|
636 |
| } |
|
637 |
| |
|
638 |
| } |