mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 15:50:53 +07:00
77 lines
1.4 KiB
Java
77 lines
1.4 KiB
Java
import java.io.*;
|
|
|
|
interface ThrowsCloneNotSupportedException {
|
|
void f() throws CloneNotSupportedException;
|
|
}
|
|
|
|
interface ThrowsIOException {
|
|
void f() throws IOException;
|
|
}
|
|
|
|
abstract class ThrowsNothing implements ThrowsCloneNotSupportedException, ThrowsIOException {
|
|
private void foo() {
|
|
f();
|
|
}
|
|
}
|
|
|
|
class Main {
|
|
public static void main(String[] args) {
|
|
ThrowsNothing throwsNothing = null;
|
|
throwsNothing.f();
|
|
}
|
|
}
|
|
|
|
|
|
interface A {
|
|
void close() throws Exception;
|
|
}
|
|
|
|
interface B {
|
|
void close() throws IOException;
|
|
}
|
|
|
|
abstract class AB implements A, B {}
|
|
abstract class BA implements B, A {}
|
|
|
|
class ABUsage {
|
|
void foo(AB ab) {
|
|
try {
|
|
ab.close();
|
|
}
|
|
catch (IOException ignored) {}
|
|
}
|
|
|
|
void foo(BA ba) {
|
|
try {
|
|
ba.close();
|
|
}
|
|
catch (IOException ignored) {}
|
|
}
|
|
}
|
|
|
|
interface C {
|
|
void close();
|
|
}
|
|
|
|
interface D {
|
|
void close() throws IOException;
|
|
}
|
|
|
|
abstract class CD implements C, D {}
|
|
abstract class DC implements D, C {}
|
|
|
|
class CDUsage {
|
|
void foo(CD cd) {
|
|
try {
|
|
cd.close();
|
|
}
|
|
catch (<error descr="Exception 'java.io.IOException' is never thrown in the corresponding try block">IOException ignored</error>) {}
|
|
}
|
|
|
|
void foo(DC dc) {
|
|
try {
|
|
dc.close();
|
|
}
|
|
catch (<error descr="Exception 'java.io.IOException' is never thrown in the corresponding try block">IOException ignored</error>) {}
|
|
}
|
|
} |