当前位置: 首页>>代码示例>>Java>>正文


Java CompilerError类代码示例

本文整理汇总了Java中sun.tools.java.CompilerError的典型用法代码示例。如果您正苦于以下问题:Java CompilerError类的具体用法?Java CompilerError怎么用?Java CompilerError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompilerError类属于sun.tools.java包,在下文中一共展示了CompilerError类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initParents

import sun.tools.java.CompilerError; //导入依赖的package包/类
protected boolean initParents(ContextStack stack) {

        stack.setNewContextCode(ContextStack.EXTENDS);
        BatchEnvironment env = stack.getEnv();

        // Init parent...

        boolean result = true;

        try {
            ClassDeclaration parentDecl = getClassDefinition().getSuperClass(env);
            if (parentDecl != null) {
                ClassDefinition parentDef = parentDecl.getClassDefinition(env);
                parent = (ClassType) makeType(parentDef.getType(),parentDef,stack);
                if (parent == null) {
                    result = false;
                }
            }
        } catch (ClassNotFound e) {
            classNotFound(stack,e);
            throw new CompilerError("ClassType constructor");
        }

        return result;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:ClassType.java

示例2: PrimitiveType

import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
 * IDL_Naming
 * Create an PrimitiveType instance for the given class.
 */
private PrimitiveType(ContextStack stack, int typeCode) {
    super(stack,typeCode | TM_PRIMITIVE);

    // Validate type and set names...

    String idlName = IDLNames.getTypeName(typeCode,false);
    Identifier id = null;

    switch (typeCode) {
    case TYPE_VOID:         id = idVoid; break;
    case TYPE_BOOLEAN:      id = idBoolean; break;
    case TYPE_BYTE:         id = idByte; break;
    case TYPE_CHAR:         id = idChar; break;
    case TYPE_SHORT:        id = idShort; break;
    case TYPE_INT:          id = idInt; break;
    case TYPE_LONG:         id = idLong; break;
    case TYPE_FLOAT:        id = idFloat; break;
    case TYPE_DOUBLE:       id = idDouble; break;
    default:            throw new CompilerError("Not a primitive type");
    }

    setNames(id,null,idlName);
    setRepositoryID();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:PrimitiveType.java

示例3: ClassType

import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
 * Create a ClassType instance for the given class. NOTE: This constructor
 * is ONLY for SpecialClassType.
 */
protected ClassType(ContextStack stack, int typeCode, ClassDefinition classDef) {
    super(stack,typeCode,classDef); // Call special parent constructor.
    if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) {
        throw new CompilerError("Not a class");
    }
    parent = null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ClassType.java

示例4: pop

import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
 * Pop an element from the stack.
 * @return the new current element or null if top.
 */
public TypeContext pop (boolean wasValid) {

    if (currentIndex < 0) {
        throw new CompilerError("Nothing on stack!");
    }

    newCode = stack[currentIndex].getCode();
    traceln(toResultString(stack[currentIndex],wasValid,false));

    Type last = stack[currentIndex].getCandidateType();
    if (last != null) {

        // Set status...

        if (wasValid) {
            last.setStatus(Constants.STATUS_VALID);
        } else {
            last.setStatus(Constants.STATUS_INVALID);
        }
    }

    currentIndex--;

    if (currentIndex < 0) {

        // Done parsing, so update the invalid types
        // if this type was valid...

        if (wasValid) {
            Type.updateAllInvalidTypes(this);
        }
        return null;
    } else {
        return stack[currentIndex];
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:ContextStack.java

示例5: InterfaceType

import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
 * Create a InterfaceType instance for the given class. NOTE: This constructor
 * is ONLY for SpecialInterfaceType.
 */
protected InterfaceType(ContextStack stack, int typeCode, ClassDefinition classDef) {
    super(stack,typeCode,classDef); // Call special parent constructor.

    if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) {
        throw new CompilerError("Not an interface");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:InterfaceType.java

示例6: loadClass

import sun.tools.java.CompilerError; //导入依赖的package包/类
protected Class loadClass() {
    switch (getTypeCode()) {
    case TYPE_VOID:         return Null.class;
    case TYPE_BOOLEAN:      return boolean.class;
    case TYPE_BYTE:         return byte.class;
    case TYPE_CHAR:         return char.class;
    case TYPE_SHORT:        return short.class;
    case TYPE_INT:          return int.class;
    case TYPE_LONG:         return long.class;
    case TYPE_FLOAT:        return float.class;
    case TYPE_DOUBLE:       return double.class;
    default:            throw new CompilerError("Not a primitive type");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:PrimitiveType.java

示例7: forNCInterface

import sun.tools.java.CompilerError; //导入依赖的package包/类
/**
 * Create an NCInterfaceType for the given class.
 *
 * If the class is not a properly formed or if some other error occurs, the
 * return value will be null, and errors will have been reported to the
 * supplied BatchEnvironment.
 */
public static NCInterfaceType forNCInterface( ClassDefinition classDef,
                                              ContextStack stack) {
    if (stack.anyErrors()) return null;

    boolean doPop = false;
    try {
        // Do we already have it?

        sun.tools.java.Type theType = classDef.getType();
        Type existing = getType(theType,stack);

        if (existing != null) {

            if (!(existing instanceof NCInterfaceType)) return null; // False hit.

                            // Yep, so return it...

            return (NCInterfaceType) existing;
        }

        NCInterfaceType it = new NCInterfaceType(stack, classDef);
        putType(theType,it,stack);
        stack.push(it);
        doPop = true;

        if (it.initialize(stack)) {
            stack.pop(true);
            return it;
        } else {
            removeType(theType,stack);
            stack.pop(false);
            return null;
        }
    } catch (CompilerError e) {
        if (doPop) stack.pop(false);
        return null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:NCInterfaceType.java


注:本文中的sun.tools.java.CompilerError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。