test/tools/javac/TryWithResources/TwrInference.java

Fri, 16 Jul 2010 19:35:24 -0700

author
darcy
date
Fri, 16 Jul 2010 19:35:24 -0700
changeset 609
13354e1abba7
permissions
-rw-r--r--

6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
6964740: Project Coin: More tests for ARM compiler changes
6965277: Project Coin: Correctness issues in ARM implementation
6967065: add -Xlint warning category for Automatic Resource Management (ARM)
Reviewed-by: jjb, darcy, mcimadamore, jjg, briangoetz
Contributed-by: tball@google.com

darcy@609 1 /*
darcy@609 2 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
darcy@609 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
darcy@609 4 *
darcy@609 5 * This code is free software; you can redistribute it and/or modify it
darcy@609 6 * under the terms of the GNU General Public License version 2 only, as
darcy@609 7 * published by the Free Software Foundation.
darcy@609 8 *
darcy@609 9 * This code is distributed in the hope that it will be useful, but WITHOUT
darcy@609 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
darcy@609 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
darcy@609 12 * version 2 for more details (a copy is included in the LICENSE file that
darcy@609 13 * accompanied this code).
darcy@609 14 *
darcy@609 15 * You should have received a copy of the GNU General Public License version
darcy@609 16 * 2 along with this work; if not, write to the Free Software Foundation,
darcy@609 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
darcy@609 18 *
darcy@609 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
darcy@609 20 * or visit www.oracle.com if you need additional information or have any
darcy@609 21 * questions.
darcy@609 22 */
darcy@609 23
darcy@609 24 /*
darcy@609 25 * @test
darcy@609 26 * @bug 6911256 6964740 6965277
darcy@609 27 * @author Maurizio Cimadamore
darcy@609 28 * @summary Verify that method type-inference works as expected in TWR context
darcy@609 29 * @compile TwrInference.java
darcy@609 30 */
darcy@609 31
darcy@609 32 class TwrInference {
darcy@609 33
darcy@609 34 public void test() {
darcy@609 35 try(getX()) {
darcy@609 36 //do something
darcy@609 37 } catch (Exception e) { // Not reachable
darcy@609 38 throw new AssertionError("Shouldn't reach here", e);
darcy@609 39 }
darcy@609 40 }
darcy@609 41
darcy@609 42 <X> X getX() { return null; }
darcy@609 43 }

mercurial