test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh

Fri, 26 Jun 2009 19:12:41 -0700

author
jjg
date
Fri, 26 Jun 2009 19:12:41 -0700
changeset 309
664edca41e34
parent 1
9a66ca7c79fa
child 390
f0c9fc46990b
permissions
-rw-r--r--

6855544: add missing files
Reviewed-by: jjg, mcimadamore, darcy
Contributed-by: mernst@cs.washington.edu, mali@csail.mit.edu, mpapi@csail.mit.edu

     1 #
     2 # Copyright 1998-2003 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20 # CA 95054 USA or visit www.sun.com if you need additional information or
    21 # have any 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     NULL=/dev/null
    57     PS=":"
    58     FS="/"
    59     ;;
    60   Windows* )
    61     NULL=NUL
    62     PS=";"
    63     FS="\\"
    64     ;;
    65   * )
    66     echo "Unrecognized system!"
    67     exit 1;
    68     ;;
    69 esac
    71 rm -f ${TESTCLASSES}${FS}p1${FS}*.class ${TESTCLASSES}${FS}p2${FS}*.class
    73 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}${FS}p1${FS}ProtectedInnerClass1.java" "${TESTSRC}${FS}p2${FS}ProtectedInnerClass2.java"
    74 "${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
    75 result=$?
    76 if [ $result -eq 0 ]
    77 then
    78   echo "Passed"
    79 else
    80   echo "Failed"
    81 fi
    82 exit $result

mercurial