本文整理了Java中com.sun.tools.javac.code.Types.createErrorType()
方法的一些代码示例,展示了Types.createErrorType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Types.createErrorType()
方法的具体详情如下:
包路径:com.sun.tools.javac.code.Types
类名称:Types
方法名:createErrorType
暂无
代码示例来源:origin: konsoletyper/teavm-javac
@Override
public Symbol access(Name name, TypeSymbol location) {
if ((sym.kind & ERRONEOUS) == 0 && (sym.kind & TYP) != 0)
return types.createErrorType(name, location, sym.type).tsym;
else
return sym;
}
}
代码示例来源:origin: konsoletyper/teavm-javac
/**
* Create an external representation for this erroneous symbol to be
* used during attribution - by default this returns the symbol of a
* brand new error type which stores the original type found
* during resolution.
*
* @param name the name used during resolution
* @param location the location from which the symbol is accessed
*/
protected Symbol access(Name name, TypeSymbol location) {
return types.createErrorType(name, location, syms.errSymbol.type).tsym;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/**
* Create an external representation for this erroneous symbol to be
* used during attribution - by default this returns the symbol of a
* brand new error type which stores the original type found
* during resolution.
*
* @param name the name used during resolution
* @param location the location from which the symbol is accessed
*/
protected Symbol access(Name name, TypeSymbol location) {
return types.createErrorType(name, location, syms.errSymbol.type).tsym;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
@Override
public Symbol access(Name name, TypeSymbol location) {
if ((sym.kind & ERRONEOUS) == 0 && (sym.kind & TYP) != 0)
return types.createErrorType(name, location, sym.type).tsym;
else
return sym;
}
}
代码示例来源:origin: konsoletyper/teavm-javac
@Override
public Symbol access(Name name, TypeSymbol location) {
return types.createErrorType(name, location, syms.errSymbol.type).tsym;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
@Override
public Symbol access(Name name, TypeSymbol location) {
return types.createErrorType(name, location, syms.errSymbol.type).tsym;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
@Override
protected Symbol access(Name name, TypeSymbol location) {
Symbol firstAmbiguity = ambiguousSyms.last();
return firstAmbiguity.kind == TYP ?
types.createErrorType(name, location, firstAmbiguity.type).tsym :
firstAmbiguity;
}
}
代码示例来源:origin: konsoletyper/teavm-javac
@Override
protected Symbol access(Name name, TypeSymbol location) {
Symbol firstAmbiguity = ambiguousSyms.last();
return firstAmbiguity.kind == TYP ?
types.createErrorType(name, location, firstAmbiguity.type).tsym :
firstAmbiguity;
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/** Note that we found an inheritance cycle. */
private void noteCyclic(DiagnosticPosition pos, ClassSymbol c) {
log.error(pos, "cyclic.inheritance", c);
for (List<Type> l=types.interfaces(c.type); l.nonEmpty(); l=l.tail)
l.head = types.createErrorType((ClassSymbol)l.head.tsym, Type.noType);
Type st = types.supertype(c.type);
if (st.hasTag(CLASS))
((ClassType)c.type).supertype_field = types.createErrorType((ClassSymbol)st.tsym, Type.noType);
c.type = types.createErrorType(c, c.type);
c.flags_field |= ACYCLIC;
}
代码示例来源:origin: konsoletyper/teavm-javac
/** Note that we found an inheritance cycle. */
private void noteCyclic(DiagnosticPosition pos, ClassSymbol c) {
log.error(pos, "cyclic.inheritance", c);
for (List<Type> l=types.interfaces(c.type); l.nonEmpty(); l=l.tail)
l.head = types.createErrorType((ClassSymbol)l.head.tsym, Type.noType);
Type st = types.supertype(c.type);
if (st.hasTag(CLASS))
((ClassType)c.type).supertype_field = types.createErrorType((ClassSymbol)st.tsym, Type.noType);
c.type = types.createErrorType(c, c.type);
c.flags_field |= ACYCLIC;
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/** Check that type is different from 'void'.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
Type checkNonVoid(DiagnosticPosition pos, Type t) {
if (t.hasTag(VOID)) {
log.error(pos, "void.not.allowed.here");
return types.createErrorType(t);
} else {
return t;
}
}
代码示例来源:origin: konsoletyper/teavm-javac
/** Check that type is different from 'void'.
* @param pos Position to be used for error reporting.
* @param t The type to be checked.
*/
Type checkNonVoid(DiagnosticPosition pos, Type t) {
if (t.hasTag(VOID)) {
log.error(pos, "void.not.allowed.here");
return types.createErrorType(t);
} else {
return t;
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public Type getDescriptorType(Types types) {
return targets.nonEmpty() ? types.findDescriptorType(targets.head) : types.createErrorType(null);
}
}
代码示例来源:origin: konsoletyper/teavm-javac
public Type getDescriptorType(Types types) {
return targets.nonEmpty() ? types.findDescriptorType(targets.head) : types.createErrorType(null);
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
/** Report an error that wrong type tag was found.
* @param pos Position to be used for error reporting.
* @param required An internationalized string describing the type tag
* required.
* @param found The type that was found.
*/
Type typeTagError(DiagnosticPosition pos, Object required, Object found) {
// this error used to be raised by the parser,
// but has been delayed to this point:
if (found instanceof Type && ((Type)found).hasTag(VOID)) {
log.error(pos, "illegal.start.of.type");
return syms.errType;
}
log.error(pos, "type.found.req", found, required);
return types.createErrorType(found instanceof Type ? (Type)found : syms.errType);
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
Type checkCastable(DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) {
if (types.isCastable(found, req, castWarner(pos, found, req))) {
return req;
} else {
checkContext.report(pos, diags.fragment("inconvertible.types", found, req));
return types.createErrorType(found);
}
}
代码示例来源:origin: konsoletyper/teavm-javac
Type checkCastable(DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) {
if (types.isCastable(found, req, castWarner(pos, found, req))) {
return req;
} else {
checkContext.report(pos, diags.fragment("inconvertible.types", found, req));
return types.createErrorType(found);
}
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public void visitIndexed(JCArrayAccess tree) {
Type owntype = types.createErrorType(tree.type);
Type atype = attribExpr(tree.indexed, env);
attribExpr(tree.index, env, syms.intType);
if (types.isArray(atype))
owntype = types.elemtype(atype);
else if (!atype.hasTag(ERROR))
log.error(tree.pos(), "array.req.but.found", atype);
if ((pkind() & VAR) == 0) owntype = capture(owntype);
result = check(tree, owntype, VAR, resultInfo);
}
代码示例来源:origin: konsoletyper/teavm-javac
public void visitIndexed(JCArrayAccess tree) {
Type owntype = types.createErrorType(tree.type);
Type atype = attribExpr(tree.indexed, env);
attribExpr(tree.index, env, syms.intType);
if (types.isArray(atype))
owntype = types.elemtype(atype);
else if (!atype.hasTag(ERROR))
log.error(tree.pos(), "array.req.but.found", atype);
if ((pkind() & VAR) == 0) owntype = capture(owntype);
result = check(tree, owntype, VAR, resultInfo);
}
代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-javac
public void visitTypeTest(JCInstanceOf tree) {
Type exprtype = chk.checkNullOrRefType(
tree.expr.pos(), attribExpr(tree.expr, env));
Type clazztype = attribType(tree.clazz, env);
if (!clazztype.hasTag(TYPEVAR)) {
clazztype = chk.checkClassOrArrayType(tree.clazz.pos(), clazztype);
}
if (!clazztype.isErroneous() && !types.isReifiable(clazztype)) {
log.error(tree.clazz.pos(), "illegal.generic.type.for.instof");
clazztype = types.createErrorType(clazztype);
}
chk.validate(tree.clazz, env, false);
chk.checkCastable(tree.expr.pos(), exprtype, clazztype);
result = check(tree, syms.booleanType, VAL, resultInfo);
}
内容来源于网络,如有侵权,请联系作者删除!