diff options
Diffstat (limited to 'org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java')
-rw-r--r-- | org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java index cd53f09779..2b323ea5c7 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -2515,11 +2515,11 @@ public class Util { int length = string.length; // need a minimum 2 char if (start >= length - 1) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } char c = string[start]; if (c != Signature.C_ARRAY) { - throw raiseUnexpectedCharacterException(string, start, c); + throw newUnexpectedCharacterException(string, start, c); } int index = start; @@ -2527,7 +2527,7 @@ public class Util { while(c == Signature.C_ARRAY) { // need a minimum 2 char if (index >= length - 1) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } c = string[++index]; } @@ -3023,7 +3023,7 @@ public class Util { public static char[] toAnchor(int startingIndex, char[] methodSignature, char[] methodName, boolean isVargArgs) { int firstParen = CharOperation.indexOf(Signature.C_PARAM_START, methodSignature); if (firstParen == -1) { - throw new IllegalArgumentException(new String(methodSignature)); + throw new IllegalArgumentException(String.valueOf(methodSignature)); } StringBuffer buffer = new StringBuffer(methodSignature.length + 10); @@ -3056,7 +3056,7 @@ public class Util { private static int appendTypeSignatureForAnchor(char[] string, int start, StringBuffer buffer, boolean isVarArgs) { // need a minimum 1 char if (start >= string.length) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } char c = string[start]; if (isVarArgs) { @@ -3080,7 +3080,7 @@ public class Util { case Signature.C_CAPTURE: default: // a var args is an array type - throw raiseUnexpectedCharacterException(string, start, c); + throw newUnexpectedCharacterException(string, start, c); } } else { switch (c) { @@ -3126,7 +3126,7 @@ public class Util { case Signature.C_SUPER: return appendTypeArgumentSignatureForAnchor(string, start, buffer); default : - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } } } @@ -3134,7 +3134,7 @@ public class Util { private static int appendTypeArgumentSignatureForAnchor(char[] string, int start, StringBuffer buffer) { // need a minimum 1 char if (start >= string.length) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } char c = string[start]; switch(c) { @@ -3151,11 +3151,11 @@ public class Util { private static int appendCaptureTypeSignatureForAnchor(char[] string, int start, StringBuffer buffer) { // need a minimum 2 char if (start >= string.length - 1) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } char c = string[start]; if (c != Signature.C_CAPTURE) { - throw raiseUnexpectedCharacterException(string, start, c); + throw newUnexpectedCharacterException(string, start, c); } return appendTypeArgumentSignatureForAnchor(string, start + 1, buffer); } @@ -3163,11 +3163,11 @@ public class Util { int length = string.length; // need a minimum 2 char if (start >= length - 1) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } char c = string[start]; if (c != Signature.C_ARRAY) { - throw raiseUnexpectedCharacterException(string, start, c); + throw newUnexpectedCharacterException(string, start, c); } int index = start; @@ -3175,7 +3175,7 @@ public class Util { while(c == Signature.C_ARRAY) { // need a minimum 2 char if (index >= length - 1) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } c = string[++index]; } @@ -3196,17 +3196,17 @@ public class Util { private static int appendClassTypeSignatureForAnchor(char[] string, int start, StringBuffer buffer) { // need a minimum 3 chars "Lx;" if (start >= string.length - 2) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } // must start in "L" or "Q" char c = string[start]; if (c != Signature.C_RESOLVED && c != Signature.C_UNRESOLVED) { - throw raiseUnexpectedCharacterException(string, start, c); + throw newUnexpectedCharacterException(string, start, c); } int p = start + 1; while (true) { if (p >= string.length) { - throw raiseIllegalSignatureException(string, start); + throw newIllegalArgumentException(string, start); } c = string[p]; switch(c) { @@ -3241,12 +3241,12 @@ public class Util { } } - private static IllegalArgumentException raiseIllegalSignatureException(char[] string, int start) { - throw new IllegalArgumentException("\"" + new String(string) + "\" starting at " + start); //$NON-NLS-1$ //$NON-NLS-2$ + private static IllegalArgumentException newIllegalArgumentException(char[] string, int index) { + return new IllegalArgumentException("\"" + String.valueOf(string) + "\" at " + index); //$NON-NLS-1$ //$NON-NLS-2$ } - private static IllegalArgumentException raiseUnexpectedCharacterException(char[] string, int start, char unexpected) { - throw new IllegalArgumentException("Unexpected '" + unexpected + "' in \"" + new String(string) + "\" starting at " + start); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + private static IllegalArgumentException newUnexpectedCharacterException(char[] string, int start, char unexpected) { + return new IllegalArgumentException("Unexpected '" + unexpected + "' in \"" + String.valueOf(string) + "\" starting at " + start); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } private static int scanGenericEnd(char[] string, int start) { |