quick fix which adds exception from field initializer to constructor signature (IDEA-142284)

This commit is contained in:
Dmitry Batkovich
2015-11-13 15:59:53 +03:00
parent 558e227134
commit 6afbed569a
17 changed files with 292 additions and 2 deletions
@@ -0,0 +1,23 @@
// "Add exception to class constructors signature" "true"
import java.io.FileWriter;
import java.io.IOException;
class C {
final FileWriter fw = new FileWriter("asd");
C(int i) throws RuntimeException, IOException {
}
C(int i, int j) throws IOException {
}
C(int i, int j, int k) throws Exception {
}
C(int i, int j, int k, int l) throws IOException {
}
}
@@ -0,0 +1,10 @@
// "Add exception to class default constructor signature" "true"
import java.io.FileWriter;
import java.io.IOException;
class C {
final FileWriter fw = new FileWriter("asd");
C() throws IOException {
}
}
@@ -0,0 +1,11 @@
// "Add exception to class constructor signature" "true"
import java.io.FileWriter;
import java.io.IOException;
class C {
final FileWriter fw = new FileWriter("asd");
C(int i) throws RuntimeException, IOException {
}
}
@@ -0,0 +1,23 @@
// "Add exception to class constructors signature" "true"
import java.io.FileWriter;
import java.io.IOException;
class C {
final FileWriter fw = new FileWri<caret>ter("asd");
C(int i) throws RuntimeException {
}
C(int i, int j) throws IOException {
}
C(int i, int j, int k) throws Exception {
}
C(int i, int j, int k, int l) {
}
}
@@ -0,0 +1,7 @@
// "Add exception to class default constructor signature" "true"
import java.io.FileWriter;
class C {
final FileWriter fw = new FileWrit<caret>er("asd");
}
@@ -0,0 +1,15 @@
// "Add exception to class default constructor signature" "false"
import java.io.FileWriter;
class C {
final FileWriter fw = new MyCal<caret>lable() {
@Override
public FileWriter get() {
return new FileWriter("");
}
}.get();
interface MyCallable {
FileWriter get();
}
}
@@ -0,0 +1,10 @@
// "Add exception to class default constructor signature" "false"
import java.io.FileWriter;
class C {
final FileWriter fw = ((MyCall<caret>able) () -> new FileWriter("")).get();
interface MyCallable {
FileWriter get();
}
}
@@ -0,0 +1,11 @@
// "Add exception to class constructor signature" "false"
import java.io.FileWriter;
import java.io.IOException;
class C {
final FileWriter fw = new F<caret>ileWriter("asd");
C() throws IOException {
}
}
@@ -0,0 +1,10 @@
// "Add exception to class constructor signature" "true"
import java.io.FileWriter;
class C {
final FileWriter fw = new F<caret>ileWriter("asd");
C(int i) throws RuntimeException {
}
}