This task will add a test case for JShell crashing by running the following example code. This bug has been fixed by https://bugs.openjdk.org/browse/JDK-8292755
// Case A
@FunctionalInterface
interface RunnableWithThrowable {
void run() throws Throwable;
// You can also replace `static` with `default` and test again
static RunnableWithThrowable getInstance() {
return () -> { throw new NotExist(); };
}
}
// Case B
@FunctionalInterface
interface RunnableWithGenericException<X extends Throwable> {
void run() throws X;
static RunnableWithGenericException<?> getInstance() {
return () -> { throw new NotExist(); };
}
}
// Case A
@FunctionalInterface
interface RunnableWithThrowable {
void run() throws Throwable;
// You can also replace `static` with `default` and test again
static RunnableWithThrowable getInstance() {
return () -> { throw new NotExist(); };
}
}
// Case B
@FunctionalInterface
interface RunnableWithGenericException<X extends Throwable> {
void run() throws X;
static RunnableWithGenericException<?> getInstance() {
return () -> { throw new NotExist(); };
}
}
- relates to
-
JDK-8292755 Non-default method in interface leads to a stack overflow in JShell
- Resolved