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


Java MemberDefinition类代码示例

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


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

示例1: Member

import sun.tools.java.MemberDefinition; //导入依赖的package包/类
/**
 * Create a new Member object.
 */
public Member(MemberDefinition member,
              String value,
              ContextStack stack,
              CompoundType enclosing) {
    this.member = member;
    this.value = value;
    forceTransient = false;
    innerClassDecl = member.getInnerClass() != null;

    // If we are not an inner class, finish initializing now.
    // Otherwise, wait until outer class is finished, then
    // call init to avoid potential recursion problems...

    if (!innerClassDecl) {
        init (stack,enclosing);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:CompoundType.java

示例2: checkMethods

import sun.tools.java.MemberDefinition; //导入依赖的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:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:ImplementationType.java

示例3: updateExceptions

import sun.tools.java.MemberDefinition; //导入依赖的package包/类
private boolean updateExceptions (MemberDefinition implMethod, Method[] list,
                                  ContextStack stack, boolean quiet) {
    int length = list.length;
    String implMethodSig = implMethod.toString();

    for (int i = 0; i < length; i++) {
        Method existingMethod = list[i];
        MemberDefinition existing = existingMethod.getMemberDefinition();

        // Do we have a matching method?

        if (implMethodSig.equals(existing.toString())) {

            // Yes, so create exception list...

            try {
                ValueType[] implExcept = getMethodExceptions(implMethod,quiet,stack);
                existingMethod.setImplExceptions(implExcept);
            } catch (Exception e) {
                return false;
            }
        }
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:ImplementationType.java

示例4: getVisibilityString

import sun.tools.java.MemberDefinition; //导入依赖的package包/类
protected static String getVisibilityString (MemberDefinition member) {
    String vis = "";
    String prefix = "";

    if (member.isPublic()) {
        vis += "public";
        prefix = " ";
    } else if (member.isProtected()) {
        vis += "protected";
        prefix = " ";
    } else if (member.isPrivate()) {
        vis += "private";
        prefix = " ";
    }

    if (member.isStatic()) {
        vis += prefix;
        vis += "static";
        prefix = " ";
    }

    if (member.isFinal()) {
        vis += prefix;
        vis += "final";
        prefix = " ";
    }

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

示例5: writeMethodFieldInitializers

import sun.tools.java.MemberDefinition; //导入依赖的package包/类
/**
 * Write code to initialize the static fields for each method
 * using the Java Reflection API.
 */
private void writeMethodFieldInitializers(IndentingWriter p)
    throws IOException
{
    for (int i = 0; i < methodFieldNames.length; i++) {
        p.p(methodFieldNames[i] + " = ");
        /*
         * Here we look up the Method object in the arbitrary interface
         * that we find in the RemoteClass.Method object.
         * REMIND: Is this arbitrary choice OK?
         * REMIND: Should this access be part of RemoteClass.Method's
         * abstraction?
         */
        RemoteClass.Method method = remoteMethods[i];
        MemberDefinition def = method.getMemberDefinition();
        Identifier methodName = method.getName();
        Type methodType = method.getType();
        Type paramTypes[] = methodType.getArgumentTypes();

        p.p(def.getClassDefinition().getName() + ".class.getMethod(\"" +
            methodName + "\", new java.lang.Class[] {");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                p.p(", ");
            p.p(paramTypes[j] + ".class");
        }
        p.pln("});");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:RMIGenerator.java

示例6: 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

示例7: updateParentClassMethods

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


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