diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java index 41efa50..6b4323d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java @@ -160,7 +160,7 @@ of generics. */ char[] typeSignature = binaryType.getGenericSignature(); - this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == '<' + this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == Util.C_GENERIC_START ? null // is initialized in cachePartsFrom (called from LookupEnvironment.createBinaryTypeFrom())... must set to null so isGenericType() answers true : Binding.NO_TYPE_VARIABLES; @@ -310,7 +310,7 @@ if (typeSignature != null) { // ClassSignature = ParameterPart(optional) super_TypeSignature interface_signature wrapper = new SignatureWrapper(typeSignature); - if (wrapper.signature[wrapper.start] == '<') { + if (wrapper.signature[wrapper.start] == Util.C_GENERIC_START) { // ParameterPart = '<' ParameterSignature(s) '>' wrapper.start++; // skip '<' this.typeVariables = createTypeVariables(wrapper, true, missingTypeNames); @@ -467,11 +467,11 @@ int numOfParams = 0; char nextChar; int index = 0; // first character is always '(' so skip it - while ((nextChar = methodDescriptor[++index]) != ')') { - if (nextChar != '[') { + while ((nextChar = methodDescriptor[++index]) != Util.C_PARAM_END) { + if (nextChar != Util.C_ARRAY) { numOfParams++; - if (nextChar == 'L') - while ((nextChar = methodDescriptor[++index]) != ';'){/*empty*/} + if (nextChar == Util.C_RESOLVED) + while ((nextChar = methodDescriptor[++index]) != Util.C_NAME_END){/*empty*/} } } @@ -495,9 +495,9 @@ index = 1; int end = 0; // first character is always '(' so skip it for (int i = 0; i < numOfParams; i++) { - while ((nextChar = methodDescriptor[++end]) == '['){/*empty*/} - if (nextChar == 'L') - while ((nextChar = methodDescriptor[++end]) != ';'){/*empty*/} + while ((nextChar = methodDescriptor[++end]) == Util.C_ARRAY){/*empty*/} + if (nextChar == Util.C_RESOLVED) + while ((nextChar = methodDescriptor[++end]) != Util.C_NAME_END){/*empty*/} if (i >= startIndex) { // skip the synthetic arg if necessary parameters[i - startIndex] = this.environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames); @@ -526,7 +526,7 @@ methodModifiers |= ExtraCompilerModifiers.AccGenericSignature; // MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)] SignatureWrapper wrapper = new SignatureWrapper(methodSignature, use15specifics); - if (wrapper.signature[wrapper.start] == '<') { + if (wrapper.signature[wrapper.start] == Util.C_GENERIC_START) { // (Ljava/lang/Class;)TA; // ParameterPart = '<' ParameterSignature(s) '>' wrapper.start++; // skip '<' @@ -534,13 +534,13 @@ wrapper.start++; // skip '>' } - if (wrapper.signature[wrapper.start] == '(') { + if (wrapper.signature[wrapper.start] == Util.C_PARAM_START) { wrapper.start++; // skip '(' - if (wrapper.signature[wrapper.start] == ')') { + if (wrapper.signature[wrapper.start] == Util.C_PARAM_END) { wrapper.start++; // skip ')' } else { java.util.ArrayList types = new java.util.ArrayList(2); - while (wrapper.signature[wrapper.start] != ')') + while (wrapper.signature[wrapper.start] != Util.C_PARAM_END) types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames)); wrapper.start++; // skip ')' int numParam = types.size(); @@ -557,13 +557,13 @@ // always retrieve return type (for constructors, its V for void - will be ignored) returnType = this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames); - if (!wrapper.atEnd() && wrapper.signature[wrapper.start] == '^') { + if (!wrapper.atEnd() && wrapper.signature[wrapper.start] == Util.C_EXCEPTION_START) { // attempt to find each exception if it exists in the cache (otherwise - resolve it when requested) java.util.ArrayList types = new java.util.ArrayList(2); do { wrapper.start++; // skip '^' types.add(this.environment.getTypeFromTypeSignature(wrapper, typeVars, this, missingTypeNames)); - } while (!wrapper.atEnd() && wrapper.signature[wrapper.start] == '^'); + } while (!wrapper.atEnd() && wrapper.signature[wrapper.start] == Util.C_EXCEPTION_START); exceptions = new ReferenceBinding[types.size()]; types.toArray(exceptions); } else { // get the exceptions the old way @@ -621,7 +621,7 @@ total--; } else if (iClinit == -1) { char[] methodName = method.getSelector(); - if (methodName.length == 8 && methodName[0] == '<') { + if (methodName.length == 8 && methodName[0] == Util.C_GENERIC_START) { // discard iClinit = i; total--; @@ -666,21 +666,21 @@ createVariables: { for (int i = 1; i < length; i++) { switch(typeSignature[i]) { - case '<' : + case Util.C_GENERIC_START : depth++; break; - case '>' : + case Util.C_GENERIC_END : if (--depth < 0) break createVariables; break; - case ';' : - if ((depth == 0) && (i +1 < length) && (typeSignature[i+1] != ':')) + case Util.C_NAME_END : + if ((depth == 0) && (i +1 < length) && (typeSignature[i+1] != Util.C_COLON)) pendingVariable = true; break; default: if (pendingVariable) { pendingVariable = false; - int colon = CharOperation.indexOf(':', typeSignature, i); + int colon = CharOperation.indexOf(Util.C_COLON, typeSignature, i); char[] variableName = CharOperation.subarray(typeSignature, i, colon); variables.add(new TypeVariableBinding(variableName, this, rank++, this.environment)); } @@ -733,7 +733,7 @@ private MethodBinding findMethod(char[] methodDescriptor, char[][][] missingTypeNames) { int index = -1; - while (methodDescriptor[++index] != '(') { + while (methodDescriptor[++index] != Util.C_PARAM_START) { // empty } char[] selector = new char[index]; @@ -742,11 +742,11 @@ int numOfParams = 0; char nextChar; int paramStart = index; - while ((nextChar = methodDescriptor[++index]) != ')') { - if (nextChar != '[') { + while ((nextChar = methodDescriptor[++index]) != Util.C_PARAM_END) { + if (nextChar != Util.C_ARRAY) { numOfParams++; - if (nextChar == 'L') - while ((nextChar = methodDescriptor[++index]) != ';'){/*empty*/} + if (nextChar == Util.C_RESOLVED) + while ((nextChar = methodDescriptor[++index]) != Util.C_NAME_END){/*empty*/} } } if (numOfParams > 0) { @@ -754,9 +754,9 @@ index = paramStart + 1; int end = paramStart; // first character is always '(' so skip it for (int i = 0; i < numOfParams; i++) { - while ((nextChar = methodDescriptor[++end]) == '['){/*empty*/} - if (nextChar == 'L') - while ((nextChar = methodDescriptor[++end]) != ';'){/*empty*/} + while ((nextChar = methodDescriptor[++end]) == Util.C_ARRAY){/*empty*/} + if (nextChar == Util.C_RESOLVED) + while ((nextChar = methodDescriptor[++end]) != Util.C_NAME_END){/*empty*/} TypeBinding param = this.environment.getTypeFromSignature(methodDescriptor, index, end, false, this, missingTypeNames); if (param instanceof UnresolvedReferenceBinding) { @@ -998,10 +998,10 @@ // ParameterSignature = Identifier ':' TypeSignature // or Identifier ':' TypeSignature(optional) InterfaceBound(s) // InterfaceBound = ':' TypeSignature - int colon = CharOperation.indexOf(':', wrapper.signature, wrapper.start); + int colon = CharOperation.indexOf(Util.C_COLON, wrapper.signature, wrapper.start); wrapper.start = colon + 1; // skip name + ':' ReferenceBinding type, firstBound = null; - if (wrapper.signature[wrapper.start] == ':') { + if (wrapper.signature[wrapper.start] == Util.C_COLON) { type = this.environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null); } else { TypeBinding typeFromTypeSignature = this.environment.getTypeFromTypeSignature(wrapper, existingVariables, this, missingTypeNames); @@ -1019,12 +1019,12 @@ variable.superclass = type; ReferenceBinding[] bounds = null; - if (wrapper.signature[wrapper.start] == ':') { + if (wrapper.signature[wrapper.start] == Util.C_COLON) { java.util.ArrayList types = new java.util.ArrayList(2); do { wrapper.start++; // skip ':' types.add(this.environment.getTypeFromTypeSignature(wrapper, existingVariables, this, missingTypeNames)); - } while (wrapper.signature[wrapper.start] == ':'); + } while (wrapper.signature[wrapper.start] == Util.C_COLON); bounds = new ReferenceBinding[types.size()]; types.toArray(bounds); }