Javadoc parse(String rawInput, int from, int to) { char[] rawContent; rawContent = new char[to + GENERIC_JAVA_CLASS_SUFFIX.length]; Arrays.fill(rawContent, 0, from, ' '); System.arraycopy(rawInput.substring(from, to).toCharArray(), 0, rawContent, from, to - from); // Eclipse crashes if there's no character following the javadoc. System.arraycopy(GENERIC_JAVA_CLASS_SUFFIX, 0, rawContent, to, GENERIC_JAVA_CLASS_SUFFIX.length); this.sourceLevel = ClassFileConstants.JDK1_6; this.scanner.setSource(rawContent); this.source = rawContent; this.javadocStart = from; this.javadocEnd = to; this.reportProblems = true; this.docComment = new Javadoc(this.javadocStart, this.javadocEnd); commentParse(); this.docComment.valuePositions = -1; this.docComment.sourceEnd--; return docComment; }
private void applyOffset(Javadoc node) { applyOffsetASTNode(node); node.valuePositions = newSourceStart; for (int i = 0; i < node.inheritedPositions.length; i++) { node.inheritedPositions[i] = recalcSourcePosition(node.inheritedPositions[i]); } }
private void fixPositions(Javadoc node) { node.sourceEnd = sourceEnd; node.sourceStart = sourceStart; node.valuePositions = sourceStart; }
@Override public boolean visit(Javadoc node, BlockScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
@Override public boolean visit(Javadoc node, ClassScope scope) { fixPositions(setGeneratedBy(node, source)); return super.visit(node, scope); }
@Override public boolean visit(Javadoc node, BlockScope scope) { setGeneratedBy(node, source); applyOffset(node); return super.visit(node, scope); }
@Override public boolean visit(Javadoc node, ClassScope scope) { setGeneratedBy(node, source); applyOffset(node); return super.visit(node, scope); }