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

org.checkerframework.javacutil.BugInCF 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.47.0
Show newest version
package org.checkerframework.javacutil;

/** Exception type indicating a bug in the framework or in a checker implementation. */
@SuppressWarnings("serial")
public class BugInCF extends RuntimeException {

    /**
     * Constructs a new CheckerError with the specified detail message and no cause (use this at the
     * root cause).
     *
     * @param message the detail message
     */
    public BugInCF(String message) {
        this(message, new Throwable());
    }

    /**
     * Constructs a new CheckerError with a detail message composed from the given arguments, and
     * with no cause (use the current callstack as the root cause).
     *
     * @param fmt the format string
     * @param args the arguments for the format string
     */
    public BugInCF(String fmt, Object... args) {
        this(String.format(fmt, args), new Throwable());
    }

    /**
     * Constructs a new CheckerError with the specified cause.
     *
     * @param cause the cause; its detail message will be used and must be non-null
     */
    @SuppressWarnings("nullness")
    public BugInCF(Throwable cause) {
        this(cause.getMessage(), new Throwable());
    }

    /**
     * Constructs a new CheckerError with the specified detail message and cause.
     *
     * @param message the detail message
     * @param cause the cause
     */
    public BugInCF(String message, Throwable cause) {
        super(message, cause);
        if (message == null) {
            throw new BugInCF("Must have a detail message.");
        }
        if (cause == null) {
            throw new BugInCF("Must have a cause throwable.");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy