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


Java ClassDeclaration.getClassDefinition方法代码示例

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


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

示例1: initParents

import sun.tools.java.ClassDeclaration; //导入方法依赖的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: exerciseClassDefinition

import sun.tools.java.ClassDeclaration; //导入方法依赖的package包/类
/**
 * Failure is seen when getClassDefinition causes class read
 */
void exerciseClassDefinition() throws Exception {
    BatchEnvironment env = new BatchEnvironment(System.out,
            BatchEnvironment.createClassPath(testClassPath, null, null),
            null);
    try {
        ClassDeclaration decl = env.getClassDeclaration(
                Identifier.lookup(testClassName));
        decl.getClassDefinition(env);
    } finally {
        env.flushErrors();
        env.shutdown();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:CFCTest.java

示例3: updateParentClassMethods

import sun.tools.java.ClassDeclaration; //导入方法依赖的package包/类
protected Vector updateParentClassMethods(ClassDefinition current,
                                          Vector currentMethods,
                                          boolean quiet,
                                          ContextStack stack)
    throws ClassNotFound {

    ClassDeclaration parentDecl = current.getSuperClass(env);

    while (parentDecl != null) {

        ClassDefinition parentDef = parentDecl.getClassDefinition(env);
        Identifier currentID = parentDecl.getName();

        if ( currentID == idJavaLangObject ) break;

        // Walk all members of this class and update any that
        // already exist in currentMethods...

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

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

                // It's a method.  Is it valid?

                Method method;
                try {
                    method = new Method((CompoundType)this,member,quiet,stack);
                } catch (Exception e) {
                    // Don't report anything here, it's already been reported...
                    return null;
                }

                // Have we already seen it?

                int index = currentMethods.indexOf(method);
                if (index >= 0) {

                    // Yes, so update it...

                    Method currentMethod = (Method)currentMethods.elementAt(index);
                    currentMethod.setDeclaredBy(currentID);
                }
                else currentMethods.addElement(method);
            }
        }

        // Update parent and keep walking up the chain...

        parentDecl = parentDef.getSuperClass(env);
    }

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

示例4: exerciseClassDefinition

import sun.tools.java.ClassDeclaration; //导入方法依赖的package包/类
/**
 * Failure is seen when getClassDefinition causes class read
 */
void exerciseClassDefinition() throws Exception {
    BatchEnvironment env = new BatchEnvironment(System.out,
            BatchEnvironment.createClassPath(testClassPath, null),
            null);
    try {
        ClassDeclaration decl = env.getClassDeclaration(
                Identifier.lookup(testClassName));
        decl.getClassDefinition(env);
    } finally {
        env.flushErrors();
        env.shutdown();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:CFCTest.java

示例5: forValue

import sun.tools.java.ClassDeclaration; //导入方法依赖的package包/类
/**
 * Create an ValueType object 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 ValueType forValue(ClassDefinition classDef,
                                 ContextStack stack,
                                 boolean quiet) {

    if (stack.anyErrors()) return null;

    // Do we already have it?

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

    if (existing != null) {

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

        // Yep, so return it...

        return (ValueType) existing;
    }

    // Is this java.lang.Class?

    boolean javaLangClass = false;

    if (classDef.getClassDeclaration().getName() == idJavaLangClass) {

        // Yes, so replace classDef with one for
        // javax.rmi.CORBA.ClassDesc...

        javaLangClass = true;
        BatchEnvironment env = stack.getEnv();
        ClassDeclaration decl = env.getClassDeclaration(idClassDesc);
        ClassDefinition def = null;

        try {
            def = decl.getClassDefinition(env);
        } catch (ClassNotFound ex) {
            classNotFound(stack,ex);
            return null;
        }

        classDef = def;
    }

    // Could this be a value?

    if (couldBeValue(stack,classDef)) {

        // Yes, so check it...

        ValueType it = new ValueType(classDef,stack,javaLangClass);
        putType(typeKey,it,stack);
        stack.push(it);

        if (it.initialize(stack,quiet)) {
            stack.pop(true);
            return it;
        } else {
            removeType(typeKey,stack);
            stack.pop(false);
            return null;
        }
    } else {
        return null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:75,代码来源:ValueType.java


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