本文整理汇总了Java中com.sun.tools.javac.code.Type.ErrorType类的典型用法代码示例。如果您正苦于以下问题:Java ErrorType类的具体用法?Java ErrorType怎么用?Java ErrorType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorType类属于com.sun.tools.javac.code.Type包,在下文中一共展示了ErrorType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Type
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
public ExpressionTree Type(TypeMirror type) {
Type t = (Type) type;
JCExpression tp;
switch (type.getKind()) {
case WILDCARD: {
WildcardType a = ((WildcardType) type);
tp = make.at(NOPOS).Wildcard(make.at(NOPOS).TypeBoundKind(a.kind), (JCExpression) Type(a.type));
break;
}
case DECLARED:
JCExpression clazz = (JCExpression) QualIdent(t.tsym);
tp = t.getTypeArguments().isEmpty()
? clazz
: make.at(NOPOS).TypeApply(clazz, Types(t.getTypeArguments()));
break;
case ARRAY:
tp = make.at(NOPOS).TypeArray((JCExpression) Type(((ArrayType) type).getComponentType()));
break;
case NULL:
tp = make.at(NOPOS).Literal(TypeTag.BOT, null);
break;
case ERROR:
tp = make.at(NOPOS).Ident(((ErrorType) type).tsym.name);
break;
default:
return make.at(NOPOS).Type((Type)type);
}
return tp.setType(t);
}
示例2: getOriginalType
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
/**
* Gets the original type from the ErrorType object.
* @param errorType The errorType for which we want to get the original type.
* @returns TypeMirror corresponding to the original type, replaced by the ErrorType.
* noType (type.tag == NONE) is returned if there is no original type.
*/
public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType) {
return ((com.sun.tools.javac.code.Type.ErrorType)errorType).getOriginalType();
}
return com.sun.tools.javac.code.Type.noType;
}
示例3: getOriginalType
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
/**
* Returns the original type from the ErrorType object.
* @param errorType The errorType for which we want to get the original type.
* @return TypeMirror corresponding to the original type, replaced by the ErrorType.
* noType (type.tag == NONE) is returned if there is no original type.
*/
@Override @DefinedBy(Api.COMPILER_TREE)
public TypeMirror getOriginalType(javax.lang.model.type.ErrorType errorType) {
if (errorType instanceof com.sun.tools.javac.code.Type.ErrorType) {
return ((com.sun.tools.javac.code.Type.ErrorType)errorType).getOriginalType();
}
return com.sun.tools.javac.code.Type.noType;
}
示例4: handleMethodCall
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
private void handleMethodCall(final JCMethodInvocation methodCall) {
JavacNode methodCallNode = annotationNode.getAst().get(methodCall);
if (methodCallNode == null) {
// This should mean the node does not exist in the source at all. This is the case for generated nodes, such as implicit super() calls.
return;
}
JavacNode surroundingType = upToTypeNode(methodCallNode);
TypeSymbol surroundingTypeSymbol = ((JCClassDecl)surroundingType.get()).sym;
JCExpression receiver = receiverOf(methodCall);
String methodName = methodNameOf(methodCall);
if ("this".equals(methodName) || "super".equals(methodName)) return;
Type resolvedMethodCall = CLASS_AND_METHOD.resolveMember(methodCallNode, methodCall);
if (resolvedMethodCall == null) return;
if (!suppressBaseMethods && !(resolvedMethodCall instanceof ErrorType)) return;
Type receiverType = CLASS_AND_METHOD.resolveMember(methodCallNode, receiver);
if (receiverType == null) return;
if (receiverType.tsym.toString().endsWith(receiver.toString())) return;
Types types = Types.instance(annotationNode.getContext());
for (Extension extension : extensions) {
TypeSymbol extensionProvider = extension.extensionProvider;
if (surroundingTypeSymbol == extensionProvider) continue;
for (MethodSymbol extensionMethod : extension.extensionMethods) {
if (!methodName.equals(extensionMethod.name.toString())) continue;
Type extensionMethodType = extensionMethod.type;
if (!MethodType.class.isInstance(extensionMethodType) && !ForAll.class.isInstance(extensionMethodType)) continue;
Type firstArgType = types.erasure(extensionMethodType.asMethodType().argtypes.get(0));
if (!types.isAssignable(receiverType, firstArgType)) continue;
methodCall.args = methodCall.args.prepend(receiver);
methodCall.meth = chainDotsString(annotationNode, extensionProvider.toString() + "." + methodName);
return;
}
}
}
示例5: modelMissingTypes
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
Type modelMissingTypes(Type t, final JCExpression tree, final boolean interfaceExpected) {
if (t.tag != ERROR)
return t;
return new ErrorType(((ErrorType) t).getOriginalType(), t.tsym) {
private Type modelType;
@Override
public Type getModelType() {
if (modelType == null)
modelType = new Synthesizer(getOriginalType(), interfaceExpected).visit(tree);
return modelType;
}
};
}
示例6: synthesizeClass
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
ClassSymbol synthesizeClass(Name name, Symbol owner) {
int flags = interfaceExpected ? INTERFACE : 0;
ClassSymbol c = new ClassSymbol(flags, name, owner);
c.members_field = new Scope.ErrorScope(c);
c.type = new ErrorType(originalType, c) {
@Override
public List<Type> getTypeArguments() {
return typarams_field;
}
};
synthesizedSymbols = synthesizedSymbols.prepend(c);
return c;
}
示例7: visitErrorType
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
@Override
public String visitErrorType(ErrorType t, Locale locale) {
return visitType(t, locale);
}
示例8: visitErrorType
import com.sun.tools.javac.code.Type.ErrorType; //导入依赖的package包/类
@Override
public Boolean visitErrorType(ErrorType t, Type s) {
return s.hasTag(CLASS)
&& t.tsym.name == ((ClassType) s).tsym.name;
}