Thu, 24 Jul 2008 11:12:41 +0100
6594284: NPE thrown when calling a method on an intersection type
Summary: javac should report an error when the capture of an actual type parameter does not exist
Reviewed-by: jjg
duke@1 | 1 | #!echo "This is not a shell script" |
duke@1 | 2 | ############################################################################# |
duke@1 | 3 | # |
duke@1 | 4 | # Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. |
duke@1 | 5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 6 | # |
duke@1 | 7 | # This code is free software; you can redistribute it and/or modify it |
duke@1 | 8 | # under the terms of the GNU General Public License version 2 only, as |
duke@1 | 9 | # published by the Free Software Foundation. Sun designates this |
duke@1 | 10 | # particular file as subject to the "Classpath" exception as provided |
duke@1 | 11 | # by Sun in the LICENSE file that accompanied this code. |
duke@1 | 12 | # |
duke@1 | 13 | # This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 16 | # version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 17 | # accompanied this code). |
duke@1 | 18 | # |
duke@1 | 19 | # You should have received a copy of the GNU General Public License version |
duke@1 | 20 | # 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 21 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 22 | # |
duke@1 | 23 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@1 | 24 | # CA 95054 USA or visit www.sun.com if you need additional information or |
duke@1 | 25 | # have any questions. |
duke@1 | 26 | # |
duke@1 | 27 | ############################################################################# |
duke@1 | 28 | # |
duke@1 | 29 | # JPRT shell configuration for building. |
duke@1 | 30 | # |
duke@1 | 31 | # Input environment variables: |
duke@1 | 32 | # ALT_BOOTDIR |
duke@1 | 33 | # ALT_SLASH_JAVA |
duke@1 | 34 | # ALT_JDK_IMPORT_PATH |
duke@1 | 35 | # Windows Only: |
duke@1 | 36 | # PATH |
duke@1 | 37 | # PROCESSOR_IDENTIFIER |
duke@1 | 38 | # ROOTDIR |
duke@1 | 39 | # |
duke@1 | 40 | # Output variable settings: |
duke@1 | 41 | # make Full path to GNU make |
duke@1 | 42 | # |
duke@1 | 43 | # Output environment variables: |
duke@1 | 44 | # PATH |
duke@1 | 45 | # Windows Only: |
duke@1 | 46 | # ALT_DEVTOOLS_PATH (To avoid the C:/UTILS default) |
duke@1 | 47 | # |
duke@1 | 48 | # After JDK6, most settings will be found via ALT_SLASH_JAVA or |
duke@1 | 49 | # by way of other system environment variables. If this was JDK5 |
duke@1 | 50 | # or an older JDK, you might need to export more ALT_* variables. |
duke@1 | 51 | # |
duke@1 | 52 | ############################################################################# |
duke@1 | 53 | |
duke@1 | 54 | ############################################################################# |
duke@1 | 55 | # Error |
duke@1 | 56 | error() # message |
duke@1 | 57 | { |
duke@1 | 58 | echo "ERROR: $1" |
duke@1 | 59 | exit 6 |
duke@1 | 60 | } |
duke@1 | 61 | # Directory must exist |
duke@1 | 62 | dirMustExist() # dir name |
duke@1 | 63 | { |
duke@1 | 64 | if [ ! -d "$1" ] ; then |
duke@1 | 65 | error "Directory for $2 does not exist: $1" |
duke@1 | 66 | fi |
duke@1 | 67 | } |
duke@1 | 68 | # File must exist |
duke@1 | 69 | fileMustExist() # dir name |
duke@1 | 70 | { |
duke@1 | 71 | if [ ! -f "$1" ] ; then |
duke@1 | 72 | error "File for $2 does not exist: $1" |
duke@1 | 73 | fi |
duke@1 | 74 | } |
duke@1 | 75 | ############################################################################# |
duke@1 | 76 | |
duke@1 | 77 | # Should be set by JPRT as the 3 basic inputs |
duke@1 | 78 | bootdir="${ALT_BOOTDIR}" |
duke@1 | 79 | slashjava="${ALT_SLASH_JAVA}" |
duke@1 | 80 | jdk_import="${ALT_JDK_IMPORT_PATH}" |
duke@1 | 81 | |
duke@1 | 82 | # Check input |
duke@1 | 83 | dirMustExist "${bootdir}" ALT_BOOTDIR |
duke@1 | 84 | dirMustExist "${slashjava}" ALT_SLASH_JAVA |
duke@1 | 85 | dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH |
duke@1 | 86 | |
duke@1 | 87 | # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise. |
duke@1 | 88 | osname=`uname -s` |
duke@1 | 89 | if [ "${osname}" = SunOS ] ; then |
duke@1 | 90 | |
duke@1 | 91 | # SOLARIS: Sparc or X86 |
duke@1 | 92 | osarch=`uname -p` |
duke@1 | 93 | if [ "${osarch}" = sparc ] ; then |
duke@1 | 94 | solaris_arch=sparc |
duke@1 | 95 | else |
duke@1 | 96 | solaris_arch=i386 |
duke@1 | 97 | fi |
duke@1 | 98 | |
duke@1 | 99 | # Add basic solaris system paths |
duke@1 | 100 | path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin |
duke@1 | 101 | |
duke@1 | 102 | # Get the previous JDK to be used to bootstrap the build |
duke@1 | 103 | path4sdk=${bootdir}/bin:${path4sdk} |
duke@1 | 104 | |
duke@1 | 105 | # Ant |
duke@1 | 106 | ANT_HOME=${slashjava}/devtools/share/ant/1.7.0 |
duke@1 | 107 | export ANT_HOME |
duke@1 | 108 | antbindir=${ANT_HOME}/bin |
duke@1 | 109 | fileMustExist "${antbindir}/ant" ant |
duke@1 | 110 | path4sdk=${antbindir}:${path4sdk} |
duke@1 | 111 | |
duke@1 | 112 | # Find GNU make |
duke@1 | 113 | make=/usr/sfw/bin/gmake |
duke@1 | 114 | if [ ! -f ${make} ] ; then |
duke@1 | 115 | make=/opt/sfw/bin/gmake |
duke@1 | 116 | if [ ! -f ${make} ] ; then |
duke@1 | 117 | make=${slashjava}/devtools/${solaris_arch}/bin/gnumake |
duke@1 | 118 | fi |
duke@1 | 119 | fi |
duke@1 | 120 | fileMustExist "${make}" make |
duke@1 | 121 | |
duke@1 | 122 | # File creation mask |
duke@1 | 123 | umask 002 |
duke@1 | 124 | |
duke@1 | 125 | elif [ "${osname}" = Linux ] ; then |
duke@1 | 126 | |
duke@1 | 127 | # LINUX: X86, AMD64 |
duke@1 | 128 | osarch=`uname -m` |
duke@1 | 129 | if [ "${osarch}" = i686 ] ; then |
duke@1 | 130 | linux_arch=i586 |
duke@1 | 131 | elif [ "${osarch}" = x86_64 ] ; then |
duke@1 | 132 | linux_arch=amd64 |
duke@1 | 133 | fi |
duke@1 | 134 | |
duke@1 | 135 | # Add basic paths |
duke@1 | 136 | path4sdk=/usr/bin:/bin:/usr/sbin:/sbin |
duke@1 | 137 | |
duke@1 | 138 | # Get the previous JDK to be used to bootstrap the build |
duke@1 | 139 | path4sdk=${bootdir}/bin:${path4sdk} |
duke@1 | 140 | |
duke@1 | 141 | # Ant |
duke@1 | 142 | ANT_HOME=${slashjava}/devtools/share/ant/1.7.0 |
duke@1 | 143 | export ANT_HOME |
duke@1 | 144 | antbindir=${ANT_HOME}/bin |
duke@1 | 145 | fileMustExist "${antbindir}/ant" ant |
duke@1 | 146 | path4sdk=${antbindir}:${path4sdk} |
duke@1 | 147 | |
duke@1 | 148 | # Find GNU make |
duke@1 | 149 | make=/usr/bin/make |
duke@1 | 150 | fileMustExist "${make}" make |
duke@1 | 151 | |
duke@1 | 152 | umask 002 |
duke@1 | 153 | |
duke@1 | 154 | else |
duke@1 | 155 | |
duke@1 | 156 | # Windows: Differs on CYGWIN vs. MKS |
duke@1 | 157 | # Also, blanks in pathnames gives GNU make headaches, so anything placed |
duke@1 | 158 | # in any ALT_* variable should be the short windows dosname. |
duke@1 | 159 | |
duke@1 | 160 | # WINDOWS: Install and use MKS or CYGWIN (should have already been done) |
duke@1 | 161 | # Assumption here is that you are in a shell window via MKS or cygwin. |
duke@1 | 162 | # MKS install should have defined the environment variable ROOTDIR. |
duke@1 | 163 | # We also need to figure out which one we have: X86, AMD64 |
duke@1 | 164 | if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then |
duke@1 | 165 | windows_arch=amd64 |
duke@1 | 166 | else |
duke@1 | 167 | windows_arch=i586 |
duke@1 | 168 | fi |
duke@1 | 169 | |
duke@1 | 170 | # We need to determine if we are running a CYGWIN shell or an MKS shell |
duke@1 | 171 | # (if uname isn't available, then it will be unix_toolset=unknown) |
duke@1 | 172 | unix_toolset=unknown |
duke@1 | 173 | if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then |
duke@1 | 174 | # We kind of assume ROOTDIR is where MKS is and it's ok |
duke@1 | 175 | unix_toolset=MKS |
duke@1 | 176 | mkshome=`dosname -s "${ROOTDIR}"` |
duke@1 | 177 | # Utility to convert to short pathnames without spaces |
duke@1 | 178 | dosname="${mkshome}/mksnt/dosname -s" |
duke@1 | 179 | # Most unix utilities are in the mksnt directory of ROOTDIR |
duke@1 | 180 | unixcommand_path="${mkshome}/mksnt" |
duke@1 | 181 | path4sdk="${unixcommand_path}" |
duke@1 | 182 | dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH |
duke@1 | 183 | devtools_path="${slashjava}/devtools/win32/bin" |
duke@1 | 184 | path4sdk="${devtools_path};${path4sdk}" |
duke@1 | 185 | # Normally this need not be set, but on Windows it's default is C:/UTILS |
duke@1 | 186 | ALT_DEVTOOLS_PATH="${devtools_path}" |
duke@1 | 187 | export ALT_DEVTOOLS_PATH |
duke@1 | 188 | dirMustExist "${devtools_path}" ALT_DEVTOOLS_PATH |
duke@1 | 189 | # Find GNU make |
duke@1 | 190 | make="${devtools_path}/gnumake.exe" |
duke@1 | 191 | fileMustExist "${make}" make |
duke@1 | 192 | elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then |
duke@1 | 193 | # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist |
duke@1 | 194 | unix_toolset=CYGWIN |
duke@1 | 195 | # Utility to convert to short pathnames without spaces |
duke@1 | 196 | dosname="/usr/bin/cygpath -a -m -s" |
duke@1 | 197 | # Most unix utilities are in the /usr/bin |
duke@1 | 198 | unixcommand_path="/usr/bin" |
duke@1 | 199 | path4sdk="${unixcommand_path}" |
duke@1 | 200 | dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH |
duke@1 | 201 | # Find GNU make |
duke@1 | 202 | make="${unixcommand_path}/make.exe" |
duke@1 | 203 | fileMustExist "${make}" make |
duke@1 | 204 | else |
duke@1 | 205 | echo "WARNING: Cannot figure out if this is MKS or CYGWIN" |
duke@1 | 206 | fi |
duke@1 | 207 | |
duke@1 | 208 | # WINDOWS: Get the previous JDK to be used to bootstrap the build |
duke@1 | 209 | path4sdk="${bootdir}/bin;${path4sdk}" |
duke@1 | 210 | |
duke@1 | 211 | # Ant |
duke@1 | 212 | ANT_HOME=${slashjava}/devtools/share/ant/1.7.0 |
duke@1 | 213 | export ANT_HOME |
duke@1 | 214 | antbindir=${ANT_HOME}/bin |
duke@1 | 215 | fileMustExist "${antbindir}/ant" ant |
duke@1 | 216 | path4sdk="${antbindir};${path4sdk}" |
duke@1 | 217 | |
duke@1 | 218 | # Turn all \\ into /, remove duplicates and trailing / |
duke@1 | 219 | slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`" |
duke@1 | 220 | |
duke@1 | 221 | # For windows, it's hard to know where the system is, so we just add this |
duke@1 | 222 | # to PATH. |
duke@1 | 223 | path4sdk="${slash_path};${PATH}" |
duke@1 | 224 | |
duke@1 | 225 | # Convert path4sdk to cygwin style |
duke@1 | 226 | if [ "${unix_toolset}" = CYGWIN ] ; then |
duke@1 | 227 | path4sdk="`/usr/bin/cygpath -p ${path4sdk}`" |
duke@1 | 228 | fi |
duke@1 | 229 | |
duke@1 | 230 | fi |
duke@1 | 231 | |
duke@1 | 232 | # Export PATH setting |
duke@1 | 233 | PATH="${path4sdk}" |
duke@1 | 234 | export PATH |
duke@1 | 235 | |
duke@1 | 236 | # Things we need to unset |
duke@1 | 237 | unset LD_LIBRARY_PATH |
duke@1 | 238 | unset LD_LIBRARY_PATH_32 |
duke@1 | 239 | unset LD_LIBRARY_PATH_64 |
duke@1 | 240 | unset JAVA_HOME |
duke@1 | 241 |