# HG changeset patch # User jjg # Date 1298929344 28800 # Node ID 67d6b2df47ba921e597ba1e477cca31b52e418bb # Parent bf9f162c7104e1f3ea3d07c7400428d630d0614d 7022711: compiler crash in try-with-resources Reviewed-by: mcimadamore diff -r bf9f162c7104 -r 67d6b2df47ba src/share/classes/com/sun/tools/javac/code/Kinds.java --- a/src/share/classes/com/sun/tools/javac/code/Kinds.java Mon Feb 28 13:37:48 2011 -0800 +++ b/src/share/classes/com/sun/tools/javac/code/Kinds.java Mon Feb 28 13:42:24 2011 -0800 @@ -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 @@ case PARAMETER: case LOCAL_VARIABLE: case EXCEPTION_PARAMETER: + case RESOURCE_VARIABLE: return KindName.VAR; case CONSTRUCTOR: diff -r bf9f162c7104 -r 67d6b2df47ba test/tools/javac/TryWithResources/T7022711.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/TryWithResources/T7022711.java Mon Feb 28 13:42:24 2011 -0800 @@ -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) { + } + } +} + diff -r bf9f162c7104 -r 67d6b2df47ba test/tools/javac/TryWithResources/T7022711.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/TryWithResources/T7022711.out Mon Feb 28 13:42:24 2011 -0800 @@ -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