Mon, 28 Feb 2011 13:42:24 -0800
7022711: compiler crash in try-with-resources
Reviewed-by: mcimadamore
1 #
2 # Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation.
8 #
9 # This code is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # version 2 for more details (a copy is included in the LICENSE file that
13 # accompanied this code).
14 #
15 # You should have received a copy of the GNU General Public License version
16 # 2 along with this work; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 #
19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 # or visit www.oracle.com if you need additional information or have any
21 # questions.
22 #
24 # @test
25 # @bug 4087314 4800342
26 # @summary Verify allowed access to protected class from another package.
27 # @author William Maddox (maddox)
28 #
29 # @run shell ProtectedInnerClass.sh
32 if [ "${TESTSRC}" = "" ]
33 then
34 echo "TESTSRC not set. Test cannot execute. Failed."
35 exit 1
36 fi
37 echo "TESTSRC=${TESTSRC}"
38 if [ "${TESTJAVA}" = "" ]
39 then
40 echo "TESTJAVA not set. Test cannot execute. Failed."
41 exit 1
42 fi
43 echo "TESTJAVA=${TESTJAVA}"
44 if [ "${TESTCLASSES}" = "" ]
45 then
46 echo "TESTCLASSES not set. Test cannot execute. Failed."
47 exit 1
48 fi
49 echo "TESTCLASSES=${TESTCLASSES}"
50 echo "CLASSPATH=${CLASSPATH}"
52 # set platform-dependent variables
53 OS=`uname -s`
54 case "$OS" in
55 SunOS | Linux )
56 PS=":"
57 FS="/"
58 ;;
59 CYGWIN* )
60 PS=";" # native PS, not Cygwin PS
61 FS="/"
62 ;;
63 Windows* )
64 PS=";"
65 FS="\\"
66 ;;
67 * )
68 echo "Unrecognized system!"
69 exit 1;
70 ;;
71 esac
73 rm -f ${TESTCLASSES}${FS}p1${FS}*.class ${TESTCLASSES}${FS}p2${FS}*.class
75 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}${FS}p1${FS}ProtectedInnerClass1.java" "${TESTSRC}${FS}p2${FS}ProtectedInnerClass2.java"
76 "${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
77 result=$?
78 if [ $result -eq 0 ]
79 then
80 echo "Passed"
81 else
82 echo "Failed"
83 fi
84 exit $result