• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClassDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: generate

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Overridden in order to set the standardPackage flag.
 */
public void generate(
        sun.rmi.rmic.BatchEnvironment env,
        ClassDefinition cdef, File destDir) {
    ((sun.rmi.rmic.iiop.BatchEnvironment)env).
            setStandardPackage(standardPackage);
    super.generate(env, cdef, destDir);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:StubGenerator.java


示例17: getTypeCode

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
private static int getTypeCode(sun.tools.java.Type type, ClassDefinition theClass, ContextStack stack) {
    if (type.isType(TC_CLASS)) {
        Identifier id = type.getClassName();
        if (id == idJavaLangString) return TYPE_STRING;
        if (id == idJavaLangObject) return TYPE_ANY;
    }
    return TYPE_NONE;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:SpecialClassType.java


示例18: initialize

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Initialize this instance.
 */
private boolean initialize (ContextStack stack, boolean quiet) {

    boolean result = false;
    ClassDefinition theClass = getClassDefinition();

    if (initParents(stack)) {

        // Make up our collections...

        Vector directInterfaces = new Vector();
        Vector directMethods = new Vector();

        // Check interfaces...

        try {
            if (addRemoteInterfaces(directInterfaces,true,stack) != null) {

                boolean haveRemote = false;

                // Get methods from all interfaces...

                for (int i = 0; i < directInterfaces.size(); i++) {
                    InterfaceType theInt = (InterfaceType) directInterfaces.elementAt(i);
                    if (theInt.isType(TYPE_REMOTE) ||
                        theInt.isType(TYPE_JAVA_RMI_REMOTE)) {
                        haveRemote = true;
                    }

                    copyRemoteMethods(theInt,directMethods);
                }

                // Make sure we have at least one remote interface...

                if (!haveRemote) {
                    failedConstraint(8,quiet,stack,getQualifiedName());
                    return false;
                }

                // Now check the methods to ensure we have the
                // correct throws clauses...

                if (checkMethods(theClass,directMethods,stack,quiet)) {

                    // We're ok, so pass 'em up...

                    result = initialize(directInterfaces,directMethods,null,stack,quiet);
                }
            }
        } catch (ClassNotFound e) {
            classNotFound(stack,e);
        }
    }

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


示例19: InterfaceType

import sun.tools.java.ClassDefinition; //导入依赖的package包/类
/**
 * Create a InterfaceType instance for the given class.  The resulting
 * object is not yet completely initialized. Subclasses must call
 * initialize(directInterfaces,directInterfaces,directConstants);
 */
protected InterfaceType(ContextStack stack,
                        ClassDefinition classDef,
                        int typeCode) {
    super(stack,classDef,typeCode);

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


示例20: forNCInterface

import sun.tools.java.ClassDefinition; //导入依赖的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.ClassDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HTTPTransportFactory类代码示例发布时间:2022-05-21
下一篇:
Java AbstractDeclarativeValidator类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap