1.1 --- a/test/tools/apt/Basics/apt.sh Sat Jan 28 20:42:11 2012 -0800 1.2 +++ b/test/tools/apt/Basics/apt.sh Sun Feb 05 21:59:45 2012 -0800 1.3 @@ -1,7 +1,7 @@ 1.4 #!/bin/sh 1.5 1.6 # 1.7 -# Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. 1.8 +# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. 1.9 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.10 # 1.11 # This code is free software; you can redistribute it and/or modify it 1.12 @@ -24,11 +24,10 @@ 1.13 # 1.14 1.15 # @test 1.16 -# @bug 4908512 5024825 4957203 4993280 4996963 6174696 6177059 1.17 +# @bug 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249 1.18 # @run shell ../verifyVariables.sh 1.19 -# @build Milk MethodAnnotations NestedClassAnnotations StaticFieldAnnotations StaticMethodAnnotations ParameterAnnotations 1.20 # @run shell apt.sh 1.21 -# @summary test consistency of annotation discovery 1.22 +# @summary Make sure apt is removed and doesn't come back 1.23 # @author Joseph D. Darcy 1.24 1.25 OS=`uname -s`; 1.26 @@ -41,136 +40,34 @@ 1.27 ;; 1.28 esac 1.29 1.30 -# Construct path to apt executable 1.31 -APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} -XDsuppress-tool-api-removal-message " 1.32 +# Verify apt executable does not exist 1.33 +test -e "${TESTJAVA}/bin/apt" 1.34 1.35 -printf "%s\n" "-classpath ${TESTCLASSES}" > options 1.36 -printf "%s\n" "-factorypath ./nullap.jar" >> options 1.37 -printf "%s\n" "-sourcepath ${TESTSRC} " >> options 1.38 -printf "%s\n" "-nocompile" >> options 1.39 -printf "%s\n" "-XListAnnotationTypes" >> options 1.40 - 1.41 -printf "%s\n" "-classpath ${TESTCLASSES}" > options1 1.42 -printf "%s\n" "-factorypath ./nullap.jar" >> options1 1.43 -printf "%s\n" "-sourcepath ${TESTSRC} " >> options1 1.44 -printf "%s\n" "-nocompile" >> options1 1.45 -printf "%s\n" "-XListAnnotationTypes" >> options1 1.46 -printf "%s\n" "-XclassesAsDecls" >> options1 1.47 - 1.48 - 1.49 -# Construct path to javac executable 1.50 -JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . " 1.51 -JAR="${TESTJAVA}/bin/jar " 1.52 - 1.53 -$JAVAC ${TESTSRC}/NullAPF.java \ 1.54 -${TESTSRC}/FreshnessApf.java \ 1.55 -${TESTSRC}/TestGetTypeDeclarationApf.java \ 1.56 -${TESTSRC}/TestGetPackageApf.java 1.57 RESULT=$? 1.58 1.59 case "${RESULT}" in 1.60 0 ) 1.61 - ;; 1.62 + echo "apt executable should not exist." 1.63 + exit 1 1.64 + ;; 1.65 1.66 * ) 1.67 - echo "Compilation failed." 1.68 - exit 1 1.69 + ;; 1.70 esac 1.71 1.72 -echo "Making services directory and copying services information." 1.73 -mkdir -p META-INF/services 1.74 -cp ${TESTSRC}/com.sun.mirror.apt.AnnotationProcessorFactory ./META-INF/services 1.75 -$JAR cvf0 nullap.jar NullAPF*.class META-INF 1.76 1.77 -ANNOTATION_FILES="${TESTSRC}/ClassAnnotations.java \ 1.78 -${TESTSRC}/MethodAnnotations.java \ 1.79 -${TESTSRC}/NestedClassAnnotations.java \ 1.80 -${TESTSRC}/StaticFieldAnnotations.java \ 1.81 -${TESTSRC}/StaticMethodAnnotations.java \ 1.82 -${TESTSRC}/ParameterAnnotations.java" 1.83 +# Construct path to javac executable 1.84 +JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . " 1.85 1.86 -for i in ${ANNOTATION_FILES} 1.87 -do 1.88 - printf "%s\n" "Testing annotations on source file ${i}" 1.89 - ${APT} @options ${i} 2> result.txt 1.90 - diff ${DIFFOPTS} ${TESTSRC}/golden.txt result.txt 1.91 +$JAVAC ${TESTSRC}/NullAPF.java 1.92 +RESULT=$? 1.93 1.94 - RESULT=$? 1.95 - case "$RESULT" in 1.96 - 0 ) 1.97 - ;; 1.98 - 1.99 - * ) 1.100 - echo "Unexpected set of annotations on source files found." 1.101 - exit 1 1.102 - esac 1.103 - 1.104 - CLASS=`basename ${i} .java` 1.105 - printf "%s\n" "Testing annotations on class file ${CLASS}" 1.106 - ${APT} @options1 ${CLASS} 2> result2.txt 1.107 - diff ${DIFFOPTS} ${TESTSRC}/golden.txt result2.txt 1.108 - 1.109 - RESULT=$? 1.110 - case "$RESULT" in 1.111 - 0 ) 1.112 - ;; 1.113 - 1.114 - * ) 1.115 - echo "Unexpected set of annotations on class files found." 1.116 - exit 1 1.117 - esac 1.118 -done 1.119 - 1.120 -# Verify source files are favored over class files 1.121 - 1.122 -printf "%s\n" "-factorypath ." > options2 1.123 -printf "%s\n" "-factory FreshnessApf" >> options2 1.124 -printf "%s\n" "-sourcepath ${TESTSRC}" >> options2 1.125 -printf "%s\n" "-classpath ${TESTCLASSES}" >> options2 1.126 -printf "%s\n" "-nocompile" >> options2 1.127 - 1.128 -${APT} @options2 ${TESTSRC}/Indirect.java 1.129 - 1.130 -RESULT=$? 1.131 -case "$RESULT" in 1.132 +case "${RESULT}" in 1.133 0 ) 1.134 - ;; 1.135 + echo "Compilation of apt-using source passed improperly." 1.136 + exit 1 1.137 + ;; 1.138 1.139 * ) 1.140 - exit 1 1.141 + ;; 1.142 esac 1.143 - 1.144 -# Verify new classes can be loaded by getTypeDeclaration 1.145 - 1.146 -printf "%s\n" "-factorypath ." > options3 1.147 -printf "%s\n" "-factory TestGetTypeDeclarationApf" >> options3 1.148 -printf "%s\n" "-sourcepath ${TESTSRC}" >> options3 1.149 - 1.150 -# ${APT} @options3 1.151 - 1.152 -RESULT=$? 1.153 -case "$RESULT" in 1.154 - 0 ) 1.155 - ;; 1.156 - 1.157 - * ) 1.158 - exit 1 1.159 -esac 1.160 - 1.161 -# Verify packages can be loaded by getPackage 1.162 - 1.163 -printf "%s\n" "-factorypath ." > options4 1.164 -printf "%s\n" "-factory TestGetPackageApf" >> options4 1.165 -printf "%s\n" "-sourcepath ${TESTSRC}" >> options4 1.166 - 1.167 -${APT} @options4 1.168 - 1.169 -RESULT=$? 1.170 -case "$RESULT" in 1.171 - 0 ) 1.172 - ;; 1.173 - 1.174 - * ) 1.175 - exit 1 1.176 -esac 1.177 -exit 0