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


Java ClassDefinition类代码示例

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


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

示例1: CompoundType

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Create a CompoundType instance for the given class. NOTE: This constructor
 * is ONLY for SpecialClassType and SpecialInterfaceType.
 */
protected CompoundType(ContextStack stack, int typeCode, ClassDefinition classDef) {
    super(stack,typeCode);
    this.classDef = classDef;
    classDecl = classDef.getClassDeclaration();
    interfaces = new InterfaceType[0];
    methods = new Method[0];
    members = new Member[0];

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

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

    // Set special flags...

    setFlags();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:CompoundType.java

示例2: checkMethods

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
private boolean checkMethods(ClassDefinition theClass, Vector list,
                             ContextStack stack, boolean quiet) {

    // Convert vector to array...

    Method[] methods = new Method[list.size()];
    list.copyInto(methods);

    for (MemberDefinition member = theClass.getFirstMember();
         member != null;
         member = member.getNextMember()) {

        if (member.isMethod() && !member.isConstructor()
            && !member.isInitializer()) {

            // It's a method...

            if (!updateExceptions(member,methods,stack,quiet)) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ImplementationType.java

示例3: inheritsFrom

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
protected boolean inheritsFrom(ClassDefinition def, ClassDefinition otherDef) {
    if (def == otherDef)
        return true;

    ClassDefinition superDef;
    if (def.getSuperClass() != null) {
        superDef = def.getSuperClass().getClassDefinition();
        if (inheritsFrom(superDef, otherDef))
            return true;
    }

    ClassDeclaration[] interfaces = def.getInterfaces();
    for (int i=0; i<interfaces.length; i++) {
        superDef = interfaces[i].getClassDefinition();
        if (inheritsFrom(superDef, otherDef))
            return true;
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:CompoundType.java

示例4: collectCompatibleExceptions

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Add to the supplied list all exceptions in the "from" array
 * that are subclasses of an exception in the "with" array.
 */
private void collectCompatibleExceptions(
        ValueType[] from, ValueType[] with, Vector list)
        throws ClassNotFound {

    for (int i = 0; i < from.length; i++) {
        ClassDefinition exceptionDef = from[i].getClassDefinition();
        if (!list.contains(from[i])) {
            for (int j = 0; j < with.length; j++) {
                if (exceptionDef.subClassOf(
                        enclosing.getEnv(),
                        with[j].getClassDeclaration())) {
                    list.addElement(from[i]);
                    break;
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:CompoundType.java

示例5: isSpecial

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
private static boolean isSpecial(sun.tools.java.Type type,
                                 ClassDefinition theClass,
                                 ContextStack stack) {
    if (type.isType(TC_CLASS)) {
        Identifier id = type.getClassName();

        if (id.equals(idRemote)) return true;
        if (id == idJavaIoSerializable) return true;
        if (id == idJavaIoExternalizable) return true;
        if (id == idCorbaObject) return true;
        if (id == idIDLEntity) return true;
        BatchEnvironment env = stack.getEnv();
        try {
            if (env.defCorbaObject.implementedBy(env,theClass.getClassDeclaration())) return true;
        } catch (ClassNotFound e) {
            classNotFound(stack,e);
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:SpecialInterfaceType.java

示例6: couldBeRemote

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
private static boolean couldBeRemote (boolean quiet, ContextStack stack,
                                      ClassDefinition classDef) {

    boolean result = false;
    BatchEnvironment env = stack.getEnv();

    try {
        if (!classDef.isInterface()) {
            failedConstraint(16,quiet,stack,classDef.getName());
        } else {
            result = env.defRemote.implementedBy(env,classDef.getClassDeclaration());
            if (!result) failedConstraint(1,quiet,stack,classDef.getName());
        }
    } catch (ClassNotFound e) {
        classNotFound(stack,e);
    }

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

示例7: couldBeAbstract

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
private static boolean couldBeAbstract(ContextStack stack, ClassDefinition classDef,
                                       boolean quiet) {

    // Return true if interface and not remote...

    boolean result = false;

    if (classDef.isInterface()) {
        BatchEnvironment env = stack.getEnv();

        try {
            result = ! env.defRemote.implementedBy(env, classDef.getClassDeclaration());
            if (!result) failedConstraint(15,quiet,stack,classDef.getName());
        } catch (ClassNotFound e) {
            classNotFound(stack,e);
        }
    } else {
        failedConstraint(14,quiet,stack,classDef.getName());
    }


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

示例8: couldBeImplementation

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
private static boolean couldBeImplementation(boolean quiet, ContextStack stack,
                                             ClassDefinition classDef) {
    boolean result = false;
    BatchEnvironment env = stack.getEnv();

    try {
        if (!classDef.isClass()) {
            failedConstraint(17,quiet,stack,classDef.getName());
        } else {
            result = env.defRemote.implementedBy(env, classDef.getClassDeclaration());
            if (!result) failedConstraint(8,quiet,stack,classDef.getName());
        }
    } catch (ClassNotFound e) {
        classNotFound(stack,e);
    }

    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ImplementationType.java

示例9: collectCompatibleExceptions

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Add to the supplied list all exceptions in the "from" array
 * that are subclasses of an exception in the "with" array.
 */
private void collectCompatibleExceptions(ClassDeclaration[] from,
                                         ClassDeclaration[] with,
                                         Vector<ClassDeclaration> list)
    throws ClassNotFound
{
    for (int i = 0; i < from.length; i++) {
        ClassDefinition exceptionDef = from[i].getClassDefinition(env);
        if (!list.contains(from[i])) {
            for (int j = 0; j < with.length; j++) {
                if (exceptionDef.subClassOf(env, with[j])) {
                    list.addElement(from[i]);
                    break;
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:RemoteClass.java

示例10: initParents

import sun.tools.java.ClassDefinition; //导入依赖的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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:ClassType.java

示例11: ClassType

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Create a ClassType instance for the given class. NOTE: This constructor
 * is ONLY for ImplementationType. It does not walk the parent chain.
 */
protected ClassType(int typeCode, ClassDefinition classDef,ContextStack stack) {
    super(stack,classDef,typeCode);

    if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) {
        throw new CompilerError("Not a class");
    }
    parent = null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ClassType.java

示例12: computeUniqueCatchList

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Compute the exceptions which need to be caught and rethrown in a
 * stub method before wrapping Exceptions in UnexpectedExceptions,
 * given the exceptions declared in the throws clause of the method.
 * Returns a Vector containing ClassDefinition objects for each
 * exception to catch.  Each exception is guaranteed to be unique,
 * i.e. not a subclass of any of the other exceptions in the Vector,
 * so the catch blocks for these exceptions may be generated in any
 * order relative to each other.
 *
 * RemoteException and RuntimeException are each automatically placed
 * in the returned Vector (if none of their superclasses are already
 * present), since those exceptions should always be directly rethrown
 * by a stub method.
 *
 * The returned Vector will be empty if java.lang.Exception or one
 * of its superclasses is in the throws clause of the method, indicating
 * that no exceptions need to be caught.
 */
private Vector<ClassDefinition> computeUniqueCatchList(ClassDeclaration[] exceptions) {
    Vector<ClassDefinition> uniqueList = new Vector<>();       // unique exceptions to catch

    uniqueList.addElement(defRuntimeException);
    uniqueList.addElement(defRemoteException);

    /* For each exception declared by the stub method's throws clause: */
nextException:
    for (int i = 0; i < exceptions.length; i++) {
        ClassDeclaration decl = exceptions[i];
        try {
            if (defException.subClassOf(env, decl)) {
                /*
                 * (If java.lang.Exception (or a superclass) was declared
                 * in the throws clause of this stub method, then we don't
                 * have to bother catching anything; clear the list and
                 * return.)
                 */
                uniqueList.clear();
                break;
            } else if (!defException.superClassOf(env, decl)) {
                /*
                 * Ignore other Throwables that do not extend Exception,
                 * since they do not need to be caught anyway.
                 */
                continue;
            }
            /*
             * Compare this exception against the current list of
             * exceptions that need to be caught:
             */
            for (int j = 0; j < uniqueList.size();) {
                ClassDefinition def = uniqueList.elementAt(j);
                if (def.superClassOf(env, decl)) {
                    /*
                     * If a superclass of this exception is already on
                     * the list to catch, then ignore and continue;
                     */
                    continue nextException;
                } else if (def.subClassOf(env, decl)) {
                    /*
                     * If a subclass of this exception is on the list
                     * to catch, then remove it.
                     */
                    uniqueList.removeElementAt(j);
                } else {
                    j++;    // else continue comparing
                }
            }
            /* This exception is unique: add it to the list to catch. */
            uniqueList.addElement(decl.getClassDefinition(env));
        } catch (ClassNotFound e) {
            env.error(0, "class.not.found", e.name, decl.getName());
            /*
             * REMIND: We do not exit from this exceptional condition,
             * generating questionable code and likely letting the
             * compiler report a resulting error later.
             */
        }
    }
    return uniqueList;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:82,代码来源:RMIGenerator.java

示例13: forClass

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Create a RemoteClass object representing the remote meta-information
 * of the given class.
 *
 * Returns true if successful.  If the class is not a properly formed
 * remote implementation class or if some other error occurs, the
 * return value will be null, and errors will have been reported to
 * the supplied BatchEnvironment.
 */
public static RemoteClass forClass(BatchEnvironment env,
                                   ClassDefinition implClassDef)
{
    RemoteClass rc = new RemoteClass(env, implClassDef);
    if (rc.initialize()) {
        return rc;
    } else {
        return null;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:RemoteClass.java

示例14: ValueType

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Create a ValueType instance for the given class.  The resulting
 * object is not yet completely initialized.
 */
private ValueType(ClassDefinition classDef,
                  ContextStack stack,
                  boolean isMappedJavaLangClass) {
    super(stack,classDef,TYPE_VALUE | TM_CLASS | TM_COMPOUND);
    isCustom = false;

    // If this is the mapped version of java.lang.Class,
    // set the non-IDL names back to java.lang.Class...

    if (isMappedJavaLangClass) {
        setNames(idJavaLangClass,IDL_CLASS_MODULE,IDL_CLASS);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:ValueType.java

示例15: couldBeValue

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Initialize this instance.
 */

private static boolean couldBeValue(ContextStack stack, ClassDefinition classDef) {

    boolean result = false;
    ClassDeclaration classDecl = classDef.getClassDeclaration();
    BatchEnvironment env = stack.getEnv();

    try {
        // Make sure it's not remote...

        if (env.defRemote.implementedBy(env, classDecl)) {
            failedConstraint(10,false,stack,classDef.getName());
        } else {

            // Make sure it's Serializable...

            if (!env.defSerializable.implementedBy(env, classDecl)) {
                failedConstraint(11,false,stack,classDef.getName());
            } else {
                result = true;
            }
        }
    } catch (ClassNotFound e) {
        classNotFound(stack,e);
    }

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


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