2011-02-28 21:42:24 +00:00
|
|
|
/*
|
|
|
|
* @test /nodynamiccopyright/
|
|
|
|
* @bug 7022711
|
|
|
|
* @summary compiler crash in try-with-resources
|
|
|
|
* @compile/fail/ref=T7022711.out -XDrawDiagnostics T7022711.java
|
|
|
|
*/
|
|
|
|
|
|
|
|
import java.io.*;
|
|
|
|
|
|
|
|
class T7022711 {
|
2023-01-17 04:43:40 +00:00
|
|
|
public static void meth() {
|
2015-12-09 13:26:56 +00:00
|
|
|
// declared resource
|
2011-02-28 21:42:24 +00:00
|
|
|
try (DataInputStream is = new DataInputStream(new FileInputStream("x"))) {
|
|
|
|
while (true) {
|
|
|
|
is.getChar(); // method not found
|
|
|
|
}
|
|
|
|
} catch (EOFException e) {
|
|
|
|
}
|
2015-12-09 13:26:56 +00:00
|
|
|
|
|
|
|
// resource as variable
|
|
|
|
DataInputStream is = new DataInputStream(new FileInputStream("x"));
|
|
|
|
try (is) {
|
|
|
|
while (true) {
|
|
|
|
is.getChar(); // method not found
|
|
|
|
}
|
|
|
|
} catch (EOFException e) {
|
|
|
|
}
|
2011-02-28 21:42:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|