Index: model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java,v retrieving revision 1.33 diff -u -r1.33 DefaultBytecodeVisitor.java --- model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java 8 Apr 2005 20:30:28 -0000 1.33 +++ model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java 31 May 2005 01:32:25 -0000 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.core.util; +import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; import org.eclipse.jdt.core.util.IBytecodeVisitor; @@ -26,6 +27,7 @@ */ public class DefaultBytecodeVisitor implements IBytecodeVisitor { private static final String EMPTY_CLASS_NAME = "\"\""; //$NON-NLS-1$ + private static final String EMPTY_LOCAL_NAME = ""; //$NON-NLS-1$ private static final int T_BOOLEAN = 4; private static final int T_CHAR = 5; private static final int T_FLOAT = 6; @@ -153,7 +155,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_load, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.ALOAD], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -214,6 +216,10 @@ writeNewLine(); } private String getLocalVariableName(int pc, int index) { + return getLocalVariableName(pc, index, false); + } + + private String getLocalVariableName(int pc, int index, boolean showIndex) { int nextPC = pc + 1; switch(index) { case 0 : @@ -229,11 +235,20 @@ final ILocalVariableTableEntry entry = this.localVariableTableEntries[i]; final int startPC = entry.getStartPC(); if (entry.getIndex() == index && (startPC <= nextPC) && ((startPC + entry.getLength()) > nextPC)) { - return new String(entry.getName()); + final StringBuffer stringBuffer = new StringBuffer(); + if (showIndex) { + stringBuffer.append(' ').append(index); + } + stringBuffer.append(' ').append('[').append(entry.getName()).append(']'); + return String.valueOf(stringBuffer); } } - String localVariableName = Messages.bind(Messages.disassembler_localvariablename, (new String[] {Integer.toString(index)})); - return localVariableName; + if (showIndex) { + final StringBuffer stringBuffer = new StringBuffer(); + stringBuffer.append(' ').append(index); + return String.valueOf(stringBuffer); + } + return EMPTY_LOCAL_NAME; } /** @@ -267,7 +282,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_store, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.ASTORE], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -496,7 +511,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_load, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.DLOAD], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -592,7 +607,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_store, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.DSTORE], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -823,7 +838,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_load, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.FLOAD], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -919,7 +934,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_store, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.FSTORE], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -943,7 +958,7 @@ Integer.toString(index), returnDeclaringClassName(constantFieldref), new String(constantFieldref.getFieldName()), - new String(constantFieldref.getFieldDescriptor()) + returnClassName(Signature.toCharArray(constantFieldref.getFieldDescriptor())) }))); writeNewLine(); } @@ -954,12 +969,12 @@ public void _getstatic(int pc, int index, IConstantPoolEntry constantFieldref) { dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_getstatic, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.GETSTATIC], - Integer.toString(index), - returnDeclaringClassName(constantFieldref), - new String(constantFieldref.getFieldName()), - new String(constantFieldref.getFieldDescriptor()) - }))); + OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.GETSTATIC], + Integer.toString(index), + returnDeclaringClassName(constantFieldref), + new String(constantFieldref.getFieldName()), + returnClassName(Signature.toCharArray(constantFieldref.getFieldDescriptor())) + }))); writeNewLine(); } @@ -1392,7 +1407,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_load, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.ILOAD], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -1438,27 +1453,17 @@ IConstantPoolEntry constantInterfaceMethodref) { dumpPcNumber(pc); - if (isCompact()) { - buffer.append(Messages.bind(Messages.classformat_invokeinterface_compact, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEINTERFACE], - Integer.toString(index), - Integer.toString(nargs), - Util.toString( - constantInterfaceMethodref.getClassName(), - constantInterfaceMethodref.getMethodName(), - constantInterfaceMethodref.getMethodDescriptor(), - true) - }))); - } else { - buffer.append(Messages.bind(Messages.classformat_invokeinterface, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEINTERFACE], - Integer.toString(index), - Integer.toString(nargs), - returnDeclaringClassName(constantInterfaceMethodref), - new String(constantInterfaceMethodref.getMethodName()), - new String(constantInterfaceMethodref.getMethodDescriptor()), - }))); - } + buffer.append(Messages.bind(Messages.classformat_invokeinterface, (new String[] { + OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEINTERFACE], + Integer.toString(index), + Integer.toString(nargs), + Util.toString( + constantInterfaceMethodref.getClassName(), + constantInterfaceMethodref.getMethodName(), + constantInterfaceMethodref.getMethodDescriptor(), + true, + isCompact()) + }))); writeNewLine(); } @@ -1467,25 +1472,16 @@ */ public void _invokespecial(int pc, int index, IConstantPoolEntry constantMethodref) { dumpPcNumber(pc); - if (isCompact()) { - buffer.append(Messages.bind(Messages.classformat_invokespecial_compact, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKESPECIAL], - Integer.toString(index), - Util.toString( - constantMethodref.getClassName(), - constantMethodref.getMethodName(), - constantMethodref.getMethodDescriptor(), - true) - }))); - } else { - buffer.append(Messages.bind(Messages.classformat_invokespecial, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKESPECIAL], - Integer.toString(index), - returnDeclaringClassName(constantMethodref), - new String(constantMethodref.getMethodName()), - new String(constantMethodref.getMethodDescriptor()), - }))); - } + buffer.append(Messages.bind(Messages.classformat_invokespecial, (new String[] { + OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKESPECIAL], + Integer.toString(index), + Util.toString( + constantMethodref.getClassName(), + constantMethodref.getMethodName(), + constantMethodref.getMethodDescriptor(), + true, + isCompact()) + }))); writeNewLine(); } @@ -1494,25 +1490,16 @@ */ public void _invokestatic(int pc, int index, IConstantPoolEntry constantMethodref) { dumpPcNumber(pc); - if (isCompact()) { - buffer.append(Messages.bind(Messages.classformat_invokestatic_compact, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKESTATIC], - Integer.toString(index), - Util.toString( - constantMethodref.getClassName(), - constantMethodref.getMethodName(), - constantMethodref.getMethodDescriptor(), - true) - }))); - } else { - buffer.append(Messages.bind(Messages.classformat_invokestatic, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKESTATIC], - Integer.toString(index), - returnDeclaringClassName(constantMethodref), - new String(constantMethodref.getMethodName()), - new String(constantMethodref.getMethodDescriptor()), - }))); - } + buffer.append(Messages.bind(Messages.classformat_invokestatic, (new String[] { + OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKESTATIC], + Integer.toString(index), + Util.toString( + constantMethodref.getClassName(), + constantMethodref.getMethodName(), + constantMethodref.getMethodDescriptor(), + true, + isCompact()) + }))); writeNewLine(); } @@ -1521,25 +1508,16 @@ */ public void _invokevirtual(int pc, int index, IConstantPoolEntry constantMethodref) { dumpPcNumber(pc); - if (isCompact()) { - buffer.append(Messages.bind(Messages.classformat_invokevirtual_compact, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEVIRTUAL], - Integer.toString(index), - Util.toString( - constantMethodref.getClassName(), - constantMethodref.getMethodName(), - constantMethodref.getMethodDescriptor(), - true) - }))); - } else { - buffer.append(Messages.bind(Messages.classformat_invokevirtual, (new String[] { - OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEVIRTUAL], - Integer.toString(index), - returnDeclaringClassName(constantMethodref), - new String(constantMethodref.getMethodName()), - new String(constantMethodref.getMethodDescriptor()), - }))); - } + buffer.append(Messages.bind(Messages.classformat_invokevirtual, (new String[] { + OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEVIRTUAL], + Integer.toString(index), + Util.toString( + constantMethodref.getClassName(), + constantMethodref.getMethodName(), + constantMethodref.getMethodDescriptor(), + true, + isCompact()) + }))); writeNewLine(); } @@ -1643,7 +1621,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_store, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.ISTORE], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -1948,7 +1926,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_load, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.LLOAD], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -2091,7 +2069,7 @@ dumpPcNumber(pc); buffer.append(Messages.bind(Messages.classformat_store, (new String[] { OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.LSTORE], - getLocalVariableName(pc, index) + getLocalVariableName(pc, index, true) }))); writeNewLine(); } @@ -2266,7 +2244,7 @@ Integer.toString(index), returnDeclaringClassName(constantFieldref), new String(constantFieldref.getFieldName()), - new String(constantFieldref.getFieldDescriptor()) + returnClassName(Signature.toCharArray(constantFieldref.getFieldDescriptor())) }))); writeNewLine(); } @@ -2281,7 +2259,7 @@ Integer.toString(index), returnDeclaringClassName(constantFieldref), new String(constantFieldref.getFieldName()), - new String(constantFieldref.getFieldDescriptor()) + returnClassName(Signature.toCharArray(constantFieldref.getFieldDescriptor())) }))); writeNewLine(); } @@ -2464,6 +2442,9 @@ private String returnConstantClassName(IConstantPoolEntry constantClass) { char[] classInfoName = constantClass.getClassInfoName(); + return returnClassName(classInfoName); + } + private String returnClassName(char[] classInfoName) { if (classInfoName.length == 0) { return EMPTY_CLASS_NAME; } else if (isCompact()) { @@ -2471,22 +2452,14 @@ if (lastIndexOfSlash != -1) { return new String(classInfoName, lastIndexOfSlash + 1, classInfoName.length - lastIndexOfSlash - 1); } - return new String(classInfoName); - } else { - return new String(classInfoName); } + CharOperation.replace(classInfoName, '/', '.'); + return new String(classInfoName); } private String returnDeclaringClassName(IConstantPoolEntry constantRef) { - if (isCompact()) { - char[] className = constantRef.getClassName(); - int lastIndexOfSlash = CharOperation.lastIndexOf('/', className); - if (lastIndexOfSlash != -1) { - return new String(className, lastIndexOfSlash + 1, className.length - lastIndexOfSlash - 1); - } - return new String(constantRef.getClassName()); - } - return new String(constantRef.getClassName()); + final char[] className = constantRef.getClassName(); + return returnClassName(className); } private void writeNewLine() { Index: model/org/eclipse/jdt/internal/core/util/Disassembler.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java,v retrieving revision 1.60 diff -u -r1.60 Disassembler.java --- model/org/eclipse/jdt/internal/core/util/Disassembler.java 8 Apr 2005 20:30:28 -0000 1.60 +++ model/org/eclipse/jdt/internal/core/util/Disassembler.java 31 May 2005 01:32:26 -0000 @@ -39,6 +39,7 @@ */ public class Disassembler extends ClassFileBytesDisassembler { + private static final String EMPTY_CLASS_NAME = "\"\""; //$NON-NLS-1$ private static final char[] ANY_EXCEPTION = Messages.classfileformat_anyexceptionhandler.toCharArray(); private static final String EMPTY_OUTPUT = ""; //$NON-NLS-1$ private static final String VERSION_UNKNOWN = "unknown";//$NON-NLS-1$ @@ -394,13 +395,13 @@ char[] exceptionName = exceptionNames[i]; CharOperation.replace(exceptionName, '/', '.'); buffer - .append(exceptionName) + .append(returnClassName(exceptionName, '.', mode)) .append(Messages.disassembler_comma) .append(Messages.disassembler_space); } char[] exceptionName = exceptionNames[length - 1]; CharOperation.replace(exceptionName, '/', '.'); - buffer.append(exceptionName); + buffer.append(returnClassName(exceptionName, '.', mode)); } if (checkMode(mode, DETAILED)) { if (annotationDefaultAttribute != null) { @@ -578,7 +579,7 @@ if (superclassName != null) { buffer.append(" extends "); //$NON-NLS-1$ CharOperation.replace(superclassName, '/', '.'); - buffer.append(superclassName); + buffer.append(returnClassName(superclassName, '.', mode)); } char[][] superclassInterfaces = classFileReader.getInterfaceNames(); int length = superclassInterfaces.length; @@ -588,13 +589,13 @@ char[] superinterface = superclassInterfaces[i]; CharOperation.replace(superinterface, '/', '.'); buffer - .append(superinterface) + .append(returnClassName(superinterface, '.', mode)) .append(Messages.disassembler_comma) .append(Messages.disassembler_space); } char[] superinterface = superclassInterfaces[length - 1]; CharOperation.replace(superinterface, '/', '.'); - buffer.append(superinterface); + buffer.append(returnClassName(superinterface, '.', mode)); } buffer.append(Messages.bind(Messages.disassembler_opentypedeclaration)); if (checkMode(mode, SYSTEM)) { @@ -743,13 +744,15 @@ int index= localVariableTableEntry.getIndex(); int startPC = localVariableTableEntry.getStartPC(); int length = localVariableTableEntry.getLength(); + final char[] typeName = Signature.toCharArray(localVariableTableEntry.getDescriptor()); + CharOperation.replace(typeName, '/', '.'); buffer.append(Messages.bind(Messages.classfileformat_localvariabletableentry, new String[] { Integer.toString(startPC), Integer.toString(startPC + length), new String(localVariableTableEntry.getName()), Integer.toString(index), - new String(localVariableTableEntry.getDescriptor()) + new String(returnClassName(typeName, '.', mode)) })); writeNewLine(buffer, lineSeparator, tabNumberForLocalVariableAttribute + 1); } @@ -757,13 +760,15 @@ int index= localVariableTableEntry.getIndex(); int startPC = localVariableTableEntry.getStartPC(); int length = localVariableTableEntry.getLength(); + final char[] typeName = Signature.toCharArray(localVariableTableEntry.getDescriptor()); + CharOperation.replace(typeName, '/', '.'); buffer.append(Messages.bind(Messages.classfileformat_localvariabletableentry, new String[] { Integer.toString(startPC), Integer.toString(startPC + length), new String(localVariableTableEntry.getName()), Integer.toString(index), - new String(localVariableTableEntry.getDescriptor()) + new String(returnClassName(typeName, '.', mode)) })); } ILocalVariableTypeTableAttribute localVariableTypeAttribute= getLocalVariableTypeAttribute(codeAttribute); @@ -779,13 +784,15 @@ int index= localVariableTypeTableEntry.getIndex(); int startPC = localVariableTypeTableEntry.getStartPC(); int length = localVariableTypeTableEntry.getLength(); + final char[] typeName = Signature.toCharArray(localVariableTypeTableEntry.getSignature()); + CharOperation.replace(typeName, '/', '.'); buffer.append(Messages.bind(Messages.classfileformat_localvariabletableentry, new String[] { Integer.toString(startPC), Integer.toString(startPC + length), new String(localVariableTypeTableEntry.getName()), Integer.toString(index), - new String(localVariableTypeTableEntry.getSignature()) + new String(returnClassName(typeName, '.', mode)) })); writeNewLine(buffer, lineSeparator, tabNumberForLocalVariableAttribute + 1); } @@ -793,13 +800,15 @@ int index= localVariableTypeTableEntry.getIndex(); int startPC = localVariableTypeTableEntry.getStartPC(); int length = localVariableTypeTableEntry.getLength(); + final char[] typeName = Signature.toCharArray(localVariableTypeTableEntry.getSignature()); + CharOperation.replace(typeName, '/', '.'); buffer.append(Messages.bind(Messages.classfileformat_localvariabletableentry, new String[] { Integer.toString(startPC), Integer.toString(startPC + length), new String(localVariableTypeTableEntry.getName()), Integer.toString(index), - new String(localVariableTypeTableEntry.getSignature()) + new String(returnClassName(typeName, '.', mode)) })); } } @@ -1438,6 +1447,24 @@ return (mode & flag) != 0; } + private boolean isCompact(int mode) { + return (mode & ClassFileBytesDisassembler.COMPACT) != 0; + } + + private String returnClassName(char[] classInfoName, char separator, int mode) { + if (classInfoName.length == 0) { + return EMPTY_CLASS_NAME; + } else if (isCompact(mode)) { + int lastIndexOfSlash = CharOperation.lastIndexOf(separator, classInfoName); + if (lastIndexOfSlash != -1) { + return new String(classInfoName, lastIndexOfSlash + 1, classInfoName.length - lastIndexOfSlash - 1); + } + return new String(classInfoName); + } else { + return new String(classInfoName); + } + } + private void writeNewLine(StringBuffer buffer, String lineSeparator, int tabNumber) { buffer.append(lineSeparator); dumpTab(tabNumber, buffer); Index: model/org/eclipse/jdt/internal/core/util/Messages.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java,v retrieving revision 1.3 diff -u -r1.3 Messages.java --- model/org/eclipse/jdt/internal/core/util/Messages.java 25 May 2005 16:08:55 -0000 1.3 +++ model/org/eclipse/jdt/internal/core/util/Messages.java 31 May 2005 01:32:26 -0000 @@ -291,13 +291,9 @@ public static String classformat_new; public static String classformat_iinc; public static String classformat_invokespecial; - public static String classformat_invokespecial_compact; public static String classformat_invokeinterface; - public static String classformat_invokeinterface_compact; public static String classformat_invokestatic; - public static String classformat_invokestatic_compact; public static String classformat_invokevirtual; - public static String classformat_invokevirtual_compact; public static String classformat_getfield; public static String classformat_getstatic; public static String classformat_putstatic; Index: model/org/eclipse/jdt/internal/core/util/Util.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java,v retrieving revision 1.67 diff -u -r1.67 Util.java --- model/org/eclipse/jdt/internal/core/util/Util.java 25 May 2005 14:16:34 -0000 1.67 +++ model/org/eclipse/jdt/internal/core/util/Util.java 31 May 2005 01:32:27 -0000 @@ -2022,7 +2022,7 @@ } return result; } - private static void appendArrayTypeSignature(char[] string, int start, StringBuffer buffer) { + private static void appendArrayTypeSignature(char[] string, int start, StringBuffer buffer, boolean compact) { // need a minimum 2 char if (start >= string.length - 1) { throw new IllegalArgumentException(); @@ -2031,10 +2031,10 @@ if (c != Signature.C_ARRAY) { //$NON-NLS-1$ throw new IllegalArgumentException(); } - appendTypeSignature(string, start + 1, buffer); + appendTypeSignature(string, start + 1, buffer, compact); buffer.append('[').append(']'); } - private static void appendClassTypeSignature(char[] string, int start, StringBuffer buffer) { + private static void appendClassTypeSignature(char[] string, int start, StringBuffer buffer, boolean compact) { char c = string[start]; if (c != Signature.C_RESOLVED) { return; @@ -2048,12 +2048,13 @@ // all done return; case Signature.C_DOT : + case '/' : // erase package prefix - buffer.setLength(checkpoint); - break; - case '/' : - // erase package prefix - buffer.setLength(checkpoint); + if (compact) { + buffer.setLength(checkpoint); + } else { + buffer.append('.'); + } break; case Signature.C_DOLLAR : /** @@ -2070,14 +2071,14 @@ p++; } } - static void appendTypeSignature(char[] string, int start, StringBuffer buffer) { + static void appendTypeSignature(char[] string, int start, StringBuffer buffer, boolean compact) { char c = string[start]; switch (c) { case Signature.C_ARRAY : - appendArrayTypeSignature(string, start, buffer); + appendArrayTypeSignature(string, start, buffer, compact); break; case Signature.C_RESOLVED : - appendClassTypeSignature(string, start, buffer); + appendClassTypeSignature(string, start, buffer, compact); break; case Signature.C_TYPE_VARIABLE : int e = Util.scanTypeVariableSignature(string, start); @@ -2112,8 +2113,8 @@ break; } } - public static String toString(char[] declaringClass, char[] methodName, char[] methodSignature, boolean includeReturnType) { - boolean isConstructor = CharOperation.equals(methodName, INIT); + public static String toString(char[] declaringClass, char[] methodName, char[] methodSignature, boolean includeReturnType, boolean compact) { + final boolean isConstructor = CharOperation.equals(methodName, INIT); int firstParen = CharOperation.indexOf(Signature.C_PARAM_START, methodSignature); if (firstParen == -1) { return ""; //$NON-NLS-1$ @@ -2121,20 +2122,12 @@ StringBuffer buffer = new StringBuffer(methodSignature.length + 10); - if (!isConstructor) { - // return type - if (includeReturnType) { - char[] rts = Signature.getReturnType(methodSignature); - appendTypeSignature(rts, 0 , buffer); - buffer.append(' '); - } - } - // selector int lastIndexOfSlash = CharOperation.lastIndexOf('/', declaringClass); - if (lastIndexOfSlash != -1) { + if (compact && lastIndexOfSlash != -1) { buffer.append(declaringClass, lastIndexOfSlash + 1, declaringClass.length - lastIndexOfSlash - 1); } else { + CharOperation.replace(declaringClass, '/', '.'); buffer.append(declaringClass); } if (!isConstructor) { @@ -2149,17 +2142,23 @@ buffer.append('('); char[][] pts = Signature.getParameterTypes(methodSignature); for (int i = 0, max = pts.length; i < max; i++) { - if (i == max - 1) { - appendTypeSignature(pts[i], 0 , buffer); - } else { - appendTypeSignature(pts[i], 0 , buffer); - } + appendTypeSignature(pts[i], 0 , buffer, compact); if (i != pts.length - 1) { buffer.append(','); buffer.append(' '); } } buffer.append(')'); + + if (!isConstructor) { + buffer.append(" : "); //$NON-NLS-1$ + // return type + if (includeReturnType) { + char[] rts = Signature.getReturnType(methodSignature); + appendTypeSignature(rts, 0 , buffer, compact); + buffer.append(' '); + } + } return String.valueOf(buffer); } /* Index: model/org/eclipse/jdt/internal/core/util/messages.properties =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties,v retrieving revision 1.43 diff -u -r1.43 messages.properties --- model/org/eclipse/jdt/internal/core/util/messages.properties 25 May 2005 16:08:55 -0000 1.43 +++ model/org/eclipse/jdt/internal/core/util/messages.properties 31 May 2005 01:32:27 -0000 @@ -317,18 +317,14 @@ classformat_multianewarray = {0} {2}{3} [{1}] classformat_new = {0} {2} [{1}] classformat_iinc = {0} {1} {2} [{3}] -classformat_invokespecial = {0} {2}.{3}{4} [{1}] -classformat_invokespecial_compact ={0} {2} [{1}] -classformat_invokeinterface ={0} {3}.{4}{5} [{1}] [nargs: {2}] -classformat_invokeinterface_compact ={0} {3} [{1}] [nargs: {2}] -classformat_invokestatic ={0} {2}.{3}{4} [{1}] -classformat_invokestatic_compact ={0} {2} [{1}] -classformat_invokevirtual ={0} {2}.{3}{4} [{1}] -classformat_invokevirtual_compact ={0} {2} [{1}] -classformat_getfield ={0} {2}.{3} {4} [{1}] -classformat_getstatic ={0} {2}.{3} {4} [{1}] -classformat_putstatic ={0} {2}.{3} {4} [{1}] -classformat_putfield ={0} {2}.{3} {4} [{1}] +classformat_invokespecial ={0} {2} [{1}] +classformat_invokeinterface ={0} {3} [{1}] [nargs: {2}] +classformat_invokestatic ={0} {2} [{1}] +classformat_invokevirtual ={0} {2} [{1}] +classformat_getfield ={0} {2}.{3} : {4} [{1}] +classformat_getstatic ={0} {2}.{3} : {4} [{1}] +classformat_putstatic ={0} {2}.{3} : {4} [{1}] +classformat_putfield ={0} {2}.{3} : {4} [{1}] classformat_newarray_boolean = {0} boolean [{1}] classformat_newarray_char = {0} char [{1}] classformat_newarray_float = {0} float [{1}] @@ -337,8 +333,8 @@ classformat_newarray_short = {0} short [{1}] classformat_newarray_int = {0} int [{1}] classformat_newarray_long = {0} long [{1}] -classformat_store = {0} [{1}] -classformat_load = {0} [{1}] +classformat_store = {0}{1} +classformat_load = {0}{1} classfileformat_anyexceptionhandler=any classfileformat_exceptiontableentry = [pc: {0}, pc: {1}] -> {2} when : {3} classfileformat_linenumbertableentry = [pc: {0}, line: {1}]