private boolean hasConstValue(VariableDeclarationFragment fragment) { return null != fragment.resolveBinding().getConstantValue(); }
private boolean isReplacedByConstantValue(SuperFieldAccess node) { if (!fBindingsResolved) { fNeedBindings = true; return false; } // if the field is static final IVariableBinding binding= node.resolveFieldBinding(); if (binding != null) { return binding.getConstantValue() != null; } return false; }
public Object constValue(Name expression) { IBinding binding = expression.resolveBinding(); if (IBinding.VARIABLE == binding.getKind()) { return ((IVariableBinding) binding).getConstantValue(); } return null; }
private boolean isReplacedByConstantValue(Name node) { if (!fBindingsResolved) { fNeedBindings = true; return false; } // if node is a variable with a constant value (static final field) IBinding binding= node.resolveBinding(); if (binding != null && binding.getKind() == IBinding.VARIABLE) { return ((IVariableBinding)binding).getConstantValue() != null; } return false; }
private boolean isReplacedByConstantValue(FieldAccess node) { if (!fBindingsResolved) { fNeedBindings = true; return false; } // if the node is 'this.<field>', and the field is static final Expression expression= node.getExpression(); IVariableBinding binding= node.resolveFieldBinding(); if (binding != null && expression.getNodeType() == ASTNode.THIS_EXPRESSION) { return binding.getConstantValue() != null; } return false; }
public static Object getVariableBindingConstValue(ASTNode node, IField field) { if (node != null && node.getNodeType() == ASTNode.SIMPLE_NAME) { IBinding binding= ((SimpleName) node).resolveBinding(); if (binding != null && binding.getKind() == IBinding.VARIABLE) { IVariableBinding variableBinding= (IVariableBinding) binding; if (field.equals(variableBinding.getJavaElement())) { return variableBinding.getConstantValue(); } } } return null; }
public static Object getVariableBindingConstValue(ASTNode node, IField field) { if (node != null && node.getNodeType() == ASTNode.SIMPLE_NAME) { IBinding binding= ((SimpleName) node).resolveBinding(); if (binding != null && binding.getKind() == IBinding.VARIABLE) { IVariableBinding variableBinding= (IVariableBinding) binding; if (field.equals(variableBinding.getJavaElement())) { return variableBinding.getConstantValue(); } } } return null; }
if (binding instanceof IVariableBinding) { IVariableBinding variableBinding = (IVariableBinding) binding; Object constantValue = variableBinding.getConstantValue(); if (constantValue != null) { if (constantValue instanceof String) {
return variableBinding.getConstantValue();
if (binding instanceof IVariableBinding) { IVariableBinding variableBinding= (IVariableBinding) binding; Object constantValue= variableBinding.getConstantValue(); if (constantValue != null) { if (constantValue instanceof String) {
return variableBinding.getConstantValue();
if (binding instanceof IVariableBinding) { IVariableBinding variableBinding= (IVariableBinding) binding; Object constantValue= variableBinding.getConstantValue(); if (constantValue != null) { if (constantValue instanceof String) {
if (fieldBinding.getConstantValue() != null) { return makeNode(context, fFactory, positioningNode, CAstNode.BLOCK_EXPR, targetNode, fFactory.makeConstant(fieldBinding .getConstantValue())); } else { return makeNode(context, fFactory, positioningNode, CAstNode.BLOCK_EXPR, targetNode, if (fieldBinding.getConstantValue() != null) { fFactory.makeConstant(fieldBinding.getConstantValue())); } else { if (fieldBinding.getType().isTypeVariable() && !context.needLValue()) {