Thu, 04 Nov 2010 12:57:48 +0000
6993963: Project Coin: Use precise exception analysis for effectively final catch parameters
Summary: More precise rethrow analysis should be extended to effectively-final exception parameters. Multicatch parameters should be made implicitly final.
Reviewed-by: jjg, darcy
duke@1 | 1 | #!/bin/sh |
duke@1 | 2 | |
duke@1 | 3 | # |
ohair@554 | 4 | # Copyright (c) 2004, 2007, Oracle and/or its affiliates. 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. |
duke@1 | 10 | # |
duke@1 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | # accompanied this code). |
duke@1 | 16 | # |
duke@1 | 17 | # You should have received a copy of the GNU General Public License version |
duke@1 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | # |
ohair@554 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | # questions. |
duke@1 | 24 | # |
duke@1 | 25 | |
duke@1 | 26 | # @test |
duke@1 | 27 | # @bug 4989093 5009164 5023880 5029482 6206786 |
duke@1 | 28 | # @run shell ../verifyVariables.sh |
duke@1 | 29 | # @run shell scanner.sh |
duke@1 | 30 | # @summary Test source order scanner |
duke@1 | 31 | # @author Joseph D. Darcy |
duke@1 | 32 | |
duke@1 | 33 | OS=`uname -s`; |
duke@1 | 34 | case "${OS}" in |
duke@1 | 35 | Windows* | CYGWIN* ) |
duke@1 | 36 | SEP=";" |
duke@1 | 37 | ;; |
duke@1 | 38 | |
duke@1 | 39 | * ) |
duke@1 | 40 | SEP=":" |
duke@1 | 41 | ;; |
duke@1 | 42 | esac |
duke@1 | 43 | |
duke@1 | 44 | JARCP=scanner.jar |
duke@1 | 45 | |
duke@1 | 46 | # Construct path to apt executable |
duke@1 | 47 | APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -nocompile " |
duke@1 | 48 | |
duke@1 | 49 | printf "%s\n" "APT = ${APT}" |
duke@1 | 50 | |
duke@1 | 51 | # Construct path to javac executable |
duke@1 | 52 | JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . " |
duke@1 | 53 | JAR="${TESTJAVA}/bin/jar " |
duke@1 | 54 | |
duke@1 | 55 | ${JAVAC} ${TESTSRC}/Scanner.java ${TESTSRC}/VisitOrder.java ${TESTSRC}/Counter.java ${TESTSRC}/MemberOrderApf.java |
duke@1 | 56 | RESULT=$? |
duke@1 | 57 | |
duke@1 | 58 | case "${RESULT}" in |
duke@1 | 59 | 0 ) |
duke@1 | 60 | ;; |
duke@1 | 61 | |
duke@1 | 62 | * ) |
duke@1 | 63 | echo "Compilation failed." |
duke@1 | 64 | exit 1 |
duke@1 | 65 | esac |
duke@1 | 66 | |
duke@1 | 67 | |
duke@1 | 68 | echo "Making services directory and copying services information." |
duke@1 | 69 | mkdir -p META-INF/services |
duke@1 | 70 | |
duke@1 | 71 | cp ${TESTSRC}/servicesScanner META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory |
duke@1 | 72 | |
duke@1 | 73 | ${JAR} cf0 scanner.jar Scanner*.class META-INF |
duke@1 | 74 | |
duke@1 | 75 | # Jar files created; verify options properly present on both initial |
duke@1 | 76 | # and recursive apt runs |
duke@1 | 77 | |
duke@1 | 78 | #--------------------------------------------------------- |
duke@1 | 79 | |
duke@1 | 80 | unset CLASSPATH |
duke@1 | 81 | |
duke@1 | 82 | printf "%s\n" "-classpath ${JARCP}" > options |
duke@1 | 83 | printf "%s\n" "-sourcepath ${TESTSRC}" >> options |
duke@1 | 84 | printf "%s\n" "${TESTSRC}/Order.java" >> options |
duke@1 | 85 | |
duke@1 | 86 | ${APT} @options |
duke@1 | 87 | |
duke@1 | 88 | RESULT=$? |
duke@1 | 89 | case "${RESULT}" in |
duke@1 | 90 | 0 ) |
duke@1 | 91 | ;; |
duke@1 | 92 | |
duke@1 | 93 | * ) |
duke@1 | 94 | echo "Program elements visited in wrong order" |
duke@1 | 95 | exit 1 |
duke@1 | 96 | ;; |
duke@1 | 97 | esac |
duke@1 | 98 | |
duke@1 | 99 | #--------------------------------------------------------- |
duke@1 | 100 | |
duke@1 | 101 | # Verify that plain decl' scanner and source order decl' scanner |
duke@1 | 102 | # record the same number of elements for an enum |
duke@1 | 103 | |
duke@1 | 104 | printf "%s\n" "-factorypath ." > options2 |
duke@1 | 105 | printf "%s\n" "-factory Counter" >> options2 |
duke@1 | 106 | printf "%s\n" "-sourcepath ${TESTSRC}" >> options2 |
duke@1 | 107 | printf "%s\n" "${TESTSRC}/TestEnum.java" >> options2 |
duke@1 | 108 | |
duke@1 | 109 | |
duke@1 | 110 | $APT @options2 |
duke@1 | 111 | |
duke@1 | 112 | RESULT=$? |
duke@1 | 113 | case "${RESULT}" in |
duke@1 | 114 | 0 ) |
duke@1 | 115 | ;; |
duke@1 | 116 | |
duke@1 | 117 | * ) |
duke@1 | 118 | echo "Improper counts" |
duke@1 | 119 | exit 1 |
duke@1 | 120 | ;; |
duke@1 | 121 | esac |
duke@1 | 122 | |
duke@1 | 123 | #--------------------------------------------------------- |
duke@1 | 124 | |
duke@1 | 125 | # Verify that members happen to be returned in source order |
duke@1 | 126 | |
duke@1 | 127 | printf "%s\n" "-factorypath ." > options3 |
duke@1 | 128 | printf "%s\n" "-factory MemberOrderApf" >> options3 |
duke@1 | 129 | printf "%s\n" "-sourcepath ${TESTSRC}" >> options3 |
duke@1 | 130 | printf "%s\n" "${TESTSRC}/Order.java" >> options3 |
duke@1 | 131 | |
duke@1 | 132 | $APT @options3 |
duke@1 | 133 | |
duke@1 | 134 | RESULT=$? |
duke@1 | 135 | case "${RESULT}" in |
duke@1 | 136 | 0 ) |
duke@1 | 137 | ;; |
duke@1 | 138 | |
duke@1 | 139 | * ) |
duke@1 | 140 | echo "Improper counts" |
duke@1 | 141 | exit 1 |
duke@1 | 142 | ;; |
duke@1 | 143 | esac |
duke@1 | 144 | |
duke@1 | 145 | |
duke@1 | 146 | exit 0; |