aoqi@0: /* aoqi@0: * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: /* aoqi@0: * Licensed Materials - Property of IBM aoqi@0: * RMI-IIOP v1.0 aoqi@0: * Copyright IBM Corp. 1998 1999 All Rights Reserved aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: package sun.rmi.rmic.iiop; aoqi@0: aoqi@0: import java.util.Hashtable; aoqi@0: import java.util.Locale; aoqi@0: import sun.tools.java.Identifier; aoqi@0: import sun.tools.java.CompilerError; aoqi@0: import sun.tools.java.ClassDefinition; aoqi@0: import sun.tools.java.ClassNotFound; aoqi@0: import com.sun.corba.se.impl.util.RepositoryId; aoqi@0: aoqi@0: /** aoqi@0: * IDLNames provides static utility methods to perform the IDL aoqi@0: * name mappings specified in Chapter 5 of the Java Language aoqi@0: * to IDL specification. aoqi@0: * aoqi@0: * @author Bryan Atsatt aoqi@0: */ aoqi@0: public class IDLNames implements sun.rmi.rmic.iiop.Constants { aoqi@0: aoqi@0: /** aoqi@0: * Used to convert ascii to hex. aoqi@0: */ aoqi@0: public static final byte ASCII_HEX[] = { aoqi@0: (byte)'0', aoqi@0: (byte)'1', aoqi@0: (byte)'2', aoqi@0: (byte)'3', aoqi@0: (byte)'4', aoqi@0: (byte)'5', aoqi@0: (byte)'6', aoqi@0: (byte)'7', aoqi@0: (byte)'8', aoqi@0: (byte)'9', aoqi@0: (byte)'A', aoqi@0: (byte)'B', aoqi@0: (byte)'C', aoqi@0: (byte)'D', aoqi@0: (byte)'E', aoqi@0: (byte)'F', aoqi@0: }; aoqi@0: aoqi@0: // Legal IDL Identifier characters (1 = legal). Note aoqi@0: // that '.' (2E) is marked as legal even though it is aoqi@0: // not legal in IDL. This allows us to treat a fully aoqi@0: // qualified Java name with '.' package separators aoqi@0: // uniformly, and is safe because that is the only aoqi@0: // legal use of '.' in a Java name. aoqi@0: aoqi@0: private static final byte[] IDL_IDENTIFIER_CHARS = { aoqi@0: aoqi@0: // 0 1 2 3 4 5 6 7 8 9 a b c d e f aoqi@0: 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f aoqi@0: 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f aoqi@0: 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f aoqi@0: 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f aoqi@0: 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f aoqi@0: 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f aoqi@0: 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f aoqi@0: 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f aoqi@0: 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f aoqi@0: 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f aoqi@0: 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af aoqi@0: 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf aoqi@0: 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf aoqi@0: 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df aoqi@0: 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef aoqi@0: 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff aoqi@0: }; aoqi@0: aoqi@0: //_____________________________________________________________________ aoqi@0: // Public Interfaces aoqi@0: //_____________________________________________________________________ aoqi@0: aoqi@0: /** aoqi@0: * Convert a name. The nameContext argument MUST be pre-filled with aoqi@0: * all names from the appropriate context (e.g. all the method names aoqi@0: * in a given class). The names must not have had any IDL conversions aoqi@0: * applied. aoqi@0: *

aoqi@0: * Section 28.3.2.2 aoqi@0: * Section 28.3.2.3 aoqi@0: * Section 28.3.2.4 aoqi@0: * Section 28.3.2.7 (member and method names only) aoqi@0: */ aoqi@0: public static String getMemberOrMethodName (NameContext nameContext, aoqi@0: String name, aoqi@0: BatchEnvironment env) { aoqi@0: aoqi@0: // Check namesCache... aoqi@0: aoqi@0: String result = (String) env.namesCache.get(name); aoqi@0: aoqi@0: if (result == null) { aoqi@0: aoqi@0: // 28.3.2.7 Case sensitive member names. aoqi@0: aoqi@0: // Note: This must be done before any of aoqi@0: // the other conversions! aoqi@0: aoqi@0: result = nameContext.get(name); aoqi@0: aoqi@0: // 28.3.2.3 Leading underscores... aoqi@0: aoqi@0: result = convertLeadingUnderscores(result); aoqi@0: aoqi@0: // 28.3.2.2 IDL keywords (NOTE: must be done aoqi@0: // after leading underscore conversion because aoqi@0: // the mangling for IDL keywords creates a aoqi@0: // leading underscore!)... aoqi@0: aoqi@0: result = convertIDLKeywords(result); aoqi@0: aoqi@0: // 28.3.2.4 Illegal IDL identifier characters... aoqi@0: aoqi@0: result = convertToISOLatin1(result); aoqi@0: aoqi@0: // Add to namesCache... aoqi@0: aoqi@0: env.namesCache.put(name,result); aoqi@0: } aoqi@0: aoqi@0: return result; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Convert names with illegal IDL identifier characters. aoqi@0: *

aoqi@0: * Section 28.3.2.4 aoqi@0: */ aoqi@0: public static String convertToISOLatin1 (String name) { aoqi@0: aoqi@0: // First, replace any escape sequences... aoqi@0: aoqi@0: String result = replace(name,"x\\u","U"); aoqi@0: result = replace(result,"x\\U","U"); aoqi@0: aoqi@0: // Now see if we have any remaining illegal characters (see aoqi@0: // IDL_IDENTIFIER_CHARS array)... aoqi@0: aoqi@0: int length = result.length(); aoqi@0: StringBuffer buffer = null; aoqi@0: aoqi@0: for (int i = 0; i < length; i++) { aoqi@0: aoqi@0: char c = result.charAt(i); aoqi@0: aoqi@0: if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { aoqi@0: aoqi@0: // We gotta convert. Have we already started? aoqi@0: aoqi@0: if (buffer == null) { aoqi@0: aoqi@0: // No, so get set up... aoqi@0: aoqi@0: buffer = new StringBuffer(result.substring(0,i)); aoqi@0: } aoqi@0: aoqi@0: // Convert the character into the IDL escape syntax... aoqi@0: aoqi@0: buffer.append("U"); aoqi@0: buffer.append((char)ASCII_HEX[(c & 0xF000) >>> 12]); aoqi@0: buffer.append((char)ASCII_HEX[(c & 0x0F00) >>> 8]); aoqi@0: buffer.append((char)ASCII_HEX[(c & 0x00F0) >>> 4]); aoqi@0: buffer.append((char)ASCII_HEX[(c & 0x000F)]); aoqi@0: aoqi@0: } else { aoqi@0: if (buffer != null) { aoqi@0: buffer.append(c); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: if (buffer != null) { aoqi@0: result = buffer.toString(); aoqi@0: } aoqi@0: aoqi@0: return result; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Convert names which collide with IDL keywords. aoqi@0: *

aoqi@0: * Section 28.3.2.5 aoqi@0: */ aoqi@0: public static String convertIDLKeywords (String name) { aoqi@0: aoqi@0: for (int i = 0; i < IDL_KEYWORDS.length; i++) { aoqi@0: if (name.equalsIgnoreCase(IDL_KEYWORDS[i])) { aoqi@0: return "_" + name; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: return name; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Convert names which have leading underscores aoqi@0: *

aoqi@0: * Section 28.3.2.3 aoqi@0: */ aoqi@0: public static String convertLeadingUnderscores (String name) { aoqi@0: aoqi@0: if (name.startsWith("_")) { aoqi@0: return "J" + name; aoqi@0: } aoqi@0: aoqi@0: return name; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Convert a type name. aoqi@0: *

aoqi@0: * Section 28.3.2.5 aoqi@0: * Section 28.3.2.7 (class or interface names only) aoqi@0: * Throws exception if fails 28.3.2.7. aoqi@0: */ aoqi@0: public static String getClassOrInterfaceName (Identifier id, aoqi@0: BatchEnvironment env) throws Exception { aoqi@0: aoqi@0: // Get the type and package name... aoqi@0: aoqi@0: String typeName = id.getName().toString(); aoqi@0: String packageName = null; aoqi@0: aoqi@0: if (id.isQualified()) { aoqi@0: packageName = id.getQualifier().toString(); aoqi@0: } aoqi@0: aoqi@0: // Check namesCache... aoqi@0: aoqi@0: String result = (String) env.namesCache.get(typeName); aoqi@0: aoqi@0: if (result == null) { aoqi@0: aoqi@0: // 28.3.2.5 Inner classes... aoqi@0: aoqi@0: result = replace(typeName,". ","__"); aoqi@0: aoqi@0: // 28.3.2.4 Illegal identifier characters... aoqi@0: aoqi@0: result = convertToISOLatin1(result); aoqi@0: aoqi@0: // 28.3.2.7 Case sensitive class or interface names... aoqi@0: aoqi@0: NameContext context = NameContext.forName(packageName,false,env); aoqi@0: context.assertPut(result); aoqi@0: aoqi@0: // Run it through the name checks... aoqi@0: aoqi@0: result = getTypeOrModuleName(result); aoqi@0: aoqi@0: // Add it to the namesCache... aoqi@0: aoqi@0: env.namesCache.put(typeName,result); aoqi@0: } aoqi@0: aoqi@0: return result; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Convert an Exception name. aoqi@0: *

aoqi@0: * Section 28.3.7.2 (see ValueType) aoqi@0: */ aoqi@0: public static String getExceptionName (String idlName) { aoqi@0: aoqi@0: String result = idlName; aoqi@0: // d.11315 Incorrectly mangled exception names aoqi@0: if (idlName.endsWith(EXCEPTION_SUFFIX)) { aoqi@0: aoqi@0: // Remove "Exception" and append "Ex". Strip leading underscore aoqi@0: // in case the idlName is exactly "_Exception"... aoqi@0: aoqi@0: result = stripLeadingUnderscore(idlName.substring(0,idlName.lastIndexOf(EXCEPTION_SUFFIX)) + EX_SUFFIX); aoqi@0: } else { aoqi@0: result = idlName + EX_SUFFIX; aoqi@0: } aoqi@0: aoqi@0: return result; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Convert a qualified Identifier into an array of IDL names. aoqi@0: *

aoqi@0: * Section 28.3.2.1 (see CompoundType) aoqi@0: * Throws exception if fails 28.3.2.7. aoqi@0: */ aoqi@0: public static String[] getModuleNames (Identifier theID, aoqi@0: boolean boxIt, aoqi@0: BatchEnvironment env) throws Exception { aoqi@0: aoqi@0: String[] result = null; aoqi@0: aoqi@0: if (theID.isQualified()) { aoqi@0: aoqi@0: // Extract the qualifier... aoqi@0: aoqi@0: Identifier id = theID.getQualifier(); aoqi@0: aoqi@0: // 28.3.2.7 Case sensitive module names. aoqi@0: aoqi@0: env.modulesContext.assertPut(id.toString()); aoqi@0: aoqi@0: // Count them... aoqi@0: aoqi@0: int count = 1; aoqi@0: Identifier current = id; aoqi@0: while (current.isQualified()) { aoqi@0: current = current.getQualifier(); aoqi@0: count++; aoqi@0: } aoqi@0: aoqi@0: result = new String[count]; aoqi@0: int index = count-1; aoqi@0: current = id; aoqi@0: aoqi@0: // Now walk them and fill our array (backwards)... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: aoqi@0: String item = current.getName().toString(); aoqi@0: aoqi@0: // Check namesCache... aoqi@0: aoqi@0: String cachedItem = (String) env.namesCache.get(item); aoqi@0: aoqi@0: if (cachedItem == null) { aoqi@0: aoqi@0: // 28.3.2.4 Illegal identifier characters... aoqi@0: aoqi@0: cachedItem = convertToISOLatin1(item); aoqi@0: aoqi@0: // Run it through the name checks... aoqi@0: aoqi@0: cachedItem = getTypeOrModuleName(cachedItem); aoqi@0: aoqi@0: // Add it to the namesCache... aoqi@0: aoqi@0: env.namesCache.put(item,cachedItem); aoqi@0: } aoqi@0: aoqi@0: result[index--] = cachedItem; aoqi@0: current = current.getQualifier(); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: // If it is supposed to be "boxed", prepend aoqi@0: // IDL_BOXEDIDL_MODULE... aoqi@0: aoqi@0: if (boxIt) { aoqi@0: if (result == null) { aoqi@0: result = IDL_BOXEDIDL_MODULE; aoqi@0: } else { aoqi@0: String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length]; aoqi@0: System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length); aoqi@0: System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length); aoqi@0: result = boxed; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: return result; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Get an array name with the specified dimensions. aoqi@0: *

aoqi@0: * Section 28.3.6 (see ArrayType) aoqi@0: */ aoqi@0: public static String getArrayName (Type theType, int arrayDimension) { aoqi@0: aoqi@0: StringBuffer idlName = new StringBuffer(64); aoqi@0: aoqi@0: // Prefix with seq_... aoqi@0: aoqi@0: idlName.append(IDL_SEQUENCE); aoqi@0: idlName.append(Integer.toString(arrayDimension)); aoqi@0: idlName.append("_"); aoqi@0: aoqi@0: // Add the type name. We need to map any spaces in the aoqi@0: // name to "_"... aoqi@0: aoqi@0: idlName.append(replace(stripLeadingUnderscore(theType.getIDLName())," ","_")); aoqi@0: aoqi@0: // And we're done... aoqi@0: aoqi@0: return idlName.toString(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Get an array module names. aoqi@0: */ aoqi@0: public static String[] getArrayModuleNames (Type theType) { aoqi@0: aoqi@0: String[] moduleName; aoqi@0: String[] typeModule = theType.getIDLModuleNames(); aoqi@0: int typeModuleLength = typeModule.length; aoqi@0: aoqi@0: // Does the type have a module? aoqi@0: aoqi@0: if (typeModuleLength == 0) { aoqi@0: aoqi@0: // Nope, so just use the sequence module... aoqi@0: aoqi@0: moduleName = IDL_SEQUENCE_MODULE; aoqi@0: } else { aoqi@0: aoqi@0: // Yes, so gotta concatenate... aoqi@0: aoqi@0: moduleName = new String[typeModuleLength + IDL_SEQUENCE_MODULE.length]; aoqi@0: System.arraycopy(IDL_SEQUENCE_MODULE,0,moduleName,0,IDL_SEQUENCE_MODULE.length); aoqi@0: System.arraycopy(typeModule,0,moduleName,IDL_SEQUENCE_MODULE.length,typeModuleLength); aoqi@0: } aoqi@0: aoqi@0: return moduleName; aoqi@0: } aoqi@0: aoqi@0: private static int getInitialAttributeKind (CompoundType.Method method, aoqi@0: BatchEnvironment env) throws ClassNotFound { aoqi@0: aoqi@0: int result = ATTRIBUTE_NONE; aoqi@0: aoqi@0: // First make sure it is not a constructor... aoqi@0: aoqi@0: if (!method.isConstructor()) { aoqi@0: aoqi@0: // Now check exceptions. It may not throw any checked aoqi@0: // exception other than RemoteException or one of its aoqi@0: // subclasses... aoqi@0: aoqi@0: boolean validExceptions = true; aoqi@0: ClassType[] exceptions = method.getExceptions(); aoqi@0: aoqi@0: if (exceptions.length > 0) { aoqi@0: for (int i = 0; i < exceptions.length; i++) { aoqi@0: if (exceptions[i].isCheckedException() && aoqi@0: !exceptions[i].isRemoteExceptionOrSubclass()) { aoqi@0: validExceptions = false; aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: } else { aoqi@0: aoqi@0: // If this is a ValueType, it is ok to not have any exceptions, aoqi@0: // otherwise this method does not qualify... aoqi@0: aoqi@0: validExceptions = method.getEnclosing().isType(TYPE_VALUE); aoqi@0: } aoqi@0: aoqi@0: if (validExceptions) { aoqi@0: String name = method.getName(); aoqi@0: int nameLength = name.length(); aoqi@0: int argCount = method.getArguments().length; aoqi@0: Type returnType = method.getReturnType(); aoqi@0: boolean voidReturn = returnType.isType(TYPE_VOID); aoqi@0: boolean booleanReturn = returnType.isType(TYPE_BOOLEAN); aoqi@0: aoqi@0: // It's a getter if name starts with "get" and it has no arguments aoqi@0: // and a return type that is not void... aoqi@0: aoqi@0: if (name.startsWith("get") && nameLength > 3 && argCount == 0 && !voidReturn) { aoqi@0: result = ATTRIBUTE_GET; aoqi@0: } else { aoqi@0: aoqi@0: // It's a getter if name starts with "is" and it has no arguments aoqi@0: // and a boolean return type... aoqi@0: aoqi@0: if (name.startsWith("is") && nameLength > 2 && argCount == 0 && booleanReturn) { aoqi@0: result = ATTRIBUTE_IS; aoqi@0: } else { aoqi@0: aoqi@0: // It's a setter if name starts with "set" and it has 1 argument aoqi@0: // and a void return type... aoqi@0: aoqi@0: if (name.startsWith("set") && nameLength > 3 && argCount == 1 && voidReturn) { aoqi@0: result = ATTRIBUTE_SET; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: return result; aoqi@0: } aoqi@0: aoqi@0: private static void setAttributeKinds (CompoundType.Method[] methods, aoqi@0: int[] kinds, aoqi@0: String[] names) { aoqi@0: aoqi@0: int count = methods.length; aoqi@0: aoqi@0: // Strip the prefixes off of the attribute names... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: switch (kinds[i]) { aoqi@0: case ATTRIBUTE_GET: names[i] = names[i].substring(3); break; aoqi@0: case ATTRIBUTE_IS: names[i] = names[i].substring(2); break; aoqi@0: case ATTRIBUTE_SET: names[i] = names[i].substring(3); break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Now, we need to look at all the IS attributes to see aoqi@0: // if there is a corresponding getter or setter which has aoqi@0: // a different return type. If so, mark it as not an aoqi@0: // attribute. Do this before checking for invalid setters... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: if (kinds[i] == ATTRIBUTE_IS) { aoqi@0: for (int j = 0; j < count; j++) { aoqi@0: if (j != i && aoqi@0: (kinds[j] == ATTRIBUTE_GET || kinds[j] == ATTRIBUTE_SET) && aoqi@0: names[i].equals(names[j])) { aoqi@0: aoqi@0: // We have matching getter or setter. Do the types match? aoqi@0: aoqi@0: Type isType = methods[i].getReturnType(); aoqi@0: Type targetType; aoqi@0: aoqi@0: if (kinds[j] == ATTRIBUTE_GET) { aoqi@0: targetType = methods[j].getReturnType(); aoqi@0: } else { aoqi@0: targetType = methods[j].getArguments()[0]; aoqi@0: } aoqi@0: aoqi@0: if (!isType.equals(targetType)) { aoqi@0: aoqi@0: // No, so forget this guy as an attribute... aoqi@0: aoqi@0: kinds[i] = ATTRIBUTE_NONE; aoqi@0: names[i] = methods[i].getName(); aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Now, we need to look at all the setters to see if there aoqi@0: // is a corresponding getter. If not, it is not a setter. aoqi@0: // If there is, change the getter type to _RW and set the aoqi@0: // pair index... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: if (kinds[i] == ATTRIBUTE_SET) { aoqi@0: int getterIndex = -1; aoqi@0: int isGetterIndex = -1; aoqi@0: // First look for is-getters, then for getters. aoqi@0: // This is preferred for boolean attributes. aoqi@0: for (int j = 0; j < count; j++) { aoqi@0: if (j != i && names[i].equals(names[j])) { aoqi@0: // Yep, is the return type of the getter the same aoqi@0: // as the argument type of the setter? aoqi@0: aoqi@0: Type getterReturn = methods[j].getReturnType(); aoqi@0: Type setterArg = methods[i].getArguments()[0]; aoqi@0: aoqi@0: if (getterReturn.equals(setterArg)) { aoqi@0: if (kinds[j] == ATTRIBUTE_IS) { aoqi@0: isGetterIndex = j; aoqi@0: // continue looking for another getter aoqi@0: } else if (kinds[j] == ATTRIBUTE_GET) { aoqi@0: getterIndex = j; aoqi@0: // continue looking for an is-getter aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: if (getterIndex > -1) { aoqi@0: if (isGetterIndex > -1) { aoqi@0: // We have both, a boolean is-getter and a boolean getter. aoqi@0: // Use the is-getter and drop the getter. aoqi@0: aoqi@0: // We have a matching getter. Change it to a read-write type... aoqi@0: kinds[isGetterIndex] = ATTRIBUTE_IS_RW; aoqi@0: aoqi@0: // Now set the pair index for both the getter and the setter... aoqi@0: methods[isGetterIndex].setAttributePairIndex(i); aoqi@0: methods[i].setAttributePairIndex(isGetterIndex); aoqi@0: aoqi@0: // We found a better matching is-getter. aoqi@0: // Forget this other getter as an attribute. aoqi@0: kinds[getterIndex] = ATTRIBUTE_NONE; aoqi@0: names[getterIndex] = methods[getterIndex].getName(); aoqi@0: } else { aoqi@0: // We only have one getter. aoqi@0: aoqi@0: // We have a matching getter. Change it to a read-write type... aoqi@0: kinds[getterIndex] = ATTRIBUTE_GET_RW; aoqi@0: aoqi@0: // Now set the pair index for both the getter and the setter... aoqi@0: methods[getterIndex].setAttributePairIndex(i); aoqi@0: methods[i].setAttributePairIndex(getterIndex); aoqi@0: } aoqi@0: } else { aoqi@0: if (isGetterIndex > -1) { aoqi@0: // We only have one is-getter. aoqi@0: aoqi@0: // We have a matching getter. Change it to a read-write type... aoqi@0: kinds[isGetterIndex] = ATTRIBUTE_IS_RW; aoqi@0: aoqi@0: // Now set the pair index for both the getter and the setter... aoqi@0: methods[isGetterIndex].setAttributePairIndex(i); aoqi@0: methods[i].setAttributePairIndex(isGetterIndex); aoqi@0: } else { aoqi@0: // We did not find a matching getter. aoqi@0: // Forget this setter as an attribute. aoqi@0: kinds[i] = ATTRIBUTE_NONE; aoqi@0: names[i] = methods[i].getName(); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Finally, do the case conversion and set the aoqi@0: // attribute kinds for each method... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: aoqi@0: if (kinds[i] != ATTRIBUTE_NONE) { aoqi@0: aoqi@0: String name = names[i]; aoqi@0: aoqi@0: // Is the first character upper case? aoqi@0: aoqi@0: if (Character.isUpperCase(name.charAt(0))) { aoqi@0: aoqi@0: // Yes, is the second? aoqi@0: aoqi@0: if (name.length() == 1 || Character.isLowerCase(name.charAt(1))) { aoqi@0: aoqi@0: // No, so convert the first character to lower case... aoqi@0: aoqi@0: StringBuffer buffer = new StringBuffer(name); aoqi@0: buffer.setCharAt(0,Character.toLowerCase(name.charAt(0))); aoqi@0: names[i] = buffer.toString(); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: methods[i].setAttributeKind(kinds[i]); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Set all the method names in a given class. aoqi@0: *

aoqi@0: * Section 28.3.2.7 (see CompoundType) aoqi@0: * Section 28.3.2.7 aoqi@0: * Section 28.3.4.3 (RemoteType/AbstractType only). aoqi@0: */ aoqi@0: public static void setMethodNames (CompoundType container, aoqi@0: CompoundType.Method[] allMethods, aoqi@0: BatchEnvironment env) aoqi@0: throws Exception { aoqi@0: aoqi@0: // This method implements the following name mangling sequence: aoqi@0: // aoqi@0: // 1. If methods belong to a Remote interface, identify aoqi@0: // those which qualify as an attribute under 28.3.4.3. aoqi@0: // Those that do are referred to as 'attributes' below; aoqi@0: // those that do not are referred to as 'methods'. aoqi@0: // aoqi@0: // 2. Apply the 28.3.4.3 manglings, except "__", to all aoqi@0: // attribute names. aoqi@0: // aoqi@0: // 3. Apply all 28.3 manglings, except 28.3.2.7, to all names. aoqi@0: // aoqi@0: // 4. Apply 28.3.2.7 manglings to all method names. aoqi@0: // aoqi@0: // 5. Compare each attribute name to each method name. For aoqi@0: // any which compare equal, append "__" to the attribute aoqi@0: // name. aoqi@0: // aoqi@0: // 6. Compare each name (attribute and method) to all others. aoqi@0: // If any compare equal, throw an Exception with the aoqi@0: // conflicting name as the message. aoqi@0: aoqi@0: int count = allMethods.length; aoqi@0: aoqi@0: if (count == 0) return; aoqi@0: aoqi@0: // Make an array of all the method names... aoqi@0: aoqi@0: String[] names = new String[count]; aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: names[i] = allMethods[i].getName(); aoqi@0: } aoqi@0: aoqi@0: // Are we dealing with a RemoteType, AbstractType, or ValueType? aoqi@0: aoqi@0: CompoundType enclosing = allMethods[0].getEnclosing(); aoqi@0: if (enclosing.isType(TYPE_REMOTE) || aoqi@0: enclosing.isType(TYPE_ABSTRACT) || aoqi@0: enclosing.isType(TYPE_VALUE)) { aoqi@0: aoqi@0: // Yes, so we must do the 28.3.4.3 attribute mapping. First, get aoqi@0: // the initial attribute kind of each method... aoqi@0: aoqi@0: int[] kinds = new int[count]; aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: kinds[i] = getInitialAttributeKind(allMethods[i],env); aoqi@0: } aoqi@0: aoqi@0: // Now set the attribute kind for each method and do the aoqi@0: // 28.3.4.3 name mangling... aoqi@0: aoqi@0: setAttributeKinds(allMethods,kinds,names); aoqi@0: } aoqi@0: aoqi@0: // Make and populate a new context from our names array... aoqi@0: aoqi@0: NameContext context = new NameContext(true); aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: context.put(names[i]); aoqi@0: } aoqi@0: aoqi@0: // Apply the appropriate 28.3 manglings to all the names... aoqi@0: aoqi@0: boolean haveConstructor = false; aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: if (!allMethods[i].isConstructor()) { aoqi@0: names[i] = getMemberOrMethodName(context,names[i],env); aoqi@0: } else { aoqi@0: names[i] = IDL_CONSTRUCTOR; aoqi@0: haveConstructor = true; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Now do the 28.3.2.7 mangling for method name collisions... aoqi@0: // Do this in two passes so that we don't change one during aoqi@0: // the detection of collisions and then miss a real one... aoqi@0: aoqi@0: boolean overloaded[] = new boolean[count]; aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: overloaded[i] = (!allMethods[i].isAttribute() && aoqi@0: !allMethods[i].isConstructor() && aoqi@0: doesMethodCollide(names[i],allMethods[i],allMethods,names,true)); aoqi@0: } aoqi@0: convertOverloadedMethods(allMethods,names,overloaded); aoqi@0: aoqi@0: // Now do the same mangling for constructor name collisions... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: overloaded[i] = (!allMethods[i].isAttribute() && aoqi@0: allMethods[i].isConstructor() && aoqi@0: doesConstructorCollide(names[i],allMethods[i],allMethods,names,true)); aoqi@0: } aoqi@0: convertOverloadedMethods(allMethods,names,overloaded); aoqi@0: aoqi@0: // Now do the 28.3.4.3 mangling for attribute name collisions... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: aoqi@0: CompoundType.Method method = allMethods[i]; aoqi@0: aoqi@0: // If this is an attribute name, does it collide with a method? aoqi@0: aoqi@0: if (method.isAttribute() && aoqi@0: doesMethodCollide(names[i],method,allMethods,names,true)) { aoqi@0: aoqi@0: // Yes, so add double underscore... aoqi@0: aoqi@0: names[i] += "__"; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Do the same mangling for any constructors which collide with aoqi@0: // methods... aoqi@0: aoqi@0: if (haveConstructor) { aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: CompoundType.Method method = allMethods[i]; aoqi@0: aoqi@0: // Is this a constructor which collides with a method? aoqi@0: aoqi@0: if (method.isConstructor() && aoqi@0: doesConstructorCollide(names[i],method,allMethods,names,false)) { aoqi@0: aoqi@0: // Yes, so add double underscore... aoqi@0: aoqi@0: names[i] += "__"; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Now see if we have a collision with the container name (28.3.2.9). aoqi@0: aoqi@0: String containerName = container.getIDLName(); aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: if (names[i].equalsIgnoreCase(containerName)) { aoqi@0: // Do not add underscore to attributes. aoqi@0: // Otherwise getFoo will turn into _get_foo_. aoqi@0: if (! allMethods[i].isAttribute()) { aoqi@0: names[i] += "_"; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Now see if we have any collisions (28.3.2.9). If we do, aoqi@0: // it's an error. Note: a get/set pair does not collide. aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: aoqi@0: // Does it collide with any other name? aoqi@0: aoqi@0: if (doesMethodCollide(names[i],allMethods[i],allMethods,names,false)) { aoqi@0: aoqi@0: // Yes, so bail... aoqi@0: aoqi@0: throw new Exception(allMethods[i].toString()); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Ok. We have unique names. Create the appropriate 'wire' name aoqi@0: // for each and set as the 'idl' name. If it is an attribute, also aoqi@0: // set the attribute name... aoqi@0: aoqi@0: for (int i = 0; i < count; i++) { aoqi@0: aoqi@0: CompoundType.Method method = allMethods[i]; aoqi@0: String wireName = names[i]; aoqi@0: aoqi@0: if (method.isAttribute()) { aoqi@0: wireName = ATTRIBUTE_WIRE_PREFIX[method.getAttributeKind()] + aoqi@0: stripLeadingUnderscore(wireName); aoqi@0: String attributeName = names[i]; aoqi@0: method.setAttributeName(attributeName); aoqi@0: } aoqi@0: method.setIDLName(wireName); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: private static String stripLeadingUnderscore (String name) { aoqi@0: if (name != null && name.length() > 1 aoqi@0: && name.charAt(0) == '_') aoqi@0: { aoqi@0: return name.substring(1); aoqi@0: } aoqi@0: return name; aoqi@0: } aoqi@0: aoqi@0: aoqi@0: private static String stripTrailingUnderscore (String name) { aoqi@0: if (name != null && name.length() > 1 && aoqi@0: name.charAt(name.length() - 1) == '_') aoqi@0: { aoqi@0: return name.substring(0, name.length() - 1); aoqi@0: } aoqi@0: return name; aoqi@0: } aoqi@0: aoqi@0: aoqi@0: private static void convertOverloadedMethods(CompoundType.Method[] allMethods, aoqi@0: String[] names, aoqi@0: boolean[] overloaded) { aoqi@0: aoqi@0: for (int i = 0; i < names.length; i++) { aoqi@0: aoqi@0: // Do we need to mangle it? aoqi@0: aoqi@0: if (overloaded[i]) { aoqi@0: aoqi@0: // Yes, so add arguments... aoqi@0: aoqi@0: CompoundType.Method method = allMethods[i]; aoqi@0: Type[] args = method.getArguments(); aoqi@0: aoqi@0: for (int k = 0; k < args.length; k++) { aoqi@0: aoqi@0: // Add the separator... aoqi@0: aoqi@0: names[i] += "__"; aoqi@0: aoqi@0: // Get the fully qualified IDL name, without the "::" aoqi@0: // prefix... aoqi@0: aoqi@0: String argIDLName = args[k].getQualifiedIDLName(false); aoqi@0: aoqi@0: // Replace any occurances of "::_" with "_" to aoqi@0: // undo any IDL keyword mangling and do next step aoqi@0: // at the same time... aoqi@0: aoqi@0: argIDLName = replace(argIDLName,"::_","_"); aoqi@0: aoqi@0: // Replace any occurances of "::" with "_"... aoqi@0: aoqi@0: argIDLName = replace(argIDLName,"::","_"); aoqi@0: aoqi@0: // Replace any occurances of " " with "_"... aoqi@0: aoqi@0: argIDLName = replace(argIDLName," ","_"); aoqi@0: aoqi@0: // Add the argument type name... aoqi@0: aoqi@0: names[i] += argIDLName; aoqi@0: } aoqi@0: aoqi@0: if (args.length == 0) { aoqi@0: names[i] += "__"; aoqi@0: } aoqi@0: aoqi@0: // Remove any IDL keyword mangling... aoqi@0: aoqi@0: names[i] = stripLeadingUnderscore(names[i]); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: private static boolean doesMethodCollide (String name, aoqi@0: CompoundType.Method method, aoqi@0: CompoundType.Method[] allMethods, aoqi@0: String[] allNames, aoqi@0: boolean ignoreAttributes) { aoqi@0: aoqi@0: // Scan all methods looking for a match... aoqi@0: aoqi@0: for (int i = 0; i < allMethods.length; i++) { aoqi@0: aoqi@0: CompoundType.Method target = allMethods[i]; aoqi@0: aoqi@0: if (method != target && // Not same instance aoqi@0: !target.isConstructor() && // Not a constructor aoqi@0: (!ignoreAttributes || !target.isAttribute()) && // Correct kind aoqi@0: name.equals(allNames[i])) { // Same names aoqi@0: aoqi@0: // Are we looking at a get/set pair? aoqi@0: aoqi@0: int kind1 = method.getAttributeKind(); aoqi@0: int kind2 = target.getAttributeKind(); aoqi@0: aoqi@0: if ((kind1 != ATTRIBUTE_NONE && kind2 != ATTRIBUTE_NONE) && aoqi@0: ((kind1 == ATTRIBUTE_SET && kind2 != ATTRIBUTE_SET) || aoqi@0: (kind1 != ATTRIBUTE_SET && kind2 == ATTRIBUTE_SET) || aoqi@0: // one is a is-getter/setter pair and the other is just a getter aoqi@0: (kind1 == ATTRIBUTE_IS_RW && kind2 == ATTRIBUTE_GET) || aoqi@0: (kind1 == ATTRIBUTE_GET && kind2 == ATTRIBUTE_IS_RW))) { aoqi@0: aoqi@0: // Yes, so ignore it... aoqi@0: aoqi@0: } else { aoqi@0: aoqi@0: // No, so we have a collision... aoqi@0: aoqi@0: return true; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: private static boolean doesConstructorCollide (String name, aoqi@0: CompoundType.Method method, aoqi@0: CompoundType.Method[] allMethods, aoqi@0: String[] allNames, aoqi@0: boolean compareConstructors) { aoqi@0: aoqi@0: // Scan all methods looking for a match... aoqi@0: aoqi@0: for (int i = 0; i < allMethods.length; i++) { aoqi@0: aoqi@0: CompoundType.Method target = allMethods[i]; aoqi@0: aoqi@0: if (method != target && // Not same instance aoqi@0: (target.isConstructor() == compareConstructors) && // Correct kind aoqi@0: name.equals(allNames[i])) { // Same names aoqi@0: aoqi@0: // We have a collision... aoqi@0: aoqi@0: return true; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * Set all the member names in a given class. aoqi@0: *

aoqi@0: * Section 28.3.2.7 (see CompoundType) aoqi@0: * Section 28.3.2.7 aoqi@0: */ aoqi@0: public static void setMemberNames (CompoundType container, aoqi@0: CompoundType.Member[] allMembers, aoqi@0: CompoundType.Method[] allMethods, aoqi@0: BatchEnvironment env) aoqi@0: throws Exception { aoqi@0: aoqi@0: // Make and populate a new context... aoqi@0: aoqi@0: NameContext context = new NameContext(true); aoqi@0: aoqi@0: for (int i = 0; i < allMembers.length; i++) { aoqi@0: context.put(allMembers[i].getName()); aoqi@0: } aoqi@0: aoqi@0: // Now set all the idl names... aoqi@0: aoqi@0: for (int i = 0; i < allMembers.length; i++) { aoqi@0: aoqi@0: CompoundType.Member member = allMembers[i]; aoqi@0: String idlName = getMemberOrMethodName(context,member.getName(),env); aoqi@0: member.setIDLName(idlName); aoqi@0: } aoqi@0: aoqi@0: // First see if we have a collision with the container name (28.3.2.9). aoqi@0: aoqi@0: String containerName = container.getIDLName(); aoqi@0: for (int i = 0; i < allMembers.length; i++) { aoqi@0: String name = allMembers[i].getIDLName(); aoqi@0: if (name.equalsIgnoreCase(containerName)) { aoqi@0: // REVISIT - How is this different than line 788 aoqi@0: allMembers[i].setIDLName(name+"_"); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Check for collisions between member names... aoqi@0: aoqi@0: for (int i = 0; i < allMembers.length; i++) { aoqi@0: String name = allMembers[i].getIDLName(); aoqi@0: for (int j = 0; j < allMembers.length; j++) { aoqi@0: if (i != j && allMembers[j].getIDLName().equals(name)) { aoqi@0: aoqi@0: // Collision... aoqi@0: aoqi@0: throw new Exception(name); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Now check for collisions between member names and aoqi@0: // method names... aoqi@0: aoqi@0: boolean changed; aoqi@0: do { aoqi@0: changed = false; aoqi@0: for (int i = 0; i < allMembers.length; i++) { aoqi@0: String name = allMembers[i].getIDLName(); aoqi@0: for (int j = 0; j < allMethods.length; j++) { aoqi@0: if (allMethods[j].getIDLName().equals(name)) { aoqi@0: aoqi@0: // Collision, so append "_" to member name... aoqi@0: aoqi@0: allMembers[i].setIDLName(name+"_"); aoqi@0: changed = true; aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } while (changed); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Get the name for the specified type code. aoqi@0: *

aoqi@0: * Section 28.3..3 (see PrimitiveType) aoqi@0: * Section 28.3.5.10 (see SpecialClassType) aoqi@0: * Section 28.3.4.1 (see SpecialInterfaceType) aoqi@0: * Section 28.3.10.1 (see SpecialInterfaceType) aoqi@0: * Section 28.3.10.2 (see SpecialClassType) aoqi@0: */ aoqi@0: public static String getTypeName(int typeCode, boolean isConstant) { aoqi@0: aoqi@0: String idlName = null; aoqi@0: aoqi@0: switch (typeCode) { aoqi@0: case TYPE_VOID: idlName = IDL_VOID; break; aoqi@0: case TYPE_BOOLEAN: idlName = IDL_BOOLEAN; break; aoqi@0: case TYPE_BYTE: idlName = IDL_BYTE; break; aoqi@0: case TYPE_CHAR: idlName = IDL_CHAR; break; aoqi@0: case TYPE_SHORT: idlName = IDL_SHORT; break; aoqi@0: case TYPE_INT: idlName = IDL_INT; break; aoqi@0: case TYPE_LONG: idlName = IDL_LONG; break; aoqi@0: case TYPE_FLOAT: idlName = IDL_FLOAT; break; aoqi@0: case TYPE_DOUBLE: idlName = IDL_DOUBLE; break; aoqi@0: case TYPE_ANY: idlName = IDL_ANY; break; aoqi@0: case TYPE_CORBA_OBJECT: idlName = IDL_CORBA_OBJECT; break; aoqi@0: case TYPE_STRING: aoqi@0: { aoqi@0: if (isConstant) { aoqi@0: idlName = IDL_CONSTANT_STRING; aoqi@0: } else { aoqi@0: idlName = IDL_STRING; aoqi@0: } aoqi@0: aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: return idlName; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Create a qualified name. aoqi@0: */ aoqi@0: public static String getQualifiedName (String[] idlModuleNames, String idlName) { aoqi@0: String result = null; aoqi@0: if (idlModuleNames != null && idlModuleNames.length > 0) { aoqi@0: for (int i = 0; i < idlModuleNames.length;i++) { aoqi@0: if (i == 0) { aoqi@0: result = idlModuleNames[0]; aoqi@0: } else { aoqi@0: result += IDL_NAME_SEPARATOR; aoqi@0: result += idlModuleNames[i]; aoqi@0: } aoqi@0: } aoqi@0: result += IDL_NAME_SEPARATOR; aoqi@0: result += idlName; aoqi@0: } else { aoqi@0: result = idlName; aoqi@0: } aoqi@0: return result; aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Replace substrings aoqi@0: * @param source The source string. aoqi@0: * @param match The string to search for within the source string. aoqi@0: * @param replace The replacement for any matching components. aoqi@0: * @return aoqi@0: */ aoqi@0: public static String replace (String source, String match, String replace) { aoqi@0: aoqi@0: int index = source.indexOf(match,0); aoqi@0: aoqi@0: if (index >=0) { aoqi@0: aoqi@0: // We have at least one match, so gotta do the aoqi@0: // work... aoqi@0: aoqi@0: StringBuffer result = new StringBuffer(source.length() + 16); aoqi@0: int matchLength = match.length(); aoqi@0: int startIndex = 0; aoqi@0: aoqi@0: while (index >= 0) { aoqi@0: result.append(source.substring(startIndex,index)); aoqi@0: result.append(replace); aoqi@0: startIndex = index + matchLength; aoqi@0: index = source.indexOf(match,startIndex); aoqi@0: } aoqi@0: aoqi@0: // Grab the last piece, if any... aoqi@0: aoqi@0: if (startIndex < source.length()) { aoqi@0: result.append(source.substring(startIndex)); aoqi@0: } aoqi@0: aoqi@0: return result.toString(); aoqi@0: aoqi@0: } else { aoqi@0: aoqi@0: // No matches, just return the source... aoqi@0: aoqi@0: return source; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Get an IDL style repository id for aoqi@0: */ aoqi@0: public static String getIDLRepositoryID (String idlName) { aoqi@0: return IDL_REPOSITORY_ID_PREFIX + aoqi@0: replace(idlName,"::", "/") + aoqi@0: IDL_REPOSITORY_ID_VERSION; aoqi@0: } aoqi@0: aoqi@0: //_____________________________________________________________________ aoqi@0: // Internal Interfaces aoqi@0: //_____________________________________________________________________ aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * Convert a type or module name. aoqi@0: *

aoqi@0: * Section 28.3.2.2 aoqi@0: * Section 28.3.2.3 aoqi@0: */ aoqi@0: private static String getTypeOrModuleName (String name) { aoqi@0: aoqi@0: // 28.3.2.3 Leading underscores... aoqi@0: aoqi@0: String result = convertLeadingUnderscores(name); aoqi@0: aoqi@0: // 28.3.2.2 IDL keywords (NOTE: must be done aoqi@0: // after leading underscore conversion because aoqi@0: // the mangling for IDL keywords creates a aoqi@0: // leading underscore!)... aoqi@0: aoqi@0: return convertIDLKeywords(result); aoqi@0: } aoqi@0: }