src.samples.java.ex.DRE_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sb-contrib Show documentation
Show all versions of sb-contrib Show documentation
An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.
The newest version!
package ex;
import java.io.IOException;
import java.sql.SQLException;
@SuppressWarnings("all")
public class DRE_Sample {
public void test1(int a) throws NullPointerException {
}
public void test2(int b) throws ClassCastException, IOException, IllegalMonitorStateException {
if (b == 0) {
throw new IOException("test");
}
}
public void test3(int c) throws SQLException {
if (c == 0) {
throw new SQLException("test");
}
}
public void test4(int d) throws CustomRuntimeException {
if (d == 0) {
throw new CustomRuntimeException();
}
}
}
@SuppressWarnings("all")
class CustomRuntimeException extends RuntimeException {
}
class TestRuntimeExceptionOnImplementingClass implements ThrowsRuntimeException {
@Override
public String someMethod() {
return "foo";
}
}
interface ThrowsRuntimeException {
public Object someMethod() throws RuntimeException;
}