/** * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference, org.eclipse.jdt.internal.compiler.lookup.BlockScope) */ public boolean visit( ArrayTypeReference arrayTypeReference, BlockScope scope) { final int numberOfParens = (arrayTypeReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; if (numberOfParens > 0) { manageOpeningParenthesizedExpression(arrayTypeReference, numberOfParens); } if (arrayTypeReference.annotations != null) { formatInlineAnnotations(arrayTypeReference.annotations[0], false); } this.scribe.printNextToken(SINGLETYPEREFERENCE_EXPECTEDTOKENS); int dimensions = getDimensions(); if (dimensions != 0) { formatDimensions(arrayTypeReference, 0, dimensions); } if (numberOfParens > 0) { manageClosingParenthesizedExpression(arrayTypeReference, numberOfParens); } return false; }
/** * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference, org.eclipse.jdt.internal.compiler.lookup.ClassScope) */ public boolean visit( ArrayTypeReference arrayTypeReference, ClassScope scope) { final int numberOfParens = (arrayTypeReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; if (numberOfParens > 0) { manageOpeningParenthesizedExpression(arrayTypeReference, numberOfParens); } if (arrayTypeReference.annotations != null) { formatInlineAnnotations(arrayTypeReference.annotations[0], false); } this.scribe.printNextToken(SINGLETYPEREFERENCE_EXPECTEDTOKENS); int dimensions = getDimensions(); if (dimensions != 0) { formatDimensions(arrayTypeReference, 0, dimensions); } if (numberOfParens > 0) { manageClosingParenthesizedExpression(arrayTypeReference, numberOfParens); } return false; }
public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ if (this.fieldDeclaration.declarationSourceEnd == 0) { if (this.fieldDeclaration.type instanceof ArrayTypeReference || this.fieldDeclaration.type instanceof ArrayQualifiedTypeReference) { if (!this.alreadyCompletedFieldInitialization) { this.bracketBalance++; return null; // no update is necessary (array initializer) } } else { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980 // in case an initializer bracket is opened in a non-array field // e.g. int field = {.. this.bracketBalance++; return null; // no update is necessary (array initializer) } } if (this.fieldDeclaration.declarationSourceEnd == 0 && this.fieldDeclaration.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT){ this.bracketBalance++; return null; // no update is necessary (enum constant) } // might be an array initializer this.updateSourceEndIfNecessary(braceStart - 1, braceEnd - 1); return this.parent.updateOnOpeningBrace(braceStart, braceEnd); }
@Override public void visitAny(ASTNode node) { Collection<ComponentField> fields = findFields(node); for (ComponentField f : fields) { String skipListKey = node.getClass().getSimpleName() + "/" + f.field.getName(); if (propertySkipList.contains(skipListKey)) continue; Object value; if (node instanceof ConditionalExpression) ((ConditionalExpression)node).valueIfTrue.sourceEnd = -2; if ("originalSourceEnd".equals(f.field.getName()) && node instanceof ArrayTypeReference) { //workaround for eclipse arbitrarily skipping this field and setting it. value = -2; } else { value = readField(f.field, node); } if (value == null) { continue; } if (propertyIfValueSkipList.get(skipListKey).contains(value)) continue; boolean trackRef = true; for (ReferenceTrackingSkip skip : referenceTrackingSkipList) { if (skip.getParent() != null && !skip.getParent().isInstance(node)) continue; if (skip.getType() != null && !skip.getType().isInstance(value)) continue; trackRef = false; break; } f.print(printer, this, value, trackRef); } }
public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ if (this.localDeclaration.declarationSourceEnd == 0 && (this.localDeclaration.type instanceof ArrayTypeReference || this.localDeclaration.type instanceof ArrayQualifiedTypeReference) && !this.alreadyCompletedLocalInitialization){ this.bracketBalance++; return null; // no update is necessary (array initializer) } // might be an array initializer this.updateSourceEndIfNecessary(braceStart - 1, braceEnd - 1); return this.parent.updateOnOpeningBrace(braceStart, braceEnd); }
/** * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference, org.eclipse.jdt.internal.compiler.lookup.BlockScope) */ public boolean visit( ArrayTypeReference arrayTypeReference, BlockScope scope) { final int numberOfParens = (arrayTypeReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; if (numberOfParens > 0) { manageOpeningParenthesizedExpression(arrayTypeReference, numberOfParens); } this.scribe.printNextToken(SINGLETYPEREFERENCE_EXPECTEDTOKENS); int dimensions = getDimensions(); if (dimensions != 0) { if (this.preferences.insert_space_before_opening_bracket_in_array_type_reference) { this.scribe.space(); } for (int i = 0; i < dimensions; i++) { this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET); if (this.preferences.insert_space_between_brackets_in_array_type_reference) { this.scribe.space(); } this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET); } } if (numberOfParens > 0) { manageClosingParenthesizedExpression(arrayTypeReference, numberOfParens); } return false; }
/** * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference, org.eclipse.jdt.internal.compiler.lookup.ClassScope) */ public boolean visit( ArrayTypeReference arrayTypeReference, ClassScope scope) { final int numberOfParens = (arrayTypeReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; if (numberOfParens > 0) { manageOpeningParenthesizedExpression(arrayTypeReference, numberOfParens); } this.scribe.printNextToken(SINGLETYPEREFERENCE_EXPECTEDTOKENS); int dimensions = getDimensions(); if (dimensions != 0) { if (this.preferences.insert_space_before_opening_bracket_in_array_type_reference) { this.scribe.space(); } for (int i = 0; i < dimensions; i++) { this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET); if (this.preferences.insert_space_between_brackets_in_array_type_reference) { this.scribe.space(); } this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET); } } if (numberOfParens > 0) { manageClosingParenthesizedExpression(arrayTypeReference, numberOfParens); } return false; }
private void fixPositions(ArrayTypeReference node) { node.sourceEnd = sourceEnd; node.sourceStart = sourceStart; node.statementEnd = sourceEnd; node.originalSourceEnd = sourceEnd; }
@Override public boolean visit(ArrayTypeReference node, BlockScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
@Override public boolean visit(ArrayTypeReference node, ClassScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
public boolean visit( ArrayTypeReference arrayTypeReference, BlockScope scope) { addRealFragment(arrayTypeReference); return false; }
public boolean visit( ArrayTypeReference arrayTypeReference, ClassScope scope) { addRealFragment(arrayTypeReference); return false; }
private void applyOffset(ArrayTypeReference node) { applyOffsetExpression(node); node.originalSourceEnd = newSourceEnd; }
@Override public boolean visit(ArrayTypeReference node, BlockScope scope) { setGeneratedBy(node, source); applyOffset(node); return super.visit(node, scope); }
@Override public boolean visit(ArrayTypeReference node, ClassScope scope) { setGeneratedBy(node, source); applyOffset(node); return super.visit(node, scope); }