Mon, 28 Feb 2011 13:42:24 -0800
7022711: compiler crash in try-with-resources
Reviewed-by: mcimadamore
1.1 --- a/src/share/classes/com/sun/tools/javac/code/Kinds.java Mon Feb 28 13:37:48 2011 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Kinds.java Mon Feb 28 13:42:24 2011 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -163,6 +163,7 @@ 1.11 case PARAMETER: 1.12 case LOCAL_VARIABLE: 1.13 case EXCEPTION_PARAMETER: 1.14 + case RESOURCE_VARIABLE: 1.15 return KindName.VAR; 1.16 1.17 case CONSTRUCTOR:
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/TryWithResources/T7022711.java Mon Feb 28 13:42:24 2011 -0800 2.3 @@ -0,0 +1,20 @@ 2.4 +/* 2.5 + * @test /nodynamiccopyright/ 2.6 + * @bug 7022711 2.7 + * @summary compiler crash in try-with-resources 2.8 + * @compile/fail/ref=T7022711.out -XDrawDiagnostics T7022711.java 2.9 + */ 2.10 + 2.11 +import java.io.*; 2.12 + 2.13 +class T7022711 { 2.14 + public static void main (String args[]) throws Exception { 2.15 + try (DataInputStream is = new DataInputStream(new FileInputStream("x"))) { 2.16 + while (true) { 2.17 + is.getChar(); // method not found 2.18 + } 2.19 + } catch (EOFException e) { 2.20 + } 2.21 + } 2.22 +} 2.23 +
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/tools/javac/TryWithResources/T7022711.out Mon Feb 28 13:42:24 2011 -0800 3.3 @@ -0,0 +1,2 @@ 3.4 +T7022711.java:14:19: compiler.err.cant.resolve.location.args: kindname.method, getChar, , , (compiler.misc.location.1: kindname.variable, is, java.io.DataInputStream) 3.5 +1 error