All Downloads are FREE. Search and download functionalities are using the official Maven repository.

framework.src.org.checkerframework.framework.test.diagnostics.TestDiagnosticLine Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.42.0
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy