7022711: compiler crash in try-with-resources

Reviewed-by: mcimadamore
This commit is contained in:
Jonathan Gibbons 2011-02-28 13:42:24 -08:00
parent 148841e5e1
commit 36ed816102
3 changed files with 24 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -163,6 +163,7 @@ public class Kinds {
case PARAMETER:
case LOCAL_VARIABLE:
case EXCEPTION_PARAMETER:
case RESOURCE_VARIABLE:
return KindName.VAR;
case CONSTRUCTOR:

View File

@ -0,0 +1,20 @@
/*
* @test /nodynamiccopyright/
* @bug 7022711
* @summary compiler crash in try-with-resources
* @compile/fail/ref=T7022711.out -XDrawDiagnostics T7022711.java
*/
import java.io.*;
class T7022711 {
public static void main (String args[]) throws Exception {
try (DataInputStream is = new DataInputStream(new FileInputStream("x"))) {
while (true) {
is.getChar(); // method not found
}
} catch (EOFException e) {
}
}
}

View File

@ -0,0 +1,2 @@
T7022711.java:14:19: compiler.err.cant.resolve.location.args: kindname.method, getChar, , , (compiler.misc.location.1: kindname.variable, is, java.io.DataInputStream)
1 error