1134
1135 protected Copier createCopier(TreeMaker maker) {
1136 return new Copier(maker);
1137 }
1138
1139 /**
1140 * Returns the original type from the ErrorType object.
1141 * @param errorType The errorType for which we want to get the original type.
1142 * @return TypeMirror corresponding to the original type, replaced by the ErrorType.
1143 * noType (type.tag == NONE) is returned if there is no original type.
1144 */
1145 @Override @DefinedBy(Api.COMPILER_TREE)
1146 public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
1147 if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType targetErrorType) {
1148 return targetErrorType.getOriginalType();
1149 }
1150 if (errorType instanceof com.sun.tools.javac.code.Type.ClassType classType &&
1151 errorType.getKind() == TypeKind.ERROR) {
1152 return extraType2OriginalMap.computeIfAbsent(classType, tt ->
1153 new ClassType(classType.getEnclosingType(), classType.typarams_field,
1154 classType.tsym, classType.getMetadata()) {
1155 @Override
1156 public Type baseType() { return classType; }
1157 @Override
1158 public TypeKind getKind() {
1159 return TypeKind.DECLARED;
1160 }
1161 });
1162 }
1163
1164 return com.sun.tools.javac.code.Type.noType;
1165 }
1166
1167 /**
1168 * Prints a message of the specified kind at the location of the
1169 * tree within the provided compilation unit
1170 *
1171 * @param kind the kind of message
1172 * @param msg the message, or an empty string if none
1173 * @param t the tree to use as a position hint
1174 * @param root the compilation unit that contains tree
|
1134
1135 protected Copier createCopier(TreeMaker maker) {
1136 return new Copier(maker);
1137 }
1138
1139 /**
1140 * Returns the original type from the ErrorType object.
1141 * @param errorType The errorType for which we want to get the original type.
1142 * @return TypeMirror corresponding to the original type, replaced by the ErrorType.
1143 * noType (type.tag == NONE) is returned if there is no original type.
1144 */
1145 @Override @DefinedBy(Api.COMPILER_TREE)
1146 public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
1147 if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType targetErrorType) {
1148 return targetErrorType.getOriginalType();
1149 }
1150 if (errorType instanceof com.sun.tools.javac.code.Type.ClassType classType &&
1151 errorType.getKind() == TypeKind.ERROR) {
1152 return extraType2OriginalMap.computeIfAbsent(classType, tt ->
1153 new ClassType(classType.getEnclosingType(), classType.typarams_field,
1154 classType.tsym, classType.getMetadata(), classType.getFlavor()) {
1155 @Override
1156 public Type baseType() { return classType; }
1157 @Override
1158 public TypeKind getKind() {
1159 return TypeKind.DECLARED;
1160 }
1161 });
1162 }
1163
1164 return com.sun.tools.javac.code.Type.noType;
1165 }
1166
1167 /**
1168 * Prints a message of the specified kind at the location of the
1169 * tree within the provided compilation unit
1170 *
1171 * @param kind the kind of message
1172 * @param msg the message, or an empty string if none
1173 * @param t the tree to use as a position hint
1174 * @param root the compilation unit that contains tree
|