framework.src.org.checkerframework.framework.test.diagnostics.TestDiagnosticLine Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checker Show documentation
Show all versions of checker Show documentation
The Checker Framework enhances Java’s type system to
make it more powerful and useful. This lets software developers
detect and prevent errors in their Java programs.
The Checker Framework includes compiler plug-ins ("checkers")
that find bugs or verify their absence. It also permits you to
write your own compiler plug-ins.
package org.checkerframework.framework.test.diagnostics;
import org.checkerframework.framework.util.PluginUtil;
import java.util.List;
/**
* Represents an entire line of TestDiagnostics which is essentially a list of diagnostics
*/
public class TestDiagnosticLine {
private final long lineNumber;
private final String originalLine;
private final List diagnostics;
public TestDiagnosticLine(long lineNumber, String originalLine, List diagnostics) {
this.lineNumber = lineNumber;
this.originalLine = originalLine;
this.diagnostics = diagnostics;
}
public boolean hasDiagnostics() {
return !diagnostics.isEmpty();
}
public long getLineNumber() {
return lineNumber;
}
public String getOriginalLine() {
return originalLine;
}
/**
* @return a String representation of how this diagnostic should appear in source. This may differ
* from the original line if there was no original line, the original line had extraneous whitespace
*/
public String asSourceString() {
return "//:: " + PluginUtil.join(" :: ", TestDiagnosticUtils.diagnosticsToString(diagnostics));
}
public List getDiagnostics() {
return diagnostics;
}
}