private void addToMap(Node positionNode, Node linked) { if (positionNode == null) return; int start = positionNode.getPosition().getStart(); if (start == -1) return; if (linked instanceof JavadocContainer || !nodePositions.containsKey(start)) { nodePositions.put(start, linked); } }
private void addToMap(Node positionNode, Node linked) { if (positionNode == null) return; int start = positionNode.getPosition().getStart(); if (start == -1) return; if (linked instanceof JavadocContainer || !nodePositions.containsKey(start)) { nodePositions.put(start, linked); } }
private static int end(lombok.ast.Node node) { if (node == null || node.getPosition().isUnplaced()) return 0; return node.getPosition().getEnd() - 1; }
private void set(JCTree node, Node value) { if (result != null) throw new IllegalStateException("result is already set"); if (value != null && value.getPosition().isUnplaced()) setPos(node, value); java.util.List<Node> result = Lists.newArrayList(); if (value != null) result.add(value); this.result = result; }
@Override public boolean visitNode(Node node) { if (node.isGenerated()) return false; int startPos = node.getPosition().getStart(); Node current = startPosMap.get(startPos); if (current == null || !(current instanceof JavadocContainer)) { startPosMap.put(startPos, node); } return false; } });
private void set(JCTree node, Node value) { if (result != null) throw new IllegalStateException("result is already set"); if (value != null && value.getPosition().isUnplaced()) setPos(node, value); java.util.List<Node> result = Lists.newArrayList(); if (value != null) result.add(value); this.result = result; }
private boolean isUndocumented(lombok.ast.Node block) { if (block == null) return false; if (rawInput == null) return false; lombok.ast.Position pos = block.getPosition(); if (pos.isUnplaced() || pos.size() < 3) return true; String content = rawInput.substring(pos.getStart() + 1, pos.getEnd() - 1); return content.trim().isEmpty(); } };
private List<JCCase> addCase(List<JCCase> cases, JCExpression currentPat, Node currentNode, List<JCStatement> stats) { JCStatement last = stats.last(); int start = currentNode.getPosition().getStart(); int end = last == null ? currentNode.getPosition().getEnd() : endPosTable.get(last); cases = cases.append(setPos(start, end, treeMaker.Case(currentPat, stats))); return cases; }
private boolean isUndocumented(lombok.ast.Node block) { if (block == null) return false; if (rawInput == null) return false; lombok.ast.Position pos = block.getPosition(); if (pos.isUnplaced() || pos.size() < 3) return true; String content = rawInput.substring(pos.getStart() + 1, pos.getEnd() - 1); return content.trim().isEmpty(); } };
private List<JCCase> addCase(List<JCCase> cases, JCExpression currentPat, Node currentNode, List<JCStatement> stats) { JCStatement last = stats.last(); int start = currentNode.getPosition().getStart(); int end = last == null ? currentNode.getPosition().getEnd() : endPosTable.get(last); cases = cases.append(setPos(start, end, treeMaker.Case(currentPat, stats))); return cases; }
private boolean isUndocumented(lombok.ast.Node block) { if (block == null) return false; if (rawInput == null) return false; lombok.ast.Position pos = block.getPosition(); if (pos.isUnplaced() || pos.size() < 3) return true; String content = rawInput.substring(pos.getStart() + 1, pos.getEnd() - 1); return content.trim().isEmpty(); } };
private int posOfStructure(Node node, String structure, int idx, boolean atStart) { int start = node.getPosition().getStart(); if (sourceStructures != null && sourceStructures.containsKey(node)) { for (SourceStructure struct : sourceStructures.get(node)) { if (structure.equals(struct.getContent())) { start = atStart ? struct.getPosition().getStart() : struct.getPosition().getEnd(); if (idx-- <= 0) break; } } } return start; }
private int posOfStructure(Node node, String structure, int idx, boolean atStart) { int start = node.getPosition().getStart(); if (sourceStructures != null && sourceStructures.containsKey(node)) { for (SourceStructure struct : sourceStructures.get(node)) { if (structure.equals(struct.getContent())) { start = atStart ? struct.getPosition().getStart() : struct.getPosition().getEnd(); if (idx-- <= 0) break; } } } return start; }
private void posParen(Node node, int iteration, java.util.List<Position> parenPositions, JCTree jcTree) { Position p = null; if (parenPositions.size() > iteration) p = parenPositions.get(iteration); int start = (p == null || p.isUnplaced() || p.getStart() < 0) ? node.getPosition().getStart() - 1 - iteration : p.getStart(); int end = (p == null || p.isUnplaced() || p.getEnd() < 0) ? node.getPosition().getEnd() + 1 + iteration : p.getEnd(); setPos(start, end, jcTree); }
private void posParen(Node node, int iteration, java.util.List<Position> parenPositions, JCTree jcTree) { Position p = null; if (parenPositions.size() > iteration) p = parenPositions.get(iteration); int start = (p == null || p.isUnplaced() || p.getStart() < 0) ? node.getPosition().getStart() - 1 - iteration : p.getStart(); int end = (p == null || p.isUnplaced() || p.getEnd() < 0) ? node.getPosition().getEnd() + 1 + iteration : p.getEnd(); setPos(start, end, jcTree); }
private void posParen(Node node, int iteration, java.util.List<Position> parenPositions, JCTree jcTree) { Position p = null; if (parenPositions.size() > iteration) p = parenPositions.get(iteration); int start = (p == null || p.isUnplaced() || p.getStart() < 0) ? node.getPosition().getStart() - 1 - iteration : p.getStart(); int end = (p == null || p.isUnplaced() || p.getEnd() < 0) ? node.getPosition().getEnd() + 1 + iteration : p.getEnd(); setPos(start, end, jcTree); }
private void addSourceStructure(ListMultimap<Node, SourceStructure> map, Node node, SourceStructure structure) { if (structure.getPosition().size() > 0 && structure.getContent().trim().length() > 0 && !structure.getPosition().equals(node.getPosition())) { map.put(node, structure); } }
@NonNull @Override public Location resolve() { lombok.ast.Position pos = mNode.getPosition(); return Location.create(mFile, null /*contents*/, pos.getStart(), pos.getEnd()); }
public Node createCatch(Node modifiers, Node type, Node varName, Node body) { VariableDefinitionEntry varNameEntry = new VariableDefinitionEntry().astName(createIdentifierIfNeeded(varName, currentPos())); if (varName != null) varNameEntry.setPosition(varName.getPosition()); VariableDefinition decl = new VariableDefinition().rawTypeReference(type).rawVariables().addToEnd( varNameEntry); if (type != null && varName != null) decl.setPosition(new Position(type.getPosition().getStart(), varName.getPosition().getEnd())); if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos())); return posify(new Catch().rawExceptionDeclaration(decl).rawBody(body)); }
public Node createCatch(Node modifiers, Node type, Node varName, Node body) { VariableDefinitionEntry varNameEntry = new VariableDefinitionEntry().astName(createIdentifierIfNeeded(varName, currentPos())); if (varName != null) varNameEntry.setPosition(varName.getPosition()); VariableDefinition decl = new VariableDefinition().rawTypeReference(type).rawVariables().addToEnd( varNameEntry); if (type != null && varName != null) decl.setPosition(new Position(type.getPosition().getStart(), varName.getPosition().getEnd())); if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos())); return posify(new Catch().rawExceptionDeclaration(decl).rawBody(body)); }