private int rank(ITypeBinding type) { if (type.getTypeDeclaration().equals(oldTypeDeclaration)) { return 1; } return 0; } });
private int rank(ITypeBinding type) { if (type.getTypeDeclaration().equals(oldTypeDeclaration)) return 1; return 0; } });
private int rank(ITypeBinding type) { if (type.getTypeDeclaration().equals(oldTypeDeclaration)) return 1; return 0; } });
private static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
private static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
protected static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
private static boolean parameterTypesMatch(IMethodBinding m1, IMethodBinding m2) { ITypeBinding[] m1Params= m1.getParameterTypes(); ITypeBinding[] m2Params= m2.getParameterTypes(); if (m1Params.length != m2Params.length) return false; for (int i= 0; i < m2Params.length; i++) { if (!m1Params[i].equals(m2Params[i])) return false; } return true; }
protected static IMethodBinding findMethod(IMethodBinding methodBinding, ITypeBinding type) { if (methodBinding.getDeclaringClass().equals(type)) return methodBinding; return Bindings.findOverriddenMethodInType(type, methodBinding); }
private static boolean parameterTypesMatch(IMethodBinding m1, IMethodBinding m2) { ITypeBinding[] m1Params= m1.getParameterTypes(); ITypeBinding[] m2Params= m2.getParameterTypes(); if (m1Params.length != m2Params.length) return false; for (int i= 0; i < m2Params.length; i++) { if (!m1Params[i].equals(m2Params[i])) return false; } return true; }
private static IVariableBinding findField(IVariableBinding fieldBinding, ITypeBinding type) { if (fieldBinding.getDeclaringClass().equals(type)) return fieldBinding; return Bindings.findFieldInType(type, fieldBinding.getName()); }
private boolean isVoidMethod() { // if we have an initializer if (fEnclosingMethodBinding == null) return true; ITypeBinding binding= fEnclosingMethodBinding.getReturnType(); if (fEnclosingBodyDeclaration.getAST().resolveWellKnownType("void").equals(binding)) //$NON-NLS-1$ return true; return false; }
@Override public final boolean visit(final VariableDeclarationFragment node) { if (node.getInitializer() instanceof NullLiteral) { SimpleName name= node.getName(); if (elementType.equals(name.resolveTypeBinding()) && fElementVariable.equals(name.resolveBinding())) { fOccurrences.add(name); } } return true; } });
@Override public final boolean visit(final VariableDeclarationFragment node) { if (node.getInitializer() instanceof NullLiteral) { SimpleName name= node.getName(); if (elementType.equals(name.resolveTypeBinding()) && fElementVariable.equals(name.resolveBinding())) { fOccurrences.add(name); } } return true; } });
private Type buildType(ITypeBinding binding, ITypeBinding bindingPoint, AST ast, ImportRewriteContext context, Type qualifier, TypeLocation location) { if (binding.equals(bindingPoint)) { return qualifier; } // build the type recursively from left to right Type type = binding.isMember() ? buildType(binding.getDeclaringClass(), bindingPoint, ast, context, qualifier, TypeLocation.OTHER) : null; type = internalAddImport(binding, ast, context, type, false, location); return type; }
private Type buildType(ITypeBinding binding, ITypeBinding bindingPoint, AST ast, ImportRewriteContext context, Type qualifier, TypeLocation location) { if (binding.equals(bindingPoint)) { return qualifier; } // build the type recursively from left to right Type type = binding.isMember() ? buildType(binding.getDeclaringClass(), bindingPoint, ast, context, qualifier, TypeLocation.OTHER) : null; type = internalAddImport(binding, ast, context, type, false, location); return type; }
private Type buildType(ITypeBinding binding, ITypeBinding bindingPoint, AST ast, ImportRewriteContext context, Type qualifier) { if (binding.equals(bindingPoint)) { return qualifier; } // build the type recursively from left to right Type type = binding.isMember() ? buildType(binding.getDeclaringClass(), bindingPoint, ast, context, qualifier) : null; type = internalAddImport(binding, ast, context, type, false); return type; }
private Type buildType(ITypeBinding binding, ITypeBinding bindingPoint, AST ast, ImportRewriteContext context, Type qualifier) { if (binding.equals(bindingPoint)) { return qualifier; } // build the type recursively from left to right Type type = binding.isMember() ? buildType(binding.getDeclaringClass(), bindingPoint, ast, context, qualifier) : null; type = internalAddImport(binding, ast, context, type, false); return type; }
/** Special handling because of captures. */ private boolean areSameParameterizedTypeBindings(final ITypeBinding type1, final ITypeBinding type2) { return type1.getErasure().equals(type2.getErasure()) && areSameTypeBindings(type1.getTypeArguments(), type2.getTypeArguments()); }
private boolean areSameTypeBindingsByAliasingTypeCaptures(final ITypeBinding type1, final ITypeBinding type2) { if (type1.isCapture() ^ type2.isCapture()) { return false; } else if (type1.isCapture()) { return areSameTypeBindings(type1.getWildcard(), type2.getWildcard()); } else { return type1.equals(type2); } }
private void replaceStringValueOfByArg0(final Expression toReplace, final MethodInvocation mi) { final ASTBuilder b = this.ctx.getASTBuilder(); final ITypeBinding expectedType = mi.resolveMethodBinding().getParameterTypes()[0]; final ITypeBinding actualType = arg0(mi).resolveTypeBinding(); if (!expectedType.equals(actualType) && !getBoxedTypeBinding(expectedType, mi.getAST()).equals(actualType)) { ctx.getRefactorings().replace(toReplace, b.cast(b.type(expectedType.getQualifiedName()), b.move(arg0(mi)))); } else { ctx.getRefactorings().replace(toReplace, b.parenthesizeIfNeeded(b.move(arg0(mi)))); } }