0N/A/*
2362N/A * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage sun.rmi.rmic;
0N/A
0N/Aimport sun.tools.java.Identifier;
0N/A
0N/A/**
0N/A * Names provides static utility methods used by other rmic classes
0N/A * for dealing with identifiers.
0N/A *
0N/A * WARNING: The contents of this source file are not part of any
0N/A * supported API. Code that depends on them does so at its own risk:
0N/A * they are subject to change or removal without notice.
0N/A */
0N/Apublic class Names {
0N/A
0N/A /**
0N/A * Return stub class name for impl class name.
0N/A */
0N/A static final public Identifier stubFor(Identifier name) {
0N/A return Identifier.lookup(name + "_Stub");
0N/A }
0N/A
0N/A /**
0N/A * Return skeleton class name for impl class name.
0N/A */
0N/A static final public Identifier skeletonFor(Identifier name) {
0N/A return Identifier.lookup(name + "_Skel");
0N/A }
0N/A
0N/A /**
0N/A * If necessary, convert a class name to its mangled form, i.e. the
0N/A * non-inner class name used in the binary representation of
0N/A * inner classes. This is necessary to be able to name inner
0N/A * classes in the generated source code in places where the language
0N/A * does not permit it, such as when synthetically defining an inner
0N/A * class outside of its outer class, and for generating file names
0N/A * corresponding to inner classes.
0N/A *
0N/A * Currently this mangling involves modifying the internal names of
0N/A * inner classes by converting occurrences of ". " into "$".
0N/A *
0N/A * This code is taken from the "mangleInnerType" method of
0N/A * the "sun.tools.java.Type" class; this method cannot be accessed
0N/A * itself because it is package protected.
0N/A */
0N/A static final public Identifier mangleClass(Identifier className) {
0N/A if (!className.isInner())
0N/A return className;
0N/A
0N/A /*
0N/A * Get '.' qualified inner class name (with outer class
0N/A * qualification and no package qualification) and replace
0N/A * each '.' with '$'.
0N/A */
0N/A Identifier mangled = Identifier.lookup(
0N/A className.getFlatName().toString()
0N/A .replace('.', sun.tools.java.Constants.SIGC_INNERCLASS));
0N/A if (mangled.isInner())
0N/A throw new Error("failed to mangle inner class name");
0N/A
0N/A // prepend package qualifier back for returned identifier
0N/A return Identifier.lookup(className.getQualifier(), mangled);
0N/A }
0N/A}