src/share/classes/com/sun/tools/javac/code/Type.java

changeset 880
0c24826853b2
parent 828
19c900c703c6
child 904
4baab658f357
equal deleted inserted replaced
879:846d6644bb70 880:0c24826853b2
268 public Type getReturnType() { return null; } 268 public Type getReturnType() { return null; }
269 public List<Type> getThrownTypes() { return List.nil(); } 269 public List<Type> getThrownTypes() { return List.nil(); }
270 public Type getUpperBound() { return null; } 270 public Type getUpperBound() { return null; }
271 public Type getLowerBound() { return null; } 271 public Type getLowerBound() { return null; }
272 272
273 public void setThrown(List<Type> ts) {
274 throw new AssertionError();
275 }
276
277 /** Navigation methods, these will work for classes, type variables, 273 /** Navigation methods, these will work for classes, type variables,
278 * foralls, but will return null for arrays and methods. 274 * foralls, but will return null for arrays and methods.
279 */ 275 */
280 276
281 /** Return all parameters of this type and all its outer types in order 277 /** Return all parameters of this type and all its outer types in order
385 public MethodType asMethodType() { throw new AssertionError(); } 381 public MethodType asMethodType() { throw new AssertionError(); }
386 382
387 /** Complete loading all classes in this type. 383 /** Complete loading all classes in this type.
388 */ 384 */
389 public void complete() {} 385 public void complete() {}
390
391 public Object clone() {
392 try {
393 return super.clone();
394 } catch (CloneNotSupportedException e) {
395 throw new AssertionError(e);
396 }
397 }
398 386
399 public TypeSymbol asElement() { 387 public TypeSymbol asElement() {
400 return tsym; 388 return tsym;
401 } 389 }
402 390
815 public <R, P> R accept(TypeVisitor<R, P> v, P p) { 803 public <R, P> R accept(TypeVisitor<R, P> v, P p) {
816 return v.visitArray(this, p); 804 return v.visitArray(this, p);
817 } 805 }
818 } 806 }
819 807
820 public static class MethodType extends Type 808 public static class MethodType extends Type implements ExecutableType {
821 implements Cloneable, ExecutableType {
822 809
823 public List<Type> argtypes; 810 public List<Type> argtypes;
824 public Type restype; 811 public Type restype;
825 public List<Type> thrown; 812 public List<Type> thrown;
826 813
878 865
879 public List<Type> getParameterTypes() { return argtypes; } 866 public List<Type> getParameterTypes() { return argtypes; }
880 public Type getReturnType() { return restype; } 867 public Type getReturnType() { return restype; }
881 public List<Type> getThrownTypes() { return thrown; } 868 public List<Type> getThrownTypes() { return thrown; }
882 869
883 public void setThrown(List<Type> t) {
884 thrown = t;
885 }
886
887 public boolean isErroneous() { 870 public boolean isErroneous() {
888 return 871 return
889 isErroneous(argtypes) || 872 isErroneous(argtypes) ||
890 restype != null && restype.isErroneous(); 873 restype != null && restype.isErroneous();
891 } 874 }
1066 public List<Type> getParameterTypes() { return qtype.getParameterTypes(); } 1049 public List<Type> getParameterTypes() { return qtype.getParameterTypes(); }
1067 public Type getReturnType() { return qtype.getReturnType(); } 1050 public Type getReturnType() { return qtype.getReturnType(); }
1068 public List<Type> getThrownTypes() { return qtype.getThrownTypes(); } 1051 public List<Type> getThrownTypes() { return qtype.getThrownTypes(); }
1069 public List<Type> allparams() { return qtype.allparams(); } 1052 public List<Type> allparams() { return qtype.allparams(); }
1070 public Type getUpperBound() { return qtype.getUpperBound(); } 1053 public Type getUpperBound() { return qtype.getUpperBound(); }
1071 public Object clone() { DelegatedType t = (DelegatedType)super.clone(); t.qtype = (Type)qtype.clone(); return t; }
1072 public boolean isErroneous() { return qtype.isErroneous(); } 1054 public boolean isErroneous() { return qtype.isErroneous(); }
1073 } 1055 }
1074 1056
1075 public static class ForAll extends DelegatedType 1057 public static class ForAll extends DelegatedType implements ExecutableType {
1076 implements Cloneable, ExecutableType {
1077 public List<Type> tvars; 1058 public List<Type> tvars;
1078 1059
1079 public ForAll(List<Type> tvars, Type qtype) { 1060 public ForAll(List<Type> tvars, Type qtype) {
1080 super(FORALL, qtype); 1061 super(FORALL, qtype);
1081 this.tvars = tvars; 1062 this.tvars = tvars;
1089 public String toString() { 1070 public String toString() {
1090 return "<" + tvars + ">" + qtype; 1071 return "<" + tvars + ">" + qtype;
1091 } 1072 }
1092 1073
1093 public List<Type> getTypeArguments() { return tvars; } 1074 public List<Type> getTypeArguments() { return tvars; }
1094
1095 public void setThrown(List<Type> t) {
1096 qtype.setThrown(t);
1097 }
1098
1099 public Object clone() {
1100 ForAll result = (ForAll)super.clone();
1101 result.qtype = (Type)result.qtype.clone();
1102 return result;
1103 }
1104 1075
1105 public boolean isErroneous() { 1076 public boolean isErroneous() {
1106 return qtype.isErroneous(); 1077 return qtype.isErroneous();
1107 } 1078 }
1108 1079

mercurial