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


Java ClassDefinition.getName方法代码示例

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


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

示例1: CompoundType

import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
 * Create a CompoundType instance for the given class.  The resulting
 * object is not yet completely initialized.
 */
protected CompoundType(ContextStack stack, ClassDefinition classDef,
                       int typeCode) {
    super(stack,typeCode);
    this.classDef = classDef;
    classDecl = classDef.getClassDeclaration();

    // If we are an inner class/interface, reset the type codes...

    if (classDef.isInnerClass()) {
        setTypeCode(typeCode | TM_INNER);
    }

    // Set special flags...

    setFlags();

    // Set names...

    Identifier id = classDef.getName();
    String idlName;
    String[] idlModuleNames;

    try {

        // These can fail if we get case-sensitive name matches...

        idlName = IDLNames.getClassOrInterfaceName(id,env);
        idlModuleNames = IDLNames.getModuleNames(id,isBoxed(),env);

        setNames(id,idlModuleNames,idlName);

        // Is this an exception?

        if (isException()) {

            // Yes, so set our mangled exception names...

            isException = true;
            idlExceptionName = IDLNames.getExceptionName(getIDLName());
            qualifiedIDLExceptionName =
                IDLNames.getQualifiedName(getIDLModuleNames(),idlExceptionName);
        }

        // Set interfaces, methods and members...

        interfaces = null;          // set in initialize()
        methods = null;                     // set in initialize()
        members = null;                 // set in initialize()

    } catch (Exception e) {
        failedConstraint(7,false,stack,id.toString(),e.getMessage());
        throw new CompilerError("");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:CompoundType.java

示例2: getMethodExceptions

import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
protected ValueType[] getMethodExceptions (MemberDefinition member,
                                           boolean quiet,
                                           ContextStack stack) throws Exception {

    boolean result = true;
    stack.setNewContextCode(ContextStack.METHOD_EXCEPTION);
    ClassDeclaration[] except = member.getExceptions(env);
    ValueType[] exceptions = new ValueType[except.length];

    try {
        for (int i = 0; i < except.length; i++) {
            ClassDefinition theClass = except[i].getClassDefinition(env);
            try {
                ValueType type = ValueType.forValue(theClass,stack,false);
                if (type != null) {
                        exceptions[i] = type;
                    } else {
                        result = false;
                    }
            } catch (ClassCastException e1) {
                failedConstraint(22,quiet,stack,getQualifiedName());
                throw new CompilerError("Method: exception " + theClass.getName() + " not a class type!");
            } catch (NullPointerException e2) {
                failedConstraint(23,quiet,stack,getQualifiedName());
                throw new CompilerError("Method: caught null pointer exception");
            }
        }
    } catch (ClassNotFound e) {
        classNotFound(quiet,stack,e);
        result = false;
    }

    if (!result) {
        throw new Exception();
    }

    // Remove any duplicates (javac seems to allow them, but rmic will
    // generate bad ties)...

    int dupCount = 0;
    for (int i = 0; i < exceptions.length; i++) {
        for (int j = 0; j < exceptions.length; j++) {
            if (i != j && exceptions[i] != null && exceptions[i] == exceptions[j]) {
                exceptions[j] = null;
                dupCount++;
            }
        }
    }
    if (dupCount > 0) {
        int offset = 0;
        ValueType[] temp = new ValueType[exceptions.length - dupCount];
        for (int i = 0; i < exceptions.length; i++) {
            if (exceptions[i] != null) {
                temp[offset++] = exceptions[i];
            }
        }
        exceptions = temp;
    }

    return exceptions;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:62,代码来源:CompoundType.java

示例3: SpecialClassType

import sun.tools.java.ClassDefinition; //导入方法依赖的package包/类
/**
 * Create an SpecialClassType instance for the given class.
 */
private SpecialClassType(ContextStack stack, int typeCode,
                         ClassDefinition theClass) {
    super(stack,typeCode | TM_SPECIAL_CLASS | TM_CLASS | TM_COMPOUND, theClass);
    Identifier id = theClass.getName();
    String idlName = null;
    String[] idlModuleName = null;
    boolean constant = stack.size() > 0 && stack.getContext().isConstant();

    // Set names...

    switch (typeCode) {
    case TYPE_STRING:   {
        idlName = IDLNames.getTypeName(typeCode,constant);
        if (!constant) {
            idlModuleName = IDL_CORBA_MODULE;
        }
        break;
    }

    case TYPE_ANY:   {
        idlName = IDL_JAVA_LANG_OBJECT;
        idlModuleName = IDL_JAVA_LANG_MODULE;
        break;
    }
    }

    setNames(id,idlModuleName,idlName);

    // Init parents...

    if (!initParents(stack)) {

        // Should not be possible!

        throw new CompilerError("SpecialClassType found invalid parent.");
    }

    // Initialize CompoundType...

    initialize(null,null,null,stack,false);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:SpecialClassType.java


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