Java Code Examples for org.eclipse.jdt.core.dom.ArrayInitializer#expressions()
The following examples show how to use
org.eclipse.jdt.core.dom.ArrayInitializer#expressions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientBundleValidator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
@SuppressWarnings("unchecked") private void validateSourceAnnotationValues(Annotation annotation) throws JavaModelException { Expression exp = JavaASTUtils.getAnnotationValue(annotation); if (exp == null) { return; } // There will usually just be one string value if (exp instanceof StringLiteral) { validateSourceAnnotationValue((StringLiteral) exp); } // But there could be multiple values; if so, check each one. if (exp instanceof ArrayInitializer) { ArrayInitializer array = (ArrayInitializer) exp; for (Expression item : (List<Expression>) array.expressions()) { if (item instanceof StringLiteral) { validateSourceAnnotationValue((StringLiteral) item); } } } }
Example 2
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public final void endVisit(final ArrayInitializer node) { final ITypeBinding binding= node.resolveTypeBinding(); if (binding != null && binding.isArray()) { final ConstraintVariable2 ancestor= fModel.createIndependentTypeVariable(binding.getElementType()); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); Expression expression= null; ConstraintVariable2 descendant= null; final List<Expression> expressions= node.expressions(); for (int index= 0; index < expressions.size(); index++) { expression= expressions.get(index); descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) fModel.createSubtypeConstraint(descendant, ancestor); } } } }
Example 3
Source File: FullConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public ITypeConstraint[] create(ArrayInitializer arrayInitializer){ ITypeBinding arrayBinding= arrayInitializer.resolveTypeBinding(); Assert.isTrue(arrayBinding.isArray()); List<Expression> expressions= arrayInitializer.expressions(); List<ITypeConstraint> constraints= new ArrayList<ITypeConstraint>(); Type type= getTypeParent(arrayInitializer); ConstraintVariable typeVariable= fConstraintVariableFactory.makeTypeVariable(type); for (int i= 0; i < expressions.size(); i++) { Expression each= expressions.get(i); ITypeConstraint[] c= fTypeConstraintFactory.createSubtypeConstraint( fConstraintVariableFactory.makeExpressionOrTypeVariable(each, getContext()), typeVariable); constraints.addAll(Arrays.asList(c)); } return constraints.toArray(new ITypeConstraint[constraints.size()]); }
Example 4
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 5 votes |
private ArrayInitial visit(ArrayInitializer node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); ArrayInitial arrayInitial = new ArrayInitial(startLine, endLine, node); List<Expr> expressions = new ArrayList<>(); for(Object object : node.expressions()){ Expr expr = (Expr) process((ASTNode) object); expr.setParent(arrayInitial); expressions.add(expr); } arrayInitial.setExpressions(expressions); return arrayInitial; }
Example 5
Source File: BindingSignatureVisitor.java From JDeodorant with MIT License | 5 votes |
public boolean visit(ArrayInitializer expr) { List expressions = expr.expressions(); for (int i = 0; i < expressions.size(); i++) { handleExpression((Expression) expressions.get(i)); } return false; }