src/share/classes/sun/rmi/rmic/iiop/InterfaceType.java

Mon, 26 Mar 2012 14:01:40 +0100

author
coffeys
date
Mon, 26 Mar 2012 14:01:40 +0100
changeset 370
5222b7d658d4
parent 158
91006f157c46
child 748
6845b95cba6b
permissions
-rw-r--r--

7143851: Improve IIOP stub and tie generation in RMIC
7149048: Changes to corba rmic stubGenerator class are not used during jdk build process
Reviewed-by: mschoene, robm

duke@1 1 /*
ohair@158 2 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@158 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@158 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@158 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 * or visit www.oracle.com if you need additional information or have any
ohair@158 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 /*
duke@1 27 * Licensed Materials - Property of IBM
duke@1 28 * RMI-IIOP v1.0
duke@1 29 * Copyright IBM Corp. 1998 1999 All Rights Reserved
duke@1 30 *
duke@1 31 */
duke@1 32
duke@1 33 package sun.rmi.rmic.iiop;
duke@1 34
duke@1 35 import java.io.IOException;
duke@1 36 import sun.tools.java.CompilerError;
duke@1 37 import sun.tools.java.ClassDefinition;
duke@1 38 import sun.rmi.rmic.IndentingWriter;
duke@1 39
duke@1 40 /**
duke@1 41 * InterfaceType is an abstract base representing any non-special
duke@1 42 * interface type.
duke@1 43 *
duke@1 44 * @author Bryan Atsatt
duke@1 45 */
duke@1 46 public abstract class InterfaceType extends CompoundType {
duke@1 47
duke@1 48 //_____________________________________________________________________
duke@1 49 // Public Interfaces
duke@1 50 //_____________________________________________________________________
duke@1 51
duke@1 52 /**
duke@1 53 * Print this type.
duke@1 54 * @param writer The stream to print to.
duke@1 55 * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
duke@1 56 * @param useIDLNames If true, print IDL names; otherwise, print java names.
duke@1 57 * @param globalIDLNames If true and useIDLNames true, prepends "::".
duke@1 58 */
duke@1 59 public void print ( IndentingWriter writer,
duke@1 60 boolean useQualifiedNames,
duke@1 61 boolean useIDLNames,
duke@1 62 boolean globalIDLNames) throws IOException {
duke@1 63
duke@1 64 if (isInner()) {
duke@1 65 writer.p("// " + getTypeDescription() + " (INNER)");
duke@1 66 } else {
duke@1 67 writer.p("// " + getTypeDescription() + "");
duke@1 68 }
duke@1 69 writer.pln(" (" + getRepositoryID() + ")\n");
duke@1 70 printPackageOpen(writer,useIDLNames);
duke@1 71
duke@1 72 if (!useIDLNames) {
duke@1 73 writer.p("public ");
duke@1 74 }
duke@1 75
duke@1 76 writer.p("interface " + getTypeName(false,useIDLNames,false));
duke@1 77 printImplements(writer,"",useQualifiedNames,useIDLNames,globalIDLNames);
duke@1 78 writer.plnI(" {");
duke@1 79 printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
duke@1 80 writer.pln();
duke@1 81 printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);
duke@1 82 writer.pln();
duke@1 83
duke@1 84 if (useIDLNames) {
duke@1 85 writer.pOln("};");
duke@1 86 } else {
duke@1 87 writer.pOln("}");
duke@1 88 }
duke@1 89 printPackageClose(writer,useIDLNames);
duke@1 90 }
duke@1 91
duke@1 92 //_____________________________________________________________________
duke@1 93 // Subclass/Internal Interfaces
duke@1 94 //_____________________________________________________________________
duke@1 95
duke@1 96 /**
duke@1 97 * Create a InterfaceType instance for the given class. NOTE: This constructor
duke@1 98 * is ONLY for SpecialInterfaceType.
duke@1 99 */
duke@1 100 protected InterfaceType(ContextStack stack, int typeCode, ClassDefinition classDef) {
duke@1 101 super(stack,typeCode,classDef); // Call special parent constructor.
duke@1 102
duke@1 103 if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) {
duke@1 104 throw new CompilerError("Not an interface");
duke@1 105 }
duke@1 106 }
duke@1 107
duke@1 108 /**
duke@1 109 * Create a InterfaceType instance for the given class. The resulting
duke@1 110 * object is not yet completely initialized. Subclasses must call
duke@1 111 * initialize(directInterfaces,directInterfaces,directConstants);
duke@1 112 */
duke@1 113 protected InterfaceType(ContextStack stack,
duke@1 114 ClassDefinition classDef,
duke@1 115 int typeCode) {
duke@1 116 super(stack,classDef,typeCode);
duke@1 117
duke@1 118 if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) {
duke@1 119 throw new CompilerError("Not an interface");
duke@1 120 }
duke@1 121 }
duke@1 122 }

mercurial