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


Java MemberDefinition.getExceptions方法代码示例

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


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

示例1: computeMethodHash

import sun.tools.java.MemberDefinition; //导入方法依赖的package包/类
/**
 * Create a new Method object corresponding to the given
 * method definition.
 */
/*
 * Temporarily comment out the private modifier until
 * the VM allows outer class to access inner class's
 * private constructor
 */
/* private */ Method(MemberDefinition memberDef) {
    this.memberDef = memberDef;
    exceptions = memberDef.getExceptions(env);
    methodHash = computeMethodHash();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:RemoteClass.java

示例2: getMethodExceptions

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


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