private static ITypeBinding getBinding(Expression node) { if (node != null) { return node.resolveTypeBinding(); } return null; }
private ITypeBinding guessBindingForReference(Expression expression) { ITypeBinding binding = expression.resolveTypeBinding(); if (binding == null) { binding = ASTResolving.guessBindingForReference(expression); } return binding; }
private ITypeBinding guessBindingForReference(Expression expression) { ITypeBinding binding = expression.resolveTypeBinding(); if (binding == null) { binding = ASTResolving.guessBindingForReference(expression); } return binding; }
private ITypeBinding guessBindingForReference(Expression expression) { ITypeBinding binding= expression.resolveTypeBinding(); if (binding == null) { binding= ASTResolving.guessBindingForReference(expression); } return binding; }
private ITypeBinding guessBindingForReference(Expression expression) { ITypeBinding binding= expression.resolveTypeBinding(); if (binding == null) { binding= ASTResolving.guessBindingForReference(expression); } return binding; }
private ITypeBinding guessBindingForReference(Expression expression) { ITypeBinding binding= expression.resolveTypeBinding(); if (binding == null) { binding= ASTResolving.guessBindingForReference(expression); } return binding; }
/** * Creates a type by copying the type binding of the provided expression. * * @param expr the expression whose type must be copied * @param typeNameDecider decides on how the type should be referenced (simple name or qualified name) * @return a new type */ public Type copyType(Expression expr, TypeNameDecider typeNameDecider) { return toType(expr.resolveTypeBinding(), typeNameDecider); }
private static int getReturnFlag(ReturnStatement node) { Expression expression = node.getExpression(); if (expression == null || expression.resolveTypeBinding() == node.getAST().resolveWellKnownType("void")) { return VOID_RETURN; } return VALUE_RETURN; } }
private boolean optimizeSystemConvert(String mappedConstructor, ClassInstanceCreation node) { String typeName = _configuration.getConvertRelatedWellKnownTypeName(mappedConstructor); if (null != typeName) { assert 1 == node.arguments().size(); Expression arg = (Expression) node.arguments().get(0); if (arg.resolveTypeBinding() == resolveWellKnownType(typeName)) { arg.accept(this); return true; } } return false; }
@Override public boolean visit(ThrowStatement node) { ITypeBinding exception = node.getExpression().resolveTypeBinding(); if (exception == null) { return true; } addException(exception, node.getAST()); return true; }
private CSExpression mapExpression(ITypeBinding expectedType, Expression expression) { if (expectedType != null) return castIfNeeded(expectedType, expression.resolveTypeBinding(), mapExpression(expression)); else return mapExpression (expression); }
private boolean isSpecialCloneInvocation(IMethodBinding methodBinding, Expression receiver) { return fAssumeCloneReturnsSameType && "clone".equals(methodBinding.getName()) //$NON-NLS-1$ && methodBinding.getParameterTypes().length == 0 && receiver != null && receiver.resolveTypeBinding() != methodBinding.getMethodDeclaration().getReturnType(); }
public boolean isEnumNameMethodInvocation (MethodInvocation node) { return node.getName().getIdentifier().equals("name") && node.getExpression() != null && node.getExpression().resolveTypeBinding().isEnum(); }
public boolean visit(ThrowStatement node) { ITypeBinding exception= node.getExpression().resolveTypeBinding(); if (isExitPoint(exception)) { SimpleName name= fAST.newSimpleName("xxxxx"); //$NON-NLS-1$ name.setSourceRange(node.getStartPosition(), 5); fResult.add(name); } return true; }
private void setSelectionRanges(Expression exp){ fEffectiveSelectionStart= exp.getStartPosition(); fEffectiveSelectionLength= exp.getLength(); fSelectionBinding= ExpressionVariable.resolveBinding(exp); setOriginalType(exp.resolveTypeBinding()); }
@Override public boolean visit(ThrowStatement node) { ITypeBinding exception = node.getExpression().resolveTypeBinding(); if (!isSelected(node) || exception == null || Bindings.isRuntimeException(exception)) { return true; } addException(exception, node.getAST()); return true; }
private boolean isPrimitiveTypeNarrowing(CastExpression node) { final ITypeBinding castTypeBinding = node.getType().resolveBinding(); final ITypeBinding exprTypeBinding = node.getExpression().resolveTypeBinding(); return isPrimitive(castTypeBinding) && isPrimitive(exprTypeBinding) && isAssignmentCompatible(castTypeBinding, exprTypeBinding); }
private Type evaluateParameterType(AST ast, Expression elem, String key, ImportRewriteContext context) { ITypeBinding binding= Bindings.normalizeTypeBinding(elem.resolveTypeBinding()); if (binding != null && binding.isWildcardType()) { binding= ASTResolving.normalizeWildcardType(binding, true, ast); } if (binding != null) { return getImportRewrite().addImport(binding, ast, context, TypeLocation.PARAMETER); } return ast.newSimpleType(ast.newSimpleName("Object")); //$NON-NLS-1$ }
private ISourceLocation resolveFieldAccess(FieldAccess node) { ITypeBinding tb = node.getExpression().resolveTypeBinding(); if (tb != null && tb.isArray() && "length".equals(node.getName().getIdentifier())) { ISourceLocation arrayType = resolveBinding(tb); return makeBinding("java+arrayLength", arrayType.getAuthority(), arrayType.getPath()); } return resolveBinding(node.resolveFieldBinding()); }
public String getIntroducedVariableName() { if (fElementDeclaration != null) { return fElementDeclaration.getName().getIdentifier(); } else { ForStatement forStatement= getForStatement(); IJavaProject javaProject= ((CompilationUnit)forStatement.getRoot()).getJavaElement().getJavaProject(); String[] proposals= getVariableNameProposals(fArrayAccess.resolveTypeBinding(), javaProject); return proposals[0]; } }