Util.java revision 0
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * This code is free software; you can redistribute it and/or modify it
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * under the terms of the GNU General Public License version 2 only, as
fa9e4066f08beec538e775443c5be79dd423fcabahrens * published by the Free Software Foundation. Sun designates this
fa9e4066f08beec538e775443c5be79dd423fcabahrens * particular file as subject to the "Classpath" exception as provided
fa9e4066f08beec538e775443c5be79dd423fcabahrens * by Sun in the LICENSE file that accompanied this code.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * This code is distributed in the hope that it will be useful, but WITHOUT
fa9e4066f08beec538e775443c5be79dd423fcabahrens * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fa9e4066f08beec538e775443c5be79dd423fcabahrens * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fa9e4066f08beec538e775443c5be79dd423fcabahrens * version 2 for more details (a copy is included in the LICENSE file that
fa9e4066f08beec538e775443c5be79dd423fcabahrens * accompanied this code).
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You should have received a copy of the GNU General Public License version
fa9e4066f08beec538e775443c5be79dd423fcabahrens * 2 along with this work; if not, write to the Free Software Foundation,
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
e6032be1b8a5a1d03081e0d62b624db95c4cf8b7marks * CA 95054 USA or visit www.sun.com if you need additional information or
fa9e4066f08beec538e775443c5be79dd423fcabahrens * have any questions.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Provides static utility methods.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * WARNING: The contents of this source file are not part of any
fa9e4066f08beec538e775443c5be79dd423fcabahrens * supported API. Code that depends on them does so at its own risk:
fa9e4066f08beec538e775443c5be79dd423fcabahrens * they are subject to change or removal without notice.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * @author Peter Jones
fa9e4066f08beec538e775443c5be79dd423fcabahrensfinal class Util {
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Returns the binary name of the class or interface represented
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * by the specified ClassDoc.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return packageName.equals("") ? flat : packageName + "." + flat;
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Returns the method descriptor for the specified method.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See section 4.3.3 of The Java Virtual Machine Specification
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Second Edition for the definition of a "method descriptor".
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Returns the descriptor for the specified type, as appropriate
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * for either a parameter or return type in a method descriptor.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Handle primitive types.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Handle non-array reference types.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw desc = "L" + binaryNameOf(classDoc).replace('.', '/') + ";";
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Handle array types.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Returns a reader-friendly string representation of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specified method's signature. Names of reference types are not
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * package-qualified.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw static String getFriendlyUnqualifiedSignature(MethodDoc method) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (i > 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Returns true if the specified type is void.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw return type.asClassDoc() == null && type.typeName().equals("void");