private static CharSequence getRawType(MethodBinding methodBinding) { TypeBinding returnType = methodBinding.returnType; char[] sourceName = returnType.sourceName(); if (sourceName == null) { sourceName = new char[] {}; } return CharBuffer.wrap(sourceName); } }
protected int matchMethod(MethodBinding method, boolean skipImpossibleArg) { [...] // verify each parameter for (int i = 0; i < parameterCount; i++) { TypeBinding argType = method.parameters[i]; int newLevel = IMPOSSIBLE_MATCH; if (argType.isMemberType()) { // only compare source name for member type (bug 41018) newLevel = CharOperation.match(this.pattern.parameterSimpleNames[i], argType.sourceName(), this.isCaseSensitive) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH; } else { // TODO (frederic) use this call to refine accuracy on parameter types // newLevel = resolveLevelForType(this.pattern.parameterSimpleNames[i], this.pattern.parameterQualifications[i], this.pattern.parametersTypeArguments[i], 0, argType); newLevel = resolveLevelForType(this.pattern.parameterSimpleNames[i], this.pattern.parameterQualifications[i], argType); [...] } } [...] }
ref.setSimpleName(""); } else { ref.setSimpleName(String.valueOf(binding.sourceName())); if (binding.enclosingType() != null) { ref.setDeclaringType(getTypeReference(binding.enclosingType())); ref.setSimpleName(new String(binding.sourceName())); ref.setPackage(getPackageReference(binding.getPackage())); if (!this.jdtTreeBuilder.getContextBuilder().ignoreComputeImports) { final CtReference declaring = this.getDeclaringReferenceFromImports(binding.sourceName()); if (declaring instanceof CtPackageReference) { ref.setPackage((CtPackageReference) declaring); ref.setSimpleName(new String(binding.sourceName())); } else if (binding instanceof TypeVariableBinding) { boolean oldBounds = bounds; } else { ref = this.jdtTreeBuilder.getFactory().Core().createTypeParameterReference(); ref.setSimpleName(new String(binding.sourceName())); String name = new String(binding.sourceName()); ref.setDeclaringType(getTypeReference(binding.enclosingType())); } else { ref.setSimpleName(new String(binding.sourceName())); if (((LocalTypeBinding) binding).enclosingMethod == null && binding.enclosingType() != null && binding.enclosingType() instanceof LocalTypeBinding) { ref.setDeclaringType(getTypeReference(binding.enclosingType()));
public void illegalQualifierForExplicitThis(Receiver receiver, TypeBinding expectedType) { String[] problemArguments = new String[] { new String(expectedType.sourceName())}; this.handle( IProblem.IllegalQualifierForExplicitThis, problemArguments, problemArguments, (receiver.qualifyingName == null) ? receiver.sourceStart : receiver.qualifyingName.sourceStart, receiver.sourceEnd); } public void illegalQualifierForExplicitThis2(Receiver receiver) {
public char[] sourceName() { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { brackets[i] = ']'; brackets[i - 1] = '['; } return CharOperation.concat(this.leafComponentType.sourceName(), brackets); } public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
@Override public char[] sourceName() { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { brackets[i] = ']'; brackets[i - 1] = '['; } return CharOperation.concat(this.leafComponentType.sourceName(), brackets); } @Override
public char[] sourceName() { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { brackets[i] = ']'; brackets[i - 1] = '['; } return CharOperation.concat(this.leafComponentType.sourceName(), brackets); } public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
@Override protected String toFieldName(TypeBinding binding) { return decapitalize(String.valueOf(binding.sourceName())); }
public void illegalQualifierForExplicitThis(Receiver receiver, TypeBinding expectedType) { String[] problemArguments = new String[] { new String(expectedType.sourceName())}; this.handle( IProblem.IllegalQualifierForExplicitThis, problemArguments, problemArguments, (receiver.qualifyingName == null) ? receiver.sourceStart : receiver.qualifyingName.sourceStart, receiver.sourceEnd); } public void illegalQualifierForExplicitThis2(Receiver receiver) {
public void illegalQualifierForExplicitThis(Receiver receiver, TypeBinding expectedType) { String[] problemArguments = new String[] { new String(expectedType.sourceName())}; this.handle( IProblem.IllegalQualifierForExplicitThis, problemArguments, problemArguments, (receiver.qualifyingName == null) ? receiver.sourceStart : receiver.qualifyingName.sourceStart, receiver.sourceEnd); } public void illegalQualifierForExplicitThis2(Receiver receiver) {
public char[] sourceName() { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { brackets[i] = ']'; brackets[i - 1] = '['; } return CharOperation.concat(this.leafComponentType.sourceName(), brackets); } public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
public char[] sourceName() { char[] brackets = new char[this.dimensions * 2]; for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) { brackets[i] = ']'; brackets[i - 1] = '['; } return CharOperation.concat(this.leafComponentType.sourceName(), brackets); } public void swapUnresolved(UnresolvedReferenceBinding unresolvedType, ReferenceBinding resolvedType, LookupEnvironment env) {
public void conditionalArgumentsIncompatibleTypes(ConditionalExpression expression, TypeBinding trueType, TypeBinding falseType) { this.handle( IProblem.IncompatibleTypesInConditionalOperator, new String[] {new String(trueType.readableName()), new String(falseType.readableName())}, new String[] {new String(trueType.sourceName()), new String(falseType.sourceName())}, expression.sourceStart, expression.sourceEnd); } public void conflictingImport(ImportReference importRef) {
public void superinterfacesCollide(TypeBinding type, ASTNode decl, TypeBinding superType, TypeBinding inheritedSuperType) { this.handle( IProblem.SuperInterfacesCollide, new String[] {new String(superType.readableName()), new String(inheritedSuperType.readableName()), new String(type.sourceName())}, new String[] {new String(superType.shortReadableName()), new String(inheritedSuperType.shortReadableName()), new String(type.sourceName())}, decl.sourceStart, decl.sourceEnd); } public void superTypeCannotUseWildcard(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
public void superinterfacesCollide(TypeBinding type, ASTNode decl, TypeBinding superType, TypeBinding inheritedSuperType) { this.handle( IProblem.SuperInterfacesCollide, new String[] {new String(superType.readableName()), new String(inheritedSuperType.readableName()), new String(type.sourceName())}, new String[] {new String(superType.shortReadableName()), new String(inheritedSuperType.shortReadableName()), new String(type.sourceName())}, decl.sourceStart, decl.sourceEnd); } public void superTypeCannotUseWildcard(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
public void superinterfacesCollide(TypeBinding type, ASTNode decl, TypeBinding superType, TypeBinding inheritedSuperType) { this.handle( IProblem.SuperInterfacesCollide, new String[] {new String(superType.readableName()), new String(inheritedSuperType.readableName()), new String(type.sourceName())}, new String[] {new String(superType.shortReadableName()), new String(inheritedSuperType.shortReadableName()), new String(type.sourceName())}, decl.sourceStart, decl.sourceEnd); } public void superTypeCannotUseWildcard(SourceTypeBinding type, TypeReference superclass, TypeBinding superTypeBinding) {
protected int resolveLevel(FieldDeclaration field) { // only accept enum constants if (field.type != null || field.binding == null) return IMPOSSIBLE_MATCH; if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, field.binding.type.sourceName())) return IMPOSSIBLE_MATCH; if (!(field.initialization instanceof AllocationExpression) || field.initialization.resolvedType.isLocalType()) return IMPOSSIBLE_MATCH; return resolveLevel(((AllocationExpression)field.initialization).binding); } public int resolveLevel(Binding binding) {
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*
protected char[] getQualifiedSourceName(TypeBinding binding) { TypeBinding type = binding instanceof ArrayBinding ? ((ArrayBinding)binding).leafComponentType : binding; if (type instanceof ReferenceBinding) { if (type.isLocalType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), new char[] {'.', '1', '.'}, binding.sourceName()); } else if (type.isMemberType()) { return CharOperation.concat(qualifiedSourceName(type.enclosingType()), binding.sourceName(), '.'); } } return binding != null ? binding.qualifiedSourceName() : null; } /*