Java Code Examples for sun.rmi.rmic.IndentingWriter#plnI()

The following examples show how to use sun.rmi.rmic.IndentingWriter#plnI() . 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: Type.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Print the "opening" of the package or module of this type.
 * @param writer The stream to print to.
 * @param useIDLNames If true, print IDL names; otherwise, print java names.
 */
protected void printPackageOpen (   IndentingWriter writer,
                                    boolean useIDLNames) throws IOException {

    if (useIDLNames) {
        String[] moduleNames = getIDLModuleNames();
        for (int i = 0; i < moduleNames.length; i++ ) {
            writer.plnI("module " + moduleNames[i] + " {");
        }
    } else {
        String packageName = getPackageName();
        if (packageName != null) {
            writer.pln("package " + packageName + ";");
        }
    }
}
 
Example 2
Source File: StubGenerator.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void write_tie_thisObject_method(IndentingWriter p,
                                        Identifier idCorbaObject)
    throws IOException
{
    if(POATie){
        p.plnI("public " + idCorbaObject + " thisObject() {");
        /*
        p.pln("org.omg.CORBA.Object objref = null;");
        p.pln("try{");
        p.pln("objref = _poa().servant_to_reference(this);");
        p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
        catchWrongPolicy(p);
        p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
        catchServantNotActive(p);
        p.pln("}");
        p.pln("return objref;");
        */
        p.pln("return _this_object();");
        p.pOln("}");
    } else {
        p.plnI("public " + idCorbaObject + " thisObject() {");
        p.pln("return this;");
        p.pOln("}");
    }
}
 
Example 3
Source File: Type.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Print the "opening" of the package or module of this type.
 * @param writer The stream to print to.
 * @param useIDLNames If true, print IDL names; otherwise, print java names.
 */
protected void printPackageOpen (   IndentingWriter writer,
                                    boolean useIDLNames) throws IOException {

    if (useIDLNames) {
        String[] moduleNames = getIDLModuleNames();
        for (int i = 0; i < moduleNames.length; i++ ) {
            writer.plnI("module " + moduleNames[i] + " {");
        }
    } else {
        String packageName = getPackageName();
        if (packageName != null) {
            writer.pln("package " + packageName + ";");
        }
    }
}
 
Example 4
Source File: Type.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Print the "opening" of the package or module of this type.
 * @param writer The stream to print to.
 * @param useIDLNames If true, print IDL names; otherwise, print java names.
 */
protected void printPackageOpen (   IndentingWriter writer,
                                    boolean useIDLNames) throws IOException {

    if (useIDLNames) {
        String[] moduleNames = getIDLModuleNames();
        for (int i = 0; i < moduleNames.length; i++ ) {
            writer.plnI("module " + moduleNames[i] + " {");
        }
    } else {
        String packageName = getPackageName();
        if (packageName != null) {
            writer.pln("package " + packageName + ";");
        }
    }
}
 
Example 5
Source File: StubGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void write_tie_deactivate_method(IndentingWriter p)
    throws IOException
{
    if(POATie){
        p.plnI("public void deactivate() {");
        p.pln("try{");
        p.pln("_poa().deactivate_object(_poa().servant_to_id(this));");
        p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
        catchWrongPolicy(p);
        p.pln("}catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception){");
        catchObjectNotActive(p);
        p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
        catchServantNotActive(p);
        p.pln("}");
        p.pOln("}");
    } else {
        p.plnI("public void deactivate() {");
        p.pln("_orb().disconnect(this);");
        p.pln("_set_delegate(null);");
        p.pln("target = null;");
        p.pOln("}");
    }
}
 
Example 6
Source File: StubGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
void writeIds(IndentingWriter p, CompoundType theType, boolean isTie
              ) throws IOException {
    p.plnI("private static final String[] _type_ids = {");

    String[] ids = getAllRemoteRepIDs(theType);

    if (ids.length >0 ) {
        for(int i = 0; i < ids.length; i++) {
            if (i > 0)
                p.pln(", ");
            p.p("\"" + ids[i] + "\"");
        }
    } else {
       // Must be an implementation which only implements Remote...
       p.pln("\"\"");
    }
    String qname = theType.getQualifiedName() ;
    boolean isTransactional = isTie && transactionalObjects.containsKey( qname ) ;
    // Add TransactionalObject if needed.
    if (isTransactional) {
        // Have already written an id.
        p.pln( ", " ) ;
        p.pln( "\"IDL:omg.org/CosTransactions/TransactionalObject:1.0\"" ) ;
    } else if (ids.length > 0) {
        p.pln();
    }
    p.pOln("};");
}
 
Example 7
Source File: InterfaceType.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Print this type.
 * @param writer The stream to print to.
 * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
 * @param useIDLNames If true, print IDL names; otherwise, print java names.
 * @param globalIDLNames If true and useIDLNames true, prepends "::".
 */
public void print ( IndentingWriter writer,
                    boolean useQualifiedNames,
                    boolean useIDLNames,
                    boolean globalIDLNames) throws IOException {

    if (isInner()) {
        writer.p("// " + getTypeDescription() + " (INNER)");
    } else {
        writer.p("// " + getTypeDescription() + "");
    }
    writer.pln(" (" + getRepositoryID() + ")\n");
    printPackageOpen(writer,useIDLNames);

    if (!useIDLNames) {
        writer.p("public ");
    }

    writer.p("interface " + getTypeName(false,useIDLNames,false));
    printImplements(writer,"",useQualifiedNames,useIDLNames,globalIDLNames);
    writer.plnI(" {");
    printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
    writer.pln();
    printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);
    writer.pln();

    if (useIDLNames) {
        writer.pOln("};");
    } else {
        writer.pOln("}");
    }
    printPackageClose(writer,useIDLNames);
}
 
Example 8
Source File: StubGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void write_tie__ids_method(IndentingWriter p)
    throws IOException
{
    if(POATie){
    p.plnI("public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId){");
    p.pln("return (String[]) _type_ids.clone();");
    p.pOln("}");
    } else {
    p.plnI("public String[] _ids() { ");
    p.pln("return (String[]) _type_ids.clone();");
    p.pOln("}");
    }
}
 
Example 9
Source File: StubGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
void writeIds(IndentingWriter p, CompoundType theType, boolean isTie
              ) throws IOException {
    p.plnI("private static final String[] _type_ids = {");

    String[] ids = getAllRemoteRepIDs(theType);

    if (ids.length >0 ) {
        for(int i = 0; i < ids.length; i++) {
            if (i > 0)
                p.pln(", ");
            p.p("\"" + ids[i] + "\"");
        }
    } else {
       // Must be an implementation which only implements Remote...
       p.pln("\"\"");
    }
    String qname = theType.getQualifiedName() ;
    boolean isTransactional = isTie && transactionalObjects.containsKey( qname ) ;
    // Add TransactionalObject if needed.
    if (isTransactional) {
        // Have already written an id.
        p.pln( ", " ) ;
        p.pln( "\"IDL:omg.org/CosTransactions/TransactionalObject:1.0\"" ) ;
    } else if (ids.length > 0) {
        p.pln();
    }
    p.pOln("};");
}
 
Example 10
Source File: StubGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void writeCastArray(IndentingWriter p) throws IOException {
    if (castArray) {
        p.pln();
        p.pln("// This method is required as a work-around for");
        p.pln("// a bug in the JDK 1.1.6 verifier.");
        p.pln();
        p.plnI("private "+getName(idJavaIoSerializable)+" cast_array(Object obj) {");
        p.pln("return ("+getName(idJavaIoSerializable)+")obj;");
        p.pOln("}");
    }
}
 
Example 11
Source File: ClassType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Print this type.
 * @param writer The stream to print to.
 * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
 * @param useIDLNames If true, print IDL names; otherwise, print java names.
 * @param globalIDLNames If true and useIDLNames true, prepends "::".
 */
public void print ( IndentingWriter writer,
                    boolean useQualifiedNames,
                    boolean useIDLNames,
                    boolean globalIDLNames) throws IOException {

    if (isInner()) {
        writer.p("// " + getTypeDescription() + " (INNER)");
    } else {
        writer.p("// " + getTypeDescription());
    }
    writer.pln(" (" + getRepositoryID() + ")\n");

    printPackageOpen(writer,useIDLNames);

    if (!useIDLNames) {
        writer.p("public ");
    }

    String prefix = "";
    writer.p("class " + getTypeName(false,useIDLNames,false));
    if (printExtends(writer,useQualifiedNames,useIDLNames,globalIDLNames)) {
        prefix = ",";
    }
    printImplements(writer,prefix,useQualifiedNames,useIDLNames,globalIDLNames);
    writer.plnI(" {");
    printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
    writer.pln();
    printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);

    if (useIDLNames) {
        writer.pOln("};");
    } else {
        writer.pOln("}");
    }

    printPackageClose(writer,useIDLNames);
}
 
Example 12
Source File: ClassType.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Print this type.
 * @param writer The stream to print to.
 * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
 * @param useIDLNames If true, print IDL names; otherwise, print java names.
 * @param globalIDLNames If true and useIDLNames true, prepends "::".
 */
public void print ( IndentingWriter writer,
                    boolean useQualifiedNames,
                    boolean useIDLNames,
                    boolean globalIDLNames) throws IOException {

    if (isInner()) {
        writer.p("// " + getTypeDescription() + " (INNER)");
    } else {
        writer.p("// " + getTypeDescription());
    }
    writer.pln(" (" + getRepositoryID() + ")\n");

    printPackageOpen(writer,useIDLNames);

    if (!useIDLNames) {
        writer.p("public ");
    }

    String prefix = "";
    writer.p("class " + getTypeName(false,useIDLNames,false));
    if (printExtends(writer,useQualifiedNames,useIDLNames,globalIDLNames)) {
        prefix = ",";
    }
    printImplements(writer,prefix,useQualifiedNames,useIDLNames,globalIDLNames);
    writer.plnI(" {");
    printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
    writer.pln();
    printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);

    if (useIDLNames) {
        writer.pOln("};");
    } else {
        writer.pOln("}");
    }

    printPackageClose(writer,useIDLNames);
}
 
Example 13
Source File: StubGenerator.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void write_tie_orb_method(IndentingWriter p)
    throws IOException
{
    if(POATie){
    p.plnI("public void orb(ORB orb) {");
    /*
    p.pln("try{");
    p.pln("orb.connect(_poa().servant_to_reference(this));");
    p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
    catchWrongPolicy(p);
    p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
    catchServantNotActive(p);
    p.pln("}");
    */
    p.pln("try {");
    p.pln("    ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);");
    p.pln("}");
    p.pln("catch(ClassCastException e) {");
    p.pln("    throw new org.omg.CORBA.BAD_PARAM");
    p.pln("        (\"POA Servant requires an instance of org.omg.CORBA_2_3.ORB\");");
    p.pln("}");
    p.pOln("}");
    } else {
    p.plnI("public void orb(ORB orb) {");
    p.pln("orb.connect(this);");
    p.pOln("}");
    }
}
 
Example 14
Source File: StubGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void write_tie_orb_method(IndentingWriter p)
    throws IOException
{
    if(POATie){
    p.plnI("public void orb(ORB orb) {");
    /*
    p.pln("try{");
    p.pln("orb.connect(_poa().servant_to_reference(this));");
    p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
    catchWrongPolicy(p);
    p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
    catchServantNotActive(p);
    p.pln("}");
    */
    p.pln("try {");
    p.pln("    ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);");
    p.pln("}");
    p.pln("catch(ClassCastException e) {");
    p.pln("    throw new org.omg.CORBA.BAD_PARAM");
    p.pln("        (\"POA Servant requires an instance of org.omg.CORBA_2_3.ORB\");");
    p.pln("}");
    p.pOln("}");
    } else {
    p.plnI("public void orb(ORB orb) {");
    p.pln("orb.connect(this);");
    p.pOln("}");
    }
}
 
Example 15
Source File: StubGenerator.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
void writeStubMethod (  IndentingWriter p,
                        CompoundType.Method method,
                        CompoundType theType) throws IOException {

    // Wtite the method declaration and opening brace...
    String methodName = method.getName();
    String methodIDLName = method.getIDLName();

    Type paramTypes[] = method.getArguments();
    String paramNames[] = method.getArgumentNames();
    Type returnType = method.getReturnType();
    ValueType[] exceptions = getStubExceptions(method,false);
    boolean hasIOException = false;

    addNamesInUse(method);
    addNameInUse("_type_ids");

    String objName = testUtil(getName(returnType), returnType);
    p.p("public " + objName + " " + methodName + "(");
    for(int i = 0; i < paramTypes.length; i++) {
        if (i > 0)
            p.p(", ");
        p.p(getName(paramTypes[i]) + " " + paramNames[i]);
    }

    p.p(")");
    if (exceptions.length > 0) {
        p.p(" throws ");
        for(int i = 0; i < exceptions.length; i++) {
            if (i > 0) {
                p.p(", ");
            }
            // Added for Bug 4818753
            p.p(getExceptionName(exceptions[i]));
        }
    }

    p.plnI(" {");

    // Now create the method body...
    if (emitPermissionCheck) {
        p.pln("if ((System.getSecurityManager() != null) && (!_instantiated)) {");
        p.plnI("    throw new java.io.IOError(new java.io.IOException(\"InvalidObject \"));");
        p.pOln("}");
        p.pln();
    }


    if (localStubs) {
        writeLocalStubMethodBody(p,method,theType);
    } else {
        writeNonLocalStubMethodBody(p,method,theType);
    }

    // Close out the method...

    p.pOln("}");
}
 
Example 16
Source File: StubGenerator.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
void writeStubMethod (  IndentingWriter p,
                        CompoundType.Method method,
                        CompoundType theType) throws IOException {

    // Wtite the method declaration and opening brace...
    String methodName = method.getName();
    String methodIDLName = method.getIDLName();

    Type paramTypes[] = method.getArguments();
    String paramNames[] = method.getArgumentNames();
    Type returnType = method.getReturnType();
    ValueType[] exceptions = getStubExceptions(method,false);

    addNamesInUse(method);
    addNameInUse("_type_ids");

    String objName = testUtil(getName(returnType), returnType);
    p.p("public " + objName + " " + methodName + "(");
    for(int i = 0; i < paramTypes.length; i++) {
        if (i > 0)
            p.p(", ");
        p.p(getName(paramTypes[i]) + " " + paramNames[i]);
    }

    p.p(")");
    if (exceptions.length > 0) {
        p.p(" throws ");
        for(int i = 0; i < exceptions.length; i++) {
            if (i > 0) {
                p.p(", ");
            }
            // Added for Bug 4818753
            p.p(getExceptionName(exceptions[i]));
        }
    }

    p.plnI(" {");

    // Now create the method body...

    if (localStubs) {
        writeLocalStubMethodBody(p,method,theType);
    } else {
        writeNonLocalStubMethodBody(p,method,theType);
    }

    // Close out the method...

    p.pOln("}");
}
 
Example 17
Source File: StubGenerator.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
void writeLocalStubMethodBody (IndentingWriter p,
                               CompoundType.Method method,
                               CompoundType theType) throws IOException {

    String objName;
    String paramNames[] = method.getArgumentNames();
    Type returnType = method.getReturnType();
    ValueType[] exceptions = getStubExceptions(method,false);
    String methodName = method.getName();
    String methodIDLName = method.getIDLName();

    p.plnI("if (!Util.isLocal(this)) {");
    writeNonLocalStubMethodBody(p,method,theType);
    p.pOlnI("} else {");
    String so = getVariableName("so");

    p.pln("ServantObject "+so+" = _servant_preinvoke(\""+methodIDLName+"\","+getName(theType)+".class);");
    p.plnI("if ("+so+" == null) {");
    if (!returnType.isType(TYPE_VOID)) {
        p.p("return ");
    }
    p.p(methodName+"(");
    for (int i = 0; i < paramNames.length; i++) {
        if (i > 0)
            p.p(", ");
        p.p(paramNames[i]);
    }
    p.pln(");");
    if (returnType.isType(TYPE_VOID)) {
        p.pln( "return ;" ) ;
    }

    p.pOln("}");
    p.plnI("try {");

    // Generate code to copy required arguments, and
    // get back the names by which all arguments are known...

    String[] argNames = writeCopyArguments(method,p);

    // Now write the method...

    boolean copyReturn = mustCopy(returnType);
    String resultName = null;
    if (!returnType.isType(TYPE_VOID)) {
        if (copyReturn) {
            resultName = getVariableName("result");
            objName = testUtil(getName(returnType), returnType);
            p.p(objName+" "+resultName + " = ");
        } else {
            p.p("return ");
        }
    }
    objName = testUtil(getName(theType), theType);
    p.p("(("+objName+")"+so+".servant)."+methodName+"(");

    for (int i = 0; i < argNames.length; i++) {
        if (i > 0)
            p.p(", ");
        p.p(argNames[i]);
    }

    if (copyReturn) {
        p.pln(");");
        objName = testUtil(getName(returnType), returnType);
        p.pln("return ("+objName+")Util.copyObject("+resultName+",_orb());");
    } else {
        p.pln(");");
    }

    String e1 = getVariableName("ex");
    String e2 = getVariableName("exCopy");
    p.pOlnI("} catch (Throwable "+e1+") {");

    p.pln("Throwable "+e2+" = (Throwable)Util.copyObject("+e1+",_orb());");
    for(int i = 0; i < exceptions.length; i++) {
        if (exceptions[i].getIdentifier() != idRemoteException &&
            exceptions[i].isType(TYPE_VALUE)) {
            // Added for Bug 4818753
            p.plnI("if ("+e2+" instanceof "+getExceptionName(exceptions[i])+") {");
            p.pln("throw ("+getExceptionName(exceptions[i])+")"+e2+";");
            p.pOln("}");
        }
    }

    p.pln("throw Util.wrapException("+e2+");");
    p.pOlnI("} finally {");
    p.pln("_servant_postinvoke("+so+");");
    p.pOln("}");
    p.pOln("}");
}
 
Example 18
Source File: StubGenerator.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
void writeStubMethod (  IndentingWriter p,
                        CompoundType.Method method,
                        CompoundType theType) throws IOException {

    // Wtite the method declaration and opening brace...
    String methodName = method.getName();
    String methodIDLName = method.getIDLName();

    Type paramTypes[] = method.getArguments();
    String paramNames[] = method.getArgumentNames();
    Type returnType = method.getReturnType();
    ValueType[] exceptions = getStubExceptions(method,false);

    addNamesInUse(method);
    addNameInUse("_type_ids");

    String objName = testUtil(getName(returnType), returnType);
    p.p("public " + objName + " " + methodName + "(");
    for(int i = 0; i < paramTypes.length; i++) {
        if (i > 0)
            p.p(", ");
        p.p(getName(paramTypes[i]) + " " + paramNames[i]);
    }

    p.p(")");
    if (exceptions.length > 0) {
        p.p(" throws ");
        for(int i = 0; i < exceptions.length; i++) {
            if (i > 0) {
                p.p(", ");
            }
            // Added for Bug 4818753
            p.p(getExceptionName(exceptions[i]));
        }
    }

    p.plnI(" {");

    // Now create the method body...

    if (localStubs) {
        writeLocalStubMethodBody(p,method,theType);
    } else {
        writeNonLocalStubMethodBody(p,method,theType);
    }

    // Close out the method...

    p.pOln("}");
}
 
Example 19
Source File: StubGenerator.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
void writeStubMethod (  IndentingWriter p,
                        CompoundType.Method method,
                        CompoundType theType) throws IOException {

    // Wtite the method declaration and opening brace...
    String methodName = method.getName();
    String methodIDLName = method.getIDLName();

    Type paramTypes[] = method.getArguments();
    String paramNames[] = method.getArgumentNames();
    Type returnType = method.getReturnType();
    ValueType[] exceptions = getStubExceptions(method,false);
    boolean hasIOException = false;

    addNamesInUse(method);
    addNameInUse("_type_ids");

    String objName = testUtil(getName(returnType), returnType);
    p.p("public " + objName + " " + methodName + "(");
    for(int i = 0; i < paramTypes.length; i++) {
        if (i > 0)
            p.p(", ");
        p.p(getName(paramTypes[i]) + " " + paramNames[i]);
    }

    p.p(")");
    if (exceptions.length > 0) {
        p.p(" throws ");
        for(int i = 0; i < exceptions.length; i++) {
            if (i > 0) {
                p.p(", ");
            }
            // Added for Bug 4818753
            p.p(getExceptionName(exceptions[i]));
        }
    }

    p.plnI(" {");

    // Now create the method body...
    if (emitPermissionCheck) {
        p.pln("if ((System.getSecurityManager() != null) && (!_instantiated)) {");
        p.plnI("    throw new java.io.IOError(new java.io.IOException(\"InvalidObject \"));");
        p.pOln("}");
        p.pln();
    }


    if (localStubs) {
        writeLocalStubMethodBody(p,method,theType);
    } else {
        writeNonLocalStubMethodBody(p,method,theType);
    }

    // Close out the method...

    p.pOln("}");
}
 
Example 20
Source File: StubGenerator.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void writeStubMethod (  IndentingWriter p,
                        CompoundType.Method method,
                        CompoundType theType) throws IOException {

    // Wtite the method declaration and opening brace...
    String methodName = method.getName();
    String methodIDLName = method.getIDLName();

    Type paramTypes[] = method.getArguments();
    String paramNames[] = method.getArgumentNames();
    Type returnType = method.getReturnType();
    ValueType[] exceptions = getStubExceptions(method,false);
    boolean hasIOException = false;

    addNamesInUse(method);
    addNameInUse("_type_ids");

    String objName = testUtil(getName(returnType), returnType);
    p.p("public " + objName + " " + methodName + "(");
    for(int i = 0; i < paramTypes.length; i++) {
        if (i > 0)
            p.p(", ");
        p.p(getName(paramTypes[i]) + " " + paramNames[i]);
    }

    p.p(")");
    if (exceptions.length > 0) {
        p.p(" throws ");
        for(int i = 0; i < exceptions.length; i++) {
            if (i > 0) {
                p.p(", ");
            }
            // Added for Bug 4818753
            p.p(getExceptionName(exceptions[i]));
        }
    }

    p.plnI(" {");

    // Now create the method body...
    if (emitPermissionCheck) {
        p.pln("if ((System.getSecurityManager() != null) && (!_instantiated)) {");
        p.plnI("    throw new java.io.IOError(new java.io.IOException(\"InvalidObject \"));");
        p.pOln("}");
        p.pln();
    }


    if (localStubs) {
        writeLocalStubMethodBody(p,method,theType);
    } else {
        writeNonLocalStubMethodBody(p,method,theType);
    }

    // Close out the method...

    p.pOln("}");
}