[java] More tests for preview; minor fixes

GitOrigin-RevId: 7f72c5f68ab821e728eb0d5152f0910f48035046
This commit is contained in:
Tagir Valeev
2022-07-20 15:22:33 +02:00
committed by intellij-monorepo-bot
parent 7a1f179f41
commit 9c6aeba5b4
726 changed files with 874 additions and 767 deletions

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
static class E1 extends Exception { }

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
static class E1 extends Exception { }
static class E2 extends Exception { }

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface I {
void a() throws InterruptedException;

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface I {
void a() throws InterruptedException;

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface I { }

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
public static void main(String[] args){
I i = C::foo;

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
import java.io.*;
class C {

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class Test {
interface I<E extends Exception> {

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface ExceptionThrower2 {

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
static class E1 extends Exception { }

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
static class E1 extends Exception { }
static class E2 extends Exception { }

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface I {
void a();

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface I {
void a();

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface I { }

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
public static void main(String[] args){
I i = C::f<caret>oo;

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
import java.io.*;
class C {

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class Test {
interface I<E extends Exception> {

View File

@@ -1,4 +1,4 @@
// "Add exception to method signature" "true"
// "Add exception to method signature" "true-preview"
class C {
interface ExceptionThrower2 {

View File

@@ -0,0 +1,16 @@
// "Add exception to method signature" "true-preview"
class C {
interface I {
void a();
}
{
Callable<I> i = () -> {
return new I() {
public void a() throws InterruptedException {
Thread.sleep(2000);
}
};
};
}
}

View File

@@ -0,0 +1,37 @@
// "Add exception to method signature" "true-preview"
class C {
interface ExceptionThrower2 {
<TException extends Exception>
TException
throwChainedException(Class<TException> exceptionClass, Throwable cause, String format, Object... argArr) throws TException;
}
public interface IExample {
void foo();
}
public static final class Example implements IExample {
private final ExceptionThrower2 et;
public Example(ExceptionThrower2 et) {
this.et = et;
}
@Override
public void foo() throws Exception {
try {
_foo();
} catch (Exception e) {
throw et.throwChainedException(Exception.class, e, "Error: [%s]", e.getMessage());
}
}
private void _foo()
throws Exception {
throw new Exception();
}
}
}