### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/core/Signature.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java,v retrieving revision 1.95 diff -u -r1.95 Signature.java --- model/org/eclipse/jdt/core/Signature.java 12 Sep 2008 10:32:15 -0000 1.95 +++ model/org/eclipse/jdt/core/Signature.java 10 Dec 2009 16:47:17 -0000 @@ -138,6 +138,9 @@ *

* This class provides static methods and constants only. *

+ *

Note: An empty signature is considered to be syntactically incorrect. So most methods will throw + * an IllegalArgumentException if an empty signature is provided.

+ * * @noinstantiate This class is not intended to be instantiated by clients. */ public final class Signature { @@ -2141,7 +2144,7 @@ * @param includeReturnType true if the return type is to be * included * @return the char array representation of the method signature - * + * @throws IllegalArgumentException if the method signature is syntactically incorrect * @since 2.0 */ public static char[] toCharArray(char[] methodSignature, char[] methodName, char[][] parameterNames, boolean fullyQualifyTypeNames, boolean includeReturnType) { @@ -2172,6 +2175,7 @@ * @param isVargArgs true if the last argument should be displayed as a * variable argument, false otherwise. * @return the char array representation of the method signature + * @throws IllegalArgumentException if the method signature is syntactically incorrect * * @since 3.1 */ @@ -2242,14 +2246,16 @@ * * @param signature the type signature * @return the string representation of the type - * @exception IllegalArgumentException if the signature is not syntactically - * correct + * @exception IllegalArgumentException if the signature is syntactically incorrect * * @since 2.0 */ public static char[] toCharArray(char[] signature) throws IllegalArgumentException { int sigLength = signature.length; - if (sigLength == 0 || signature[0] == C_PARAM_START || signature[0] == C_GENERIC_START) { + if (sigLength == 0) { + throw new IllegalArgumentException(); + } + if (signature[0] == C_PARAM_START || signature[0] == C_GENERIC_START) { return toCharArray(signature, CharOperation.NO_CHAR, null, true, true); }