sun.tools.java.MemberDefinition Java Examples

The following examples show how to use sun.tools.java.MemberDefinition. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CompoundType.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #2
Source File: ImplementationType.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: ImplementationType.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: CompoundType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #5
Source File: ImplementationType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #6
Source File: ImplementationType.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #7
Source File: ImplementationType.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #8
Source File: ImplementationType.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #9
Source File: ImplementationType.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #10
Source File: ImplementationType.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #11
Source File: ImplementationType.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #12
Source File: CompoundType.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #13
Source File: ImplementationType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #14
Source File: ImplementationType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #15
Source File: CompoundType.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #16
Source File: ImplementationType.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #17
Source File: CompoundType.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
    }
}
 
Example #18
Source File: RMIGenerator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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("});");
    }
}
 
Example #19
Source File: RemoteClass.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #20
Source File: RMIGenerator.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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("});");
    }
}
 
Example #21
Source File: RMIGenerator.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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("});");
    }
}
 
Example #22
Source File: RemoteClass.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #23
Source File: CompoundType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #24
Source File: CompoundType.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: RemoteClass.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #26
Source File: RMIGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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("});");
    }
}
 
Example #27
Source File: RemoteClass.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #28
Source File: CompoundType.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #29
Source File: RemoteClass.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #30
Source File: CompoundType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}