public int compare(LineLocation l1, LineLocation l2) { final int sourceResult = l1.getSource().getPath().compareTo(l2.getSource().getPath()); if (sourceResult != 0) { return sourceResult; } return Integer.compare(l1.getLineNumber(), l2.getLineNumber()); }
private static String displaySourceAttribution(Node node) { final SourceSection section = node.getSourceSection(); if (section instanceof NullSourceSection) { return "source: " + section.getShortDescription(); } if (section != null) { final String srcText = section.getCode(); final StringBuilder sb = new StringBuilder(); sb.append("source:"); sb.append(" (" + section.getCharIndex() + "," + (section.getCharEndIndex() - 1) + ")"); sb.append(" line=" + section.getLineLocation().getLineNumber()); sb.append(" len=" + srcText.length()); sb.append(" text=\"" + srcText + "\""); return sb.toString(); } return ""; }
int lineNumber; try { lineNumber = sourceSection != null ? sourceSection.getLineLocation().getLineNumber() : -1; } catch (UnsupportedOperationException e) {
for (Entry<LineLocation, CoverageRecord> entry : entries) { final LineLocation key = entry.getKey(); final Source source = key.getSource(); final int lineNo = key.getLineNumber(); if (source != curSource) { if (curSource != null) {
@Override public Throwable fillInStackTrace() { SourceSection sourceSection = this.getSourceSection(); Source source = sourceSection != null ? sourceSection.getSource() : null; String sourceName = source != null ? source.getName() : null; int lineNumber; try { lineNumber = sourceSection != null ? sourceSection.getLineLocation().getLineNumber() : -1; } catch (UnsupportedOperationException e) { /* * SourceSection#getLineLocation() may throw an UnsupportedOperationException. */ lineNumber = -1; } StackTraceElement[] traces = new StackTraceElement[] { new StackTraceElement(filename(sourceName), this.getMethodName(), sourceName, lineNumber) }; this.setStackTrace(traces); return this; }
for (Entry<LineLocation, CoverageRecord> entry : entries) { final LineLocation key = entry.getKey(); final Source source = key.getSource(); final int lineNo = key.getLineNumber(); if (source != curSource) { if (curSource != null) {