8006212: javac, convert jtreg tests from shell script to java

Tue, 19 Feb 2013 17:53:16 +0000

author
vromero
date
Tue, 19 Feb 2013 17:53:16 +0000
changeset 1591
dc8b7aa7cef3
parent 1590
011cf7e0a148
child 1592
9345394ac8fe

8006212: javac, convert jtreg tests from shell script to java
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/util/ArrayUtils.java file | annotate | diff | comparison | revisions
test/tools/apt/Basics/CheckAptIsRemovedTest.java file | annotate | diff | comparison | revisions
test/tools/apt/Basics/NullAPF.java file | annotate | diff | comparison | revisions
test/tools/apt/Basics/apt.sh file | annotate | diff | comparison | revisions
test/tools/apt/verifyVariables.sh file | annotate | diff | comparison | revisions
test/tools/javac/4846262/CheckEBCDICLocaleTest.java file | annotate | diff | comparison | revisions
test/tools/javac/4846262/Test.java file | annotate | diff | comparison | revisions
test/tools/javac/4846262/Test.out file | annotate | diff | comparison | revisions
test/tools/javac/4846262/Test.sh file | annotate | diff | comparison | revisions
test/tools/javac/6302184/HiddenOptionsShouldUseGivenEncodingTest.java file | annotate | diff | comparison | revisions
test/tools/javac/6302184/T6302184.sh file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/ClassPathTest.java file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/ClassPathTest.sh file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/ClassPathTest1.java file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/ClassPathTest2.java file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/ClassPathTest3.java file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/bar/pkg/ClassPathTestAux2.java file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/foo/pkg/ClassPathTestAux1.java file | annotate | diff | comparison | revisions
test/tools/javac/ClassPathTest/pkg/ClassPathTestAux3.java file | annotate | diff | comparison | revisions
test/tools/javac/ExtDirs/ExtDirTest.java file | annotate | diff | comparison | revisions
test/tools/javac/ExtDirs/ExtDirTest_1.java file | annotate | diff | comparison | revisions
test/tools/javac/ExtDirs/ExtDirTest_2.java file | annotate | diff | comparison | revisions
test/tools/javac/ExtDirs/ExtDirTest_3.java file | annotate | diff | comparison | revisions
test/tools/javac/ExtDirs/ExtDirs.sh file | annotate | diff | comparison | revisions
test/tools/javac/MissingInclude.java file | annotate | diff | comparison | revisions
test/tools/javac/MissingInclude.sh file | annotate | diff | comparison | revisions
test/tools/javac/MissingInclude/MissingIncludeTest.java file | annotate | diff | comparison | revisions
test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh file | annotate | diff | comparison | revisions
test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java file | annotate | diff | comparison | revisions
test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java file | annotate | diff | comparison | revisions
test/tools/javac/ProtectedInnerClass/p1/ProtectedInnerClass1.java file | annotate | diff | comparison | revisions
test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass2.java file | annotate | diff | comparison | revisions
test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass3.java file | annotate | diff | comparison | revisions
test/tools/javac/T5090006/AssertionFailureTest.java file | annotate | diff | comparison | revisions
test/tools/javac/T5090006/T5090006.java file | annotate | diff | comparison | revisions
test/tools/javac/T5090006/compiler.sh file | annotate | diff | comparison | revisions
test/tools/javac/constDebug/ConstDebug.java file | annotate | diff | comparison | revisions
test/tools/javac/constDebug/ConstDebug.sh file | annotate | diff | comparison | revisions
test/tools/javac/constDebug/ConstDebugTest.java file | annotate | diff | comparison | revisions
test/tools/javac/fatalErrors/NoJavaLang.java file | annotate | diff | comparison | revisions
test/tools/javac/fatalErrors/NoJavaLang.out file | annotate | diff | comparison | revisions
test/tools/javac/fatalErrors/NoJavaLang.sh file | annotate | diff | comparison | revisions
test/tools/javac/fatalErrors/NoJavaLangTest.java file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/Driver.sh file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/InnerClassFileTest.java file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/x/B.java file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/x/C.java file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/y/Main.java file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/y/R1.java file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/y/R2.java file | annotate | diff | comparison | revisions
test/tools/javac/innerClassFile/y/R3.java file | annotate | diff | comparison | revisions
test/tools/javac/javazip/A.java file | annotate | diff | comparison | revisions
test/tools/javac/javazip/JavaZipTest.java file | annotate | diff | comparison | revisions
test/tools/javac/javazip/Test.sh file | annotate | diff | comparison | revisions
test/tools/javac/javazip/bad/B.java file | annotate | diff | comparison | revisions
test/tools/javac/javazip/good/B.java file | annotate | diff | comparison | revisions
test/tools/javac/lib/ToolBox.java file | annotate | diff | comparison | revisions
test/tools/javac/links/LinksTest.java file | annotate | diff | comparison | revisions
test/tools/javac/links/T.java file | annotate | diff | comparison | revisions
test/tools/javac/links/b/B.java file | annotate | diff | comparison | revisions
test/tools/javac/links/links.sh file | annotate | diff | comparison | revisions
test/tools/javac/newlines/NewLineTest.java file | annotate | diff | comparison | revisions
test/tools/javac/newlines/Newlines.sh file | annotate | diff | comparison | revisions
test/tools/javac/stackmap/StackMapTest.java file | annotate | diff | comparison | revisions
test/tools/javac/stackmap/T4955930.java file | annotate | diff | comparison | revisions
test/tools/javac/stackmap/T4955930.sh file | annotate | diff | comparison | revisions
test/tools/javac/unicode/SupplementaryJavaID6.java file | annotate | diff | comparison | revisions
test/tools/javac/unicode/SupplementaryJavaID6.sh file | annotate | diff | comparison | revisions
test/tools/javah/6257087/T6257087.java file | annotate | diff | comparison | revisions
test/tools/javah/6257087/foo.java file | annotate | diff | comparison | revisions
test/tools/javah/6257087/foo.sh file | annotate | diff | comparison | revisions
test/tools/javah/6257087/foo_bar.h file | annotate | diff | comparison | revisions
test/tools/javah/ConstMacroTest.sh file | annotate | diff | comparison | revisions
test/tools/javah/MissingParamClassException.java file | annotate | diff | comparison | revisions
test/tools/javah/MissingParamClassTest.sh file | annotate | diff | comparison | revisions
test/tools/javah/ParamClassTest.java file | annotate | diff | comparison | revisions
test/tools/javah/SubClassConsts.java file | annotate | diff | comparison | revisions
test/tools/javah/SubClassConsts.out file | annotate | diff | comparison | revisions
test/tools/javah/SubClassConsts.win file | annotate | diff | comparison | revisions
test/tools/javah/SuperClassConsts.java file | annotate | diff | comparison | revisions
test/tools/javah/T4942232/MissingParamClassTest.java file | annotate | diff | comparison | revisions
test/tools/javah/constMacroTest/ConstMacroTest.java file | annotate | diff | comparison | revisions
test/tools/javap/4798312/JavapShouldLoadClassesFromRTJarTest.java file | annotate | diff | comparison | revisions
test/tools/javap/4866831/PublicInterfaceTest.java file | annotate | diff | comparison | revisions
test/tools/javap/NotPackagePrivateInterface.java file | annotate | diff | comparison | revisions
test/tools/javap/PublicInterfaceTest.sh file | annotate | diff | comparison | revisions
test/tools/javap/pathsep.sh file | annotate | diff | comparison | revisions
test/tools/javap/stackmap/StackmapTest.java file | annotate | diff | comparison | revisions
test/tools/javap/stackmap/T6271292.java file | annotate | diff | comparison | revisions
test/tools/javap/stackmap/T6271292.out file | annotate | diff | comparison | revisions
test/tools/javap/stackmap/T6271292.sh file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Tue Feb 19 00:31:45 2013 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java	Tue Feb 19 17:53:16 2013 +0000
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -121,19 +121,23 @@
    1.11          return result.toList();
    1.12      }
    1.13  
    1.14 -    public Boolean call() {
    1.15 +    public Main.Result doCall() {
    1.16          if (!used.getAndSet(true)) {
    1.17              initContext();
    1.18              notYetEntered = new HashMap<JavaFileObject, JCCompilationUnit>();
    1.19              compilerMain.setAPIMode(true);
    1.20              result = compilerMain.compile(args, classNames, context, fileObjects, processors);
    1.21              cleanup();
    1.22 -            return result.isOK();
    1.23 +            return result;
    1.24          } else {
    1.25              throw new IllegalStateException("multiple calls to method 'call'");
    1.26          }
    1.27      }
    1.28  
    1.29 +    public Boolean call() {
    1.30 +        return doCall().isOK();
    1.31 +    }
    1.32 +
    1.33      public void setProcessors(Iterable<? extends Processor> processors) {
    1.34          processors.getClass(); // null check
    1.35          // not mt-safe
     2.1 --- a/src/share/classes/com/sun/tools/javac/util/ArrayUtils.java	Tue Feb 19 00:31:45 2013 -0800
     2.2 +++ b/src/share/classes/com/sun/tools/javac/util/ArrayUtils.java	Tue Feb 19 17:53:16 2013 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -84,4 +84,18 @@
    2.11              return result;
    2.12          }
    2.13      }
    2.14 +
    2.15 +    public static <T> T[] concat(T[] anArr, T[] anotherArr) {
    2.16 +        int newLength = anArr.length + anotherArr.length;
    2.17 +        @SuppressWarnings("unchecked")
    2.18 +        T[] result = (T[]) Array.newInstance(anArr.getClass().getComponentType(), newLength);
    2.19 +        System.arraycopy(anArr, 0, result, 0, anArr.length);
    2.20 +        System.arraycopy(anotherArr, 0, result, anArr.length, anotherArr.length);
    2.21 +        return result;
    2.22 +    }
    2.23 +
    2.24 +    @SuppressWarnings("unchecked")
    2.25 +    public static <T> T[] concatOpen(T[] anArr, T... anotherArr) {
    2.26 +        return concat(anArr, anotherArr);
    2.27 +    }
    2.28  }
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/tools/apt/Basics/CheckAptIsRemovedTest.java	Tue Feb 19 17:53:16 2013 +0000
     3.3 @@ -0,0 +1,96 @@
     3.4 +/*
     3.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + *
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + *
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + *
    3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    3.23 + * or visit www.oracle.com if you need additional information or have any
    3.24 + * questions.
    3.25 + */
    3.26 +
    3.27 +/*
    3.28 + * @test
    3.29 + * @bug 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249
    3.30 + * @summary Make sure apt is removed and doesn't come back
    3.31 + * @library /tools/javac/lib
    3.32 + * @build ToolBox
    3.33 + * @run main CheckAptIsRemovedTest
    3.34 + */
    3.35 +
    3.36 +import java.nio.file.Files;
    3.37 +import java.nio.file.Path;
    3.38 +import java.nio.file.Paths;
    3.39 +
    3.40 +//original test: test/tools/apt/Basics/apt.sh
    3.41 +public class CheckAptIsRemovedTest {
    3.42 +    //I think this class can be let with the imports only and that should be enough for as test's purpose
    3.43 +    private static final String NullAPFSrc =
    3.44 +        "import com.sun.mirror.apt.*;\n" +
    3.45 +        "import com.sun.mirror.declaration.*;\n" +
    3.46 +        "import com.sun.mirror.type.*;\n" +
    3.47 +        "import com.sun.mirror.util.*;\n" +
    3.48 +        "import java.util.Collection;\n" +
    3.49 +        "import java.util.Set;\n\n" +
    3.50 +
    3.51 +        "public class NullAPF implements AnnotationProcessorFactory {\n" +
    3.52 +        "    static class NullAP implements AnnotationProcessor {\n" +
    3.53 +        "        NullAP(AnnotationProcessorEnvironment ape) {}\n" +
    3.54 +        "        public void process() {return;}\n" +
    3.55 +        "    }\n\n" +
    3.56 +
    3.57 +        "    static Collection<String> supportedTypes;\n\n" +
    3.58 +        "    static {\n" +
    3.59 +        "        String types[] = {\"*\"};\n" +
    3.60 +        "        supportedTypes = java.util.Arrays.asList(types);\n" +
    3.61 +        "    }\n\n" +
    3.62 +
    3.63 +        "    public Collection<String> supportedOptions() {\n" +
    3.64 +        "        return java.util.Collections.emptySet();\n" +
    3.65 +        "    }\n\n" +
    3.66 +
    3.67 +        "    public Collection<String> supportedAnnotationTypes() {\n" +
    3.68 +        "        return supportedTypes;\n" +
    3.69 +        "    }\n\n" +
    3.70 +
    3.71 +        "    public AnnotationProcessor getProcessorFor(" +
    3.72 +        "        Set<AnnotationTypeDeclaration> atds,\n" +
    3.73 +        "        AnnotationProcessorEnvironment env) {\n" +
    3.74 +        "        return new NullAP(env);\n" +
    3.75 +        "    }\n" +
    3.76 +        "}";
    3.77 +
    3.78 +    public static void main(String[] args) throws Exception {
    3.79 +        String testJDK = System.getProperty("test.jdk");
    3.80 +        Path aptLin = Paths.get(testJDK, "bin", "apt");
    3.81 +        Path aptWin = Paths.get(testJDK, "bin", "apt.exe");
    3.82 +
    3.83 +//        if [ -f "${TESTJAVA}/bin/apt" -o -f "${TESTJAVA}/bin/apt.exe" ];then
    3.84 +        if (Files.exists(aptLin) || Files.exists(aptWin)) {
    3.85 +            throw new AssertionError("apt executable should not exist");
    3.86 +        }
    3.87 +
    3.88 +//        JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
    3.89 +//        $JAVAC ${TESTSRC}/NullAPF.java
    3.90 +        Path classpath = Paths.get(testJDK, "lib", "tools.jar");
    3.91 +        ToolBox.JavaToolArgs javacArgs =
    3.92 +                new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
    3.93 +                .setOptions("-source", "1.5", "-sourcepath", ".",
    3.94 +                    "-classpath", classpath.toString())
    3.95 +                .setSources(NullAPFSrc);
    3.96 +        ToolBox.javac(javacArgs);
    3.97 +    }
    3.98 +
    3.99 +}
     4.1 --- a/test/tools/apt/Basics/NullAPF.java	Tue Feb 19 00:31:45 2013 -0800
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,72 +0,0 @@
     4.4 -/*
     4.5 - * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved.
     4.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.7 - *
     4.8 - * This code is free software; you can redistribute it and/or modify it
     4.9 - * under the terms of the GNU General Public License version 2 only, as
    4.10 - * published by the Free Software Foundation.
    4.11 - *
    4.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    4.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    4.15 - * version 2 for more details (a copy is included in the LICENSE file that
    4.16 - * accompanied this code).
    4.17 - *
    4.18 - * You should have received a copy of the GNU General Public License version
    4.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    4.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    4.21 - *
    4.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    4.23 - * or visit www.oracle.com if you need additional information or have any
    4.24 - * questions.
    4.25 - */
    4.26 -
    4.27 -
    4.28 -import com.sun.mirror.apt.*;
    4.29 -import com.sun.mirror.declaration.*;
    4.30 -import com.sun.mirror.type.*;
    4.31 -import com.sun.mirror.util.*;
    4.32 -
    4.33 -import java.util.Collection;
    4.34 -import java.util.Set;
    4.35 -
    4.36 -public class NullAPF implements AnnotationProcessorFactory {
    4.37 -    static class NullAP implements AnnotationProcessor {
    4.38 -        NullAP(AnnotationProcessorEnvironment ape) {
    4.39 -        }
    4.40 -
    4.41 -        public void process() {
    4.42 -            return;
    4.43 -        }
    4.44 -    }
    4.45 -
    4.46 -    static Collection<String> supportedTypes;
    4.47 -
    4.48 -    static {
    4.49 -        String types[] = {"*"};
    4.50 -        supportedTypes = java.util.Arrays.asList(types);
    4.51 -    }
    4.52 -
    4.53 -    /*
    4.54 -     * Processor doesn't examine any options.
    4.55 -     */
    4.56 -    public Collection<String> supportedOptions() {
    4.57 -        return java.util.Collections.emptySet();
    4.58 -    }
    4.59 -
    4.60 -    /*
    4.61 -     * All annotation types are supported.
    4.62 -     */
    4.63 -    public Collection<String> supportedAnnotationTypes() {
    4.64 -        return supportedTypes;
    4.65 -    }
    4.66 -
    4.67 -    /*
    4.68 -     * Return the same processor independent of what annotations are
    4.69 -     * present, if any.
    4.70 -     */
    4.71 -    public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds,
    4.72 -                                        AnnotationProcessorEnvironment env) {
    4.73 -        return new NullAP(env);
    4.74 -    }
    4.75 -}
     5.1 --- a/test/tools/apt/Basics/apt.sh	Tue Feb 19 00:31:45 2013 -0800
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,63 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -
     5.6 -#
     5.7 -# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
     5.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.9 -#
    5.10 -# This code is free software; you can redistribute it and/or modify it
    5.11 -# under the terms of the GNU General Public License version 2 only, as
    5.12 -# published by the Free Software Foundation.
    5.13 -#
    5.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
    5.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.17 -# version 2 for more details (a copy is included in the LICENSE file that
    5.18 -# accompanied this code).
    5.19 -#
    5.20 -# You should have received a copy of the GNU General Public License version
    5.21 -# 2 along with this work; if not, write to the Free Software Foundation,
    5.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.23 -#
    5.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.25 -# or visit www.oracle.com if you need additional information or have any
    5.26 -# questions.
    5.27 -#
    5.28 -
    5.29 -# @test
    5.30 -# @bug 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249
    5.31 -# @run shell ../verifyVariables.sh
    5.32 -# @run shell apt.sh
    5.33 -# @summary Make sure apt is removed and doesn't come back
    5.34 -# @author Joseph D. Darcy
    5.35 -
    5.36 -OS=`uname -s`;
    5.37 -case "${OS}" in
    5.38 -        CYGWIN* )
    5.39 -                DIFFOPTS="--strip-trailing-cr"
    5.40 -        ;;
    5.41 -
    5.42 -	* )
    5.43 -	;;
    5.44 -esac
    5.45 -
    5.46 -# Verify apt executable does not exist
    5.47 -if [ -f "${TESTJAVA}/bin/apt" -o -f "${TESTJAVA}/bin/apt.exe" ];then
    5.48 -    echo "apt executable should not exist."
    5.49 -    exit 1
    5.50 -fi
    5.51 -
    5.52 -# Construct path to javac executable
    5.53 -JAVAC="${TESTJAVA}/bin/javac ${TESTTOOLVMOPTS} -source 1.5 -sourcepath ${TESTSRC} -classpath ${TESTJAVA}/lib/tools.jar -d . "
    5.54 -
    5.55 -$JAVAC ${TESTSRC}/NullAPF.java
    5.56 -RESULT=$?
    5.57 -
    5.58 -case "${RESULT}" in
    5.59 -        0  )
    5.60 -        echo "Compilation of apt-using source passed improperly."
    5.61 -        exit 1
    5.62 -	;;
    5.63 -
    5.64 -        * )
    5.65 -	;;
    5.66 -esac
     6.1 --- a/test/tools/apt/verifyVariables.sh	Tue Feb 19 00:31:45 2013 -0800
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,45 +0,0 @@
     6.4 -#!/bin/sh
     6.5 -
     6.6 -#
     6.7 -# Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
     6.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.9 -#
    6.10 -# This code is free software; you can redistribute it and/or modify it
    6.11 -# under the terms of the GNU General Public License version 2 only, as
    6.12 -# published by the Free Software Foundation.
    6.13 -#
    6.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
    6.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.17 -# version 2 for more details (a copy is included in the LICENSE file that
    6.18 -# accompanied this code).
    6.19 -#
    6.20 -# You should have received a copy of the GNU General Public License version
    6.21 -# 2 along with this work; if not, write to the Free Software Foundation,
    6.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.23 -#
    6.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.25 -# or visit www.oracle.com if you need additional information or have any
    6.26 -# questions.
    6.27 -#
    6.28 -
    6.29 -if [ "${TESTJAVA}" = "" ]
    6.30 -then
    6.31 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
    6.32 -  exit 1
    6.33 -fi
    6.34 -
    6.35 -if [ "${TESTSRC}" = "" ]
    6.36 -then
    6.37 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
    6.38 -  exit 1
    6.39 -fi
    6.40 -
    6.41 -
    6.42 -if [ "${TESTCLASSES}" = "" ]
    6.43 -then
    6.44 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
    6.45 -  exit 1
    6.46 -fi
    6.47 -
    6.48 -exit 0
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/tools/javac/4846262/CheckEBCDICLocaleTest.java	Tue Feb 19 17:53:16 2013 +0000
     7.3 @@ -0,0 +1,99 @@
     7.4 +/*
     7.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 + *
     7.8 + * This code is free software; you can redistribute it and/or modify it
     7.9 + * under the terms of the GNU General Public License version 2 only, as
    7.10 + * published by the Free Software Foundation.
    7.11 + *
    7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 + * version 2 for more details (a copy is included in the LICENSE file that
    7.16 + * accompanied this code).
    7.17 + *
    7.18 + * You should have received a copy of the GNU General Public License version
    7.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 + *
    7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 + * or visit www.oracle.com if you need additional information or have any
    7.24 + * questions.
    7.25 + */
    7.26 +
    7.27 +/*
    7.28 + * @test
    7.29 + * @bug 4846262
    7.30 + * @summary check that javac operates correctly in EBCDIC locale
    7.31 + * @library /tools/javac/lib
    7.32 + * @build ToolBox
    7.33 + * @run main CheckEBCDICLocaleTest
    7.34 + */
    7.35 +
    7.36 +import java.io.File;
    7.37 +import java.nio.file.Files;
    7.38 +import java.nio.file.Paths;
    7.39 +import java.util.Arrays;
    7.40 +import com.sun.tools.javac.util.ArrayUtils;
    7.41 +
    7.42 +//original test: test/tools/javac/4846262/Test.sh
    7.43 +public class CheckEBCDICLocaleTest {
    7.44 +
    7.45 +    private static final String TestSrc =
    7.46 +        "public class Test {\n" +
    7.47 +        "    public void test() {\n" +
    7.48 +        "        abcdefg\n" +
    7.49 +        "    }\n" +
    7.50 +        "}";
    7.51 +
    7.52 +    private static final String TestOut =
    7.53 +        "output/Test.java:3: error: not a statement\n" +
    7.54 +        "        abcdefg\n" +
    7.55 +        "        ^\n" +
    7.56 +        "output/Test.java:3: error: ';' expected\n" +
    7.57 +        "        abcdefg\n" +
    7.58 +        "               ^\n" +
    7.59 +        "2 errors\n";
    7.60 +
    7.61 +    public static void main(String[] args) throws Exception {
    7.62 +        new CheckEBCDICLocaleTest().test();
    7.63 +    }
    7.64 +
    7.65 +    public void test() throws Exception {
    7.66 +        String native2asciiBinary = Paths.get(
    7.67 +                System.getProperty("test.jdk"),"bin", "native2ascii").toString();
    7.68 +        String testVMOpts = System.getProperty("test.tool.vm.opts");
    7.69 +        String[] mainArgs = ToolBox.getJavacBin();
    7.70 +
    7.71 +        ToolBox.createJavaFileFromSource(TestSrc);
    7.72 +        Files.createDirectory(Paths.get("output"));
    7.73 +
    7.74 +//"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -reverse -encoding IBM1047 ${TESTSRC}${FS}Test.java Test.java
    7.75 +        ToolBox.AnyToolArgs nativeCmdParams =
    7.76 +                new ToolBox.AnyToolArgs()
    7.77 +                .setAllArgs(native2asciiBinary, testVMOpts,
    7.78 +                    "-reverse", "-encoding", "IBM1047",
    7.79 +                    "Test.java", "output/Test.java");
    7.80 +        ToolBox.executeCommand(nativeCmdParams);
    7.81 +
    7.82 +//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Duser.language=en -J-Duser.region=US -J-Dfile.encoding=IBM1047 Test.java 2>Test.tmp
    7.83 +        ToolBox.AnyToolArgs javacParams =
    7.84 +                new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
    7.85 +                .setAllArgs(ArrayUtils.concatOpen(mainArgs, "-J-Duser.language=en",
    7.86 +                "-J-Duser.region=US", "-J-Dfile.encoding=IBM1047",
    7.87 +                "output/Test.java"))
    7.88 +                .setErrOutput(new File("Test.tmp"));
    7.89 +        ToolBox.executeCommand(javacParams);
    7.90 +
    7.91 +//"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -encoding IBM1047 Test.tmp Test.out
    7.92 +        nativeCmdParams.setAllArgs(native2asciiBinary, "-encoding", "IBM1047",
    7.93 +                    "Test.tmp", "Test.out");
    7.94 +        ToolBox.executeCommand(nativeCmdParams);
    7.95 +
    7.96 +//diff ${DIFFOPTS} -c "${TESTSRC}${FS}Test.out" Test.out
    7.97 +        ToolBox.compareLines(Paths.get("Test.out"),
    7.98 +                Arrays.asList(TestOut.split("\n")), null);
    7.99 +
   7.100 +    }
   7.101 +
   7.102 +}
     8.1 --- a/test/tools/javac/4846262/Test.java	Tue Feb 19 00:31:45 2013 -0800
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,6 +0,0 @@
     8.4 -/* /nodynamiccopyright/ */
     8.5 -public class Test {
     8.6 -    public void test() {
     8.7 -        abcdefg
     8.8 -    }
     8.9 -}
     9.1 --- a/test/tools/javac/4846262/Test.out	Tue Feb 19 00:31:45 2013 -0800
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,7 +0,0 @@
     9.4 -Test.java:4: error: not a statement
     9.5 -        abcdefg
     9.6 -        ^
     9.7 -Test.java:4: error: ';' expected
     9.8 -        abcdefg
     9.9 -               ^
    9.10 -2 errors
    10.1 --- a/test/tools/javac/4846262/Test.sh	Tue Feb 19 00:31:45 2013 -0800
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,80 +0,0 @@
    10.4 -#!/bin/sh -f
    10.5 -
    10.6 -#
    10.7 -# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    10.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.9 -#
   10.10 -# This code is free software; you can redistribute it and/or modify it
   10.11 -# under the terms of the GNU General Public License version 2 only, as
   10.12 -# published by the Free Software Foundation.
   10.13 -#
   10.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   10.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   10.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   10.17 -# version 2 for more details (a copy is included in the LICENSE file that
   10.18 -# accompanied this code).
   10.19 -#
   10.20 -# You should have received a copy of the GNU General Public License version
   10.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   10.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   10.23 -#
   10.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   10.25 -# or visit www.oracle.com if you need additional information or have any
   10.26 -# questions.
   10.27 -#
   10.28 -
   10.29 -#
   10.30 -# @test
   10.31 -# @bug 4846262
   10.32 -# @summary check that javac operates correctly in EBCDIC locale
   10.33 -
   10.34 -
   10.35 -if [ "${TESTSRC}" = "" ]
   10.36 -then
   10.37 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   10.38 -  exit 1
   10.39 -fi
   10.40 -echo "TESTSRC=${TESTSRC}"
   10.41 -if [ "${TESTJAVA}" = "" ]
   10.42 -then
   10.43 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   10.44 -  exit 1
   10.45 -fi
   10.46 -
   10.47 -# set platform-dependent variables
   10.48 -OS=`uname -s`
   10.49 -case "$OS" in
   10.50 -  SunOS | Linux | Darwin )
   10.51 -    FS="/"
   10.52 -    ;;
   10.53 -  CYGWIN* )
   10.54 -    FS="/"
   10.55 -    DIFFOPTS="--strip-trailing-cr"
   10.56 -    ;;
   10.57 -  Windows* )
   10.58 -    FS="\\"
   10.59 -    ;;
   10.60 -  * )
   10.61 -    echo "Unrecognized system!"
   10.62 -    exit 1;
   10.63 -    ;;
   10.64 -esac
   10.65 -
   10.66 -rm -f Test.java Test.out
   10.67 -
   10.68 -"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -reverse -encoding IBM1047 ${TESTSRC}${FS}Test.java Test.java
   10.69 -
   10.70 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Duser.language=en -J-Duser.region=US -J-Dfile.encoding=IBM1047 Test.java 2>Test.tmp
   10.71 -
   10.72 -"${TESTJAVA}${FS}bin${FS}native2ascii" ${TESTTOOLVMOPTS} -encoding IBM1047 Test.tmp Test.out
   10.73 -
   10.74 -diff ${DIFFOPTS} -c "${TESTSRC}${FS}Test.out" Test.out
   10.75 -result=$?
   10.76 -
   10.77 -if [ $result -eq 0 ]
   10.78 -then
   10.79 -  echo "Passed"
   10.80 -else
   10.81 -  echo "Failed"
   10.82 -fi
   10.83 -exit $result
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/test/tools/javac/6302184/HiddenOptionsShouldUseGivenEncodingTest.java	Tue Feb 19 17:53:16 2013 +0000
    11.3 @@ -0,0 +1,49 @@
    11.4 +/*
    11.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.
   11.11 + *
   11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.15 + * version 2 for more details (a copy is included in the LICENSE file that
   11.16 + * accompanied this code).
   11.17 + *
   11.18 + * You should have received a copy of the GNU General Public License version
   11.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.21 + *
   11.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   11.23 + * or visit www.oracle.com if you need additional information or have any
   11.24 + * questions.
   11.25 + */
   11.26 +
   11.27 +/*
   11.28 + * @test
   11.29 + * @bug 6302184 6350124 6357979
   11.30 + * @summary javac hidden options that generate source should use the given
   11.31 + * encoding, if available
   11.32 + * @library /tools/javac/lib
   11.33 + * @build ToolBox
   11.34 + * @run compile -encoding iso-8859-1 -XD-printsource T6302184.java
   11.35 + * @run main HiddenOptionsShouldUseGivenEncodingTest
   11.36 + */
   11.37 +
   11.38 +import java.nio.file.Path;
   11.39 +import java.nio.file.Paths;
   11.40 +
   11.41 +//original test: test/tools/javac/6302184/T6302184.sh
   11.42 +public class HiddenOptionsShouldUseGivenEncodingTest {
   11.43 +
   11.44 +    public static void main(String[] args) throws Exception {
   11.45 +//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -cp ${TC} -encoding iso-8859-1 -XD-printsource ${TS}${FS}T6302184.java 2>&1
   11.46 +//diff ${DIFFOPTS} -c ${TC}${FS}T6302184.java ${TS}${FS}T6302184.out
   11.47 +        Path path1 = Paths.get(System.getProperty("test.classes"), "T6302184.java");
   11.48 +        Path path2 = Paths.get(System.getProperty("test.src"), "T6302184.out");
   11.49 +        ToolBox.compareLines(path1, path2, "iso-8859-1");
   11.50 +    }
   11.51 +
   11.52 +}
    12.1 --- a/test/tools/javac/6302184/T6302184.sh	Tue Feb 19 00:31:45 2013 -0800
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,71 +0,0 @@
    12.4 -#! /bin/sh -f
    12.5 -
    12.6 -#
    12.7 -# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
    12.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.9 -#
   12.10 -# This code is free software; you can redistribute it and/or modify it
   12.11 -# under the terms of the GNU General Public License version 2 only, as
   12.12 -# published by the Free Software Foundation.
   12.13 -#
   12.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   12.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.17 -# version 2 for more details (a copy is included in the LICENSE file that
   12.18 -# accompanied this code).
   12.19 -#
   12.20 -# You should have received a copy of the GNU General Public License version
   12.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   12.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.23 -#
   12.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.25 -# or visit www.oracle.com if you need additional information or have any
   12.26 -# questions.
   12.27 -#
   12.28 -
   12.29 -#
   12.30 -# @test
   12.31 -# @bug 6302184 6350124 6357979
   12.32 -# @summary javac hidden options that generate source should use the given encoding, if available
   12.33 -# @run shell T6302184.sh
   12.34 -
   12.35 -TS=${TESTSRC-.}
   12.36 -TC=${TESTCLASSES-.}
   12.37 -
   12.38 -if [ "${TESTJAVA}" = "" ]
   12.39 -then
   12.40 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   12.41 -  exit 1
   12.42 -fi
   12.43 -
   12.44 -# set platform-dependent variables
   12.45 -OS=`uname -s`
   12.46 -case "$OS" in
   12.47 -  SunOS | Linux | Darwin )
   12.48 -    FS="/"
   12.49 -    ;;
   12.50 -  CYGWIN* )
   12.51 -    FS="/"
   12.52 -    DIFFOPTS="--strip-trailing-cr"
   12.53 -    ;;
   12.54 -  Windows* )
   12.55 -    FS="\\"
   12.56 -    ;;
   12.57 -  * )
   12.58 -    echo "Unrecognized system!"
   12.59 -    exit 1;
   12.60 -    ;;
   12.61 -esac
   12.62 -
   12.63 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -cp ${TC} -encoding iso-8859-1 -XD-printsource ${TS}${FS}T6302184.java 2>&1
   12.64 -diff ${DIFFOPTS} -c ${TC}${FS}T6302184.java ${TS}${FS}T6302184.out
   12.65 -result=$?
   12.66 -
   12.67 -
   12.68 -if [ $result -eq 0 ]
   12.69 -then
   12.70 -  echo "Passed"
   12.71 -else
   12.72 -  echo "Failed"
   12.73 -fi
   12.74 -exit $result
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/tools/javac/ClassPathTest/ClassPathTest.java	Tue Feb 19 17:53:16 2013 +0000
    13.3 @@ -0,0 +1,148 @@
    13.4 +/*
    13.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 + *
    13.8 + * This code is free software; you can redistribute it and/or modify it
    13.9 + * under the terms of the GNU General Public License version 2 only, as
   13.10 + * published by the Free Software Foundation.
   13.11 + *
   13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.15 + * version 2 for more details (a copy is included in the LICENSE file that
   13.16 + * accompanied this code).
   13.17 + *
   13.18 + * You should have received a copy of the GNU General Public License version
   13.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.21 + *
   13.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   13.23 + * or visit www.oracle.com if you need additional information or have any
   13.24 + * questions.
   13.25 + */
   13.26 +
   13.27 +/*
   13.28 + * @test
   13.29 + * @bug 4241229 4785453
   13.30 + * @summary Test -classpath option and classpath defaults.
   13.31 + * @library /tools/javac/lib
   13.32 + * @build ToolBox
   13.33 + * @run main ClassPathTest
   13.34 + */
   13.35 +
   13.36 +import java.nio.file.Paths;
   13.37 +import java.util.Map;
   13.38 +import java.util.TreeMap;
   13.39 +import com.sun.tools.javac.util.ArrayUtils;
   13.40 +
   13.41 +//original test: test/tools/javac/ClassPathTest/ClassPathTest.sh
   13.42 +public class ClassPathTest {
   13.43 +
   13.44 +    private static final String ClassPathTest1Src =
   13.45 +        "import pkg.*;\n" +
   13.46 +        "public class ClassPathTest1 {\n" +
   13.47 +        "    ClassPathTestAux1 x;\n" +
   13.48 +        "}";
   13.49 +
   13.50 +    private static final String ClassPathTest2Src =
   13.51 +        "import pkg.*;\n" +
   13.52 +        "public class ClassPathTest2 {\n" +
   13.53 +        "    ClassPathTestAux2 x;\n" +
   13.54 +        "}";
   13.55 +
   13.56 +    private static final String ClassPathTest3Src =
   13.57 +        "import pkg.*;\n" +
   13.58 +        "public class ClassPathTest3 {\n" +
   13.59 +        "    ClassPathTestAux3 x;\n" +
   13.60 +        "}";
   13.61 +
   13.62 +    private static final String fooPkgClassPathTestAux1Src =
   13.63 +        "package pkg;\n" +
   13.64 +        "public class ClassPathTestAux1 {}";
   13.65 +
   13.66 +    private static final String barPkgClassPathTestAux2Src =
   13.67 +        "package pkg;\n" +
   13.68 +        "public class ClassPathTestAux2 {}";
   13.69 +
   13.70 +    private static final String pkgClassPathTestAux3Src =
   13.71 +        "package pkg;\n" +
   13.72 +        "public class ClassPathTestAux3 {}";
   13.73 +
   13.74 +    ProcessBuilder pb = null;
   13.75 +
   13.76 +    public static void main(String[] args) throws Exception {
   13.77 +        new ClassPathTest().test();
   13.78 +    }
   13.79 +
   13.80 +    public void test() throws Exception {
   13.81 +        createOutputDirAndSourceFiles();
   13.82 +        checkCompileCommands();
   13.83 +    }
   13.84 +
   13.85 +    void createOutputDirAndSourceFiles() throws Exception {
   13.86 +        //dirs and files creation
   13.87 +        ToolBox.createJavaFileFromSource(ClassPathTest1Src);
   13.88 +        ToolBox.createJavaFileFromSource(ClassPathTest2Src);
   13.89 +        ToolBox.createJavaFileFromSource(ClassPathTest3Src);
   13.90 +        ToolBox.createJavaFileFromSource(Paths.get("foo"),
   13.91 +                fooPkgClassPathTestAux1Src);
   13.92 +        ToolBox.createJavaFileFromSource(Paths.get("bar"),
   13.93 +                barPkgClassPathTestAux2Src);
   13.94 +        ToolBox.createJavaFileFromSource(pkgClassPathTestAux3Src);
   13.95 +    }
   13.96 +
   13.97 +    void checkCompileCommands() throws Exception {
   13.98 +        String[] mainArgs = ToolBox.getJavacBin();
   13.99 +
  13.100 +//        Without the -cp . parameter the command will fail seems like when called
  13.101 +//        from the command line, the current dir is added to the classpath
  13.102 +//        automatically but this is not happening when called using ProcessBuilder
  13.103 +
  13.104 +//        testJavac success ClassPathTest3.java
  13.105 +        String[] commonArgs = ArrayUtils.concatOpen(mainArgs, "-cp", ".");
  13.106 +
  13.107 +        ToolBox.AnyToolArgs successParams =
  13.108 +                new ToolBox.AnyToolArgs()
  13.109 +                .setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest3.java"));
  13.110 +        ToolBox.executeCommand(successParams);
  13.111 +
  13.112 +//        testJavac failure ClassPathTest1.java
  13.113 +        ToolBox.AnyToolArgs failParams =
  13.114 +                new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
  13.115 +                .setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest1.java"));
  13.116 +        ToolBox.executeCommand(failParams);
  13.117 +
  13.118 +//        This is done inside the executeCommand method
  13.119 +//        CLASSPATH=bar; export CLASSPATH
  13.120 +
  13.121 +        Map<String, String> extVars = new TreeMap<>();
  13.122 +        extVars.put("CLASSPATH", "bar");
  13.123 +
  13.124 +//        testJavac success ClassPathTest2.java
  13.125 +        successParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest2.java")).set(extVars);
  13.126 +        ToolBox.executeCommand(successParams);
  13.127 +
  13.128 +//        testJavac failure ClassPathTest1.java
  13.129 +        failParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest1.java")).set(extVars);
  13.130 +        ToolBox.executeCommand(failParams);
  13.131 +
  13.132 +//        testJavac failure ClassPathTest3.java
  13.133 +        failParams.setAllArgs(ArrayUtils.concatOpen(mainArgs, "ClassPathTest3.java"));
  13.134 +        ToolBox.executeCommand(failParams);
  13.135 +
  13.136 +//        testJavac success -classpath foo ClassPathTest1.java
  13.137 +
  13.138 +        commonArgs = ArrayUtils.concatOpen(mainArgs, "-cp", "foo");
  13.139 +        successParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest1.java"));
  13.140 +        ToolBox.executeCommand(successParams);
  13.141 +
  13.142 +//        testJavac failure -classpath foo ClassPathTest2.java
  13.143 +        failParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest2.java"));
  13.144 +        ToolBox.executeCommand(failParams);
  13.145 +
  13.146 +//        testJavac failure -classpath foo ClassPathTest3.java
  13.147 +        failParams.setAllArgs(ArrayUtils.concatOpen(commonArgs, "ClassPathTest3.java"));
  13.148 +        ToolBox.executeCommand(failParams);
  13.149 +    }
  13.150 +
  13.151 +}
    14.1 --- a/test/tools/javac/ClassPathTest/ClassPathTest.sh	Tue Feb 19 00:31:45 2013 -0800
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,134 +0,0 @@
    14.4 -#!/bin/sh
    14.5 -
    14.6 -#
    14.7 -# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    14.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.9 -#
   14.10 -# This code is free software; you can redistribute it and/or modify it
   14.11 -# under the terms of the GNU General Public License version 2 only, as
   14.12 -# published by the Free Software Foundation.
   14.13 -#
   14.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   14.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14.17 -# version 2 for more details (a copy is included in the LICENSE file that
   14.18 -# accompanied this code).
   14.19 -#
   14.20 -# You should have received a copy of the GNU General Public License version
   14.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   14.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   14.23 -#
   14.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   14.25 -# or visit www.oracle.com if you need additional information or have any
   14.26 -# questions.
   14.27 -#
   14.28 -
   14.29 -
   14.30 -# @test
   14.31 -# @bug 4241229 4785453
   14.32 -# @summary Test -classpath option and classpath defaults.
   14.33 -# @author maddox
   14.34 -#
   14.35 -# @run shell/timeout=180 ClassPathTest.sh
   14.36 -
   14.37 -# TODO: Should test sourcepath and classpath separately.
   14.38 -
   14.39 -if [ "${TESTSRC}" = "" ]
   14.40 -then
   14.41 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   14.42 -  exit 1
   14.43 -fi
   14.44 -echo "TESTSRC=${TESTSRC}"
   14.45 -if [ "${TESTJAVA}" = "" ]
   14.46 -then
   14.47 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   14.48 -  exit 1
   14.49 -fi
   14.50 -echo "TESTJAVA=${TESTJAVA}"
   14.51 -if [ "${TESTCLASSES}" = "" ]
   14.52 -then
   14.53 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   14.54 -  exit 1
   14.55 -fi
   14.56 -echo "TESTCLASSES=${TESTCLASSES}"
   14.57 -echo "CLASSPATH=${CLASSPATH}"
   14.58 -
   14.59 -# set platform-dependent variables
   14.60 -OS=`uname -s`
   14.61 -case "$OS" in
   14.62 -  SunOS | Linux | Darwin | CYGWIN* )
   14.63 -    FS="/"
   14.64 -    ;;
   14.65 -  Windows* )
   14.66 -    FS="\\"
   14.67 -    ;;
   14.68 -  * )
   14.69 -    echo "Unrecognized system!"
   14.70 -    exit 1;
   14.71 -    ;;
   14.72 -esac
   14.73 -
   14.74 -javac="${TESTJAVA}${FS}bin${FS}javac"
   14.75 -
   14.76 -cleanup() {
   14.77 -	rm -f *.class pkg${FS}*.class foo${FS}pkg${FS}*.class bar${FS}pkg${FS}*.class
   14.78 -	cp -rf $TESTSRC${FS}* .
   14.79 -}
   14.80 -
   14.81 -fail() {
   14.82 -	echo "FAIL: $1"
   14.83 -	failed="yes"
   14.84 -}
   14.85 -
   14.86 -# report expectedResult $?
   14.87 -report() {
   14.88 -	if   test "$1" = "success" -a "$2" = 0; then
   14.89 -		echo "PASS: succeeded as expected"
   14.90 -	elif test "$1" = "failure" -a "$2" != 0; then
   14.91 -		echo "PASS: failed as expected"
   14.92 -	elif test "$1" = "success" -a "$2" != 0; then
   14.93 -		fail "test failed unexpectedly"
   14.94 -	elif test "$1" = "failure" -a "$2" = 0; then
   14.95 -		fail "test succeeded unexpectedly"
   14.96 -	else
   14.97 -		fail "internal error"
   14.98 -	fi
   14.99 -}
  14.100 -
  14.101 -# testJavac expectedResult javacArgs...
  14.102 -testJavac() {
  14.103 -	expectedResult="$1"; shift
  14.104 -	cleanup
  14.105 -	echo $javac ${TESTTOOLVMOPTS} "$@"
  14.106 -	"$javac" ${TESTTOOLVMOPTS} "$@"
  14.107 -	report $expectedResult $?
  14.108 -}
  14.109 -
  14.110 -unset CLASSPATH
  14.111 -
  14.112 -# classpath should default to current directory
  14.113 -
  14.114 -testJavac success ClassPathTest3.java
  14.115 -testJavac failure ClassPathTest1.java
  14.116 -
  14.117 -# if CLASSPATH is set, it should be honored
  14.118 -
  14.119 -CLASSPATH=bar; export CLASSPATH
  14.120 -
  14.121 -testJavac success ClassPathTest2.java
  14.122 -testJavac failure ClassPathTest1.java
  14.123 -testJavac failure ClassPathTest3.java
  14.124 -
  14.125 -# -classpath option should override default
  14.126 -
  14.127 -testJavac success -classpath foo ClassPathTest1.java
  14.128 -testJavac failure -classpath foo ClassPathTest2.java
  14.129 -testJavac failure -classpath foo ClassPathTest3.java
  14.130 -
  14.131 -if test -n "$failed"; then
  14.132 -	echo "Some tests failed"
  14.133 -	exit 1
  14.134 -else
  14.135 -	echo PASS: all tests gave expected results
  14.136 -	exit 0
  14.137 -fi
    15.1 --- a/test/tools/javac/ClassPathTest/ClassPathTest1.java	Tue Feb 19 00:31:45 2013 -0800
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,29 +0,0 @@
    15.4 -/*
    15.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    15.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 - *
    15.8 - * This code is free software; you can redistribute it and/or modify it
    15.9 - * under the terms of the GNU General Public License version 2 only, as
   15.10 - * published by the Free Software Foundation.
   15.11 - *
   15.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 - * version 2 for more details (a copy is included in the LICENSE file that
   15.16 - * accompanied this code).
   15.17 - *
   15.18 - * You should have received a copy of the GNU General Public License version
   15.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   15.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 - *
   15.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.23 - * or visit www.oracle.com if you need additional information or have any
   15.24 - * questions.
   15.25 - */
   15.26 -
   15.27 -import pkg.*;
   15.28 -
   15.29 -public class ClassPathTest1 {
   15.30 -    ClassPathTestAux1 x;
   15.31 -
   15.32 -}
    16.1 --- a/test/tools/javac/ClassPathTest/ClassPathTest2.java	Tue Feb 19 00:31:45 2013 -0800
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,29 +0,0 @@
    16.4 -/*
    16.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    16.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 - *
    16.8 - * This code is free software; you can redistribute it and/or modify it
    16.9 - * under the terms of the GNU General Public License version 2 only, as
   16.10 - * published by the Free Software Foundation.
   16.11 - *
   16.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 - * version 2 for more details (a copy is included in the LICENSE file that
   16.16 - * accompanied this code).
   16.17 - *
   16.18 - * You should have received a copy of the GNU General Public License version
   16.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   16.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 - *
   16.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.23 - * or visit www.oracle.com if you need additional information or have any
   16.24 - * questions.
   16.25 - */
   16.26 -
   16.27 -import pkg.*;
   16.28 -
   16.29 -public class ClassPathTest2 {
   16.30 -    ClassPathTestAux2 x;
   16.31 -
   16.32 -}
    17.1 --- a/test/tools/javac/ClassPathTest/ClassPathTest3.java	Tue Feb 19 00:31:45 2013 -0800
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,29 +0,0 @@
    17.4 -/*
    17.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    17.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 - *
    17.8 - * This code is free software; you can redistribute it and/or modify it
    17.9 - * under the terms of the GNU General Public License version 2 only, as
   17.10 - * published by the Free Software Foundation.
   17.11 - *
   17.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   17.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.15 - * version 2 for more details (a copy is included in the LICENSE file that
   17.16 - * accompanied this code).
   17.17 - *
   17.18 - * You should have received a copy of the GNU General Public License version
   17.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   17.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.21 - *
   17.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.23 - * or visit www.oracle.com if you need additional information or have any
   17.24 - * questions.
   17.25 - */
   17.26 -
   17.27 -import pkg.*;
   17.28 -
   17.29 -public class ClassPathTest3 {
   17.30 -    ClassPathTestAux3 x;
   17.31 -
   17.32 -}
    18.1 --- a/test/tools/javac/ClassPathTest/bar/pkg/ClassPathTestAux2.java	Tue Feb 19 00:31:45 2013 -0800
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,26 +0,0 @@
    18.4 -/*
    18.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    18.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 - *
    18.8 - * This code is free software; you can redistribute it and/or modify it
    18.9 - * under the terms of the GNU General Public License version 2 only, as
   18.10 - * published by the Free Software Foundation.
   18.11 - *
   18.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   18.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.15 - * version 2 for more details (a copy is included in the LICENSE file that
   18.16 - * accompanied this code).
   18.17 - *
   18.18 - * You should have received a copy of the GNU General Public License version
   18.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   18.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.21 - *
   18.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   18.23 - * or visit www.oracle.com if you need additional information or have any
   18.24 - * questions.
   18.25 - */
   18.26 -
   18.27 -package pkg;
   18.28 -
   18.29 -public class ClassPathTestAux2 {}
    19.1 --- a/test/tools/javac/ClassPathTest/foo/pkg/ClassPathTestAux1.java	Tue Feb 19 00:31:45 2013 -0800
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,26 +0,0 @@
    19.4 -/*
    19.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    19.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 - *
    19.8 - * This code is free software; you can redistribute it and/or modify it
    19.9 - * under the terms of the GNU General Public License version 2 only, as
   19.10 - * published by the Free Software Foundation.
   19.11 - *
   19.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   19.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.15 - * version 2 for more details (a copy is included in the LICENSE file that
   19.16 - * accompanied this code).
   19.17 - *
   19.18 - * You should have received a copy of the GNU General Public License version
   19.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   19.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.21 - *
   19.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.23 - * or visit www.oracle.com if you need additional information or have any
   19.24 - * questions.
   19.25 - */
   19.26 -
   19.27 -package pkg;
   19.28 -
   19.29 -public class ClassPathTestAux1 {}
    20.1 --- a/test/tools/javac/ClassPathTest/pkg/ClassPathTestAux3.java	Tue Feb 19 00:31:45 2013 -0800
    20.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.3 @@ -1,26 +0,0 @@
    20.4 -/*
    20.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    20.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.7 - *
    20.8 - * This code is free software; you can redistribute it and/or modify it
    20.9 - * under the terms of the GNU General Public License version 2 only, as
   20.10 - * published by the Free Software Foundation.
   20.11 - *
   20.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   20.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   20.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   20.15 - * version 2 for more details (a copy is included in the LICENSE file that
   20.16 - * accompanied this code).
   20.17 - *
   20.18 - * You should have received a copy of the GNU General Public License version
   20.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   20.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   20.21 - *
   20.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   20.23 - * or visit www.oracle.com if you need additional information or have any
   20.24 - * questions.
   20.25 - */
   20.26 -
   20.27 -package pkg;
   20.28 -
   20.29 -public class ClassPathTestAux3 {}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/test/tools/javac/ExtDirs/ExtDirTest.java	Tue Feb 19 17:53:16 2013 +0000
    21.3 @@ -0,0 +1,176 @@
    21.4 +/*
    21.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.
   21.11 + *
   21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.15 + * version 2 for more details (a copy is included in the LICENSE file that
   21.16 + * accompanied this code).
   21.17 + *
   21.18 + * You should have received a copy of the GNU General Public License version
   21.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.21 + *
   21.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.23 + * or visit www.oracle.com if you need additional information or have any
   21.24 + * questions.
   21.25 + */
   21.26 +
   21.27 +/*
   21.28 + * @test
   21.29 + * @bug 4204897 4256097 4785453 4863609
   21.30 + * @summary Test that '.jar' files in -extdirs are found.
   21.31 + * @library /tools/javac/lib
   21.32 + * @build ToolBox
   21.33 + * @run main ExtDirTest
   21.34 + */
   21.35 +
   21.36 +import java.io.File;
   21.37 +import java.nio.file.Files;
   21.38 +import java.nio.file.Paths;
   21.39 +import java.util.Arrays;
   21.40 +import java.util.List;
   21.41 +
   21.42 +//original test: test/tools/javac/ExtDirs/ExtDirs.sh
   21.43 +public class ExtDirTest {
   21.44 +
   21.45 +    private static final String ExtDirTestClass1Src =
   21.46 +        "package pkg1;\n" +
   21.47 +        "\n" +
   21.48 +        "public class ExtDirTestClass1 {}";
   21.49 +
   21.50 +    private static final String ExtDirTestClass2Src =
   21.51 +        "package pkg2;\n" +
   21.52 +        "\n" +
   21.53 +        "public class ExtDirTestClass2 {}";
   21.54 +
   21.55 +    private static final String ExtDirTest_1Src =
   21.56 +        "import pkg1.*;\n" +
   21.57 +        "\n" +
   21.58 +        "public class ExtDirTest_1 {\n" +
   21.59 +        "  ExtDirTestClass1 x;\n" +
   21.60 +        "}";
   21.61 +
   21.62 +    private static final String ExtDirTest_2Src =
   21.63 +        "import pkg1.*;\n" +
   21.64 +        "import pkg2.*;\n" +
   21.65 +        "\n" +
   21.66 +        "public class ExtDirTest_2 {\n" +
   21.67 +        "  ExtDirTestClass1 x;\n" +
   21.68 +        "  ExtDirTestClass2 y;\n" +
   21.69 +        "}";
   21.70 +
   21.71 +    private static final String ExtDirTest_3Src =
   21.72 +        "import pkg1.*;\n" +
   21.73 +        "import pkg2.*;\n" +
   21.74 +        "\n" +
   21.75 +        "public class ExtDirTest_3 {\n" +
   21.76 +        "  ExtDirTestClass1 x;\n" +
   21.77 +        "  ExtDirTestClass2 y;\n" +
   21.78 +        "}";
   21.79 +
   21.80 +    private static final String jar1Manifest =
   21.81 +        "Manifest-Version: 1.0\n" +
   21.82 +        "\n" +
   21.83 +        "Name: pkg1/ExtDirTestClass1.class\n" +
   21.84 +        "Digest-Algorithms: SHA MD5 \n" +
   21.85 +        "SHA-Digest: 9HEcO9LJmND3cvOlq/AbUsbD9S0=\n" +
   21.86 +        "MD5-Digest: hffPBwfqcUcnEdNv4PXu1Q==\n" +
   21.87 +        "\n" +
   21.88 +        "Name: pkg1/ExtDirTestClass1.java\n" +
   21.89 +        "Digest-Algorithms: SHA MD5 \n" +
   21.90 +        "SHA-Digest: 2FQVe6w3n2Ma1ACYpe8a988EBU8=\n" +
   21.91 +        "MD5-Digest: /Ivr4zVI9MSM26NmqWtZpQ==\n";
   21.92 +
   21.93 +    private static final String jar2Manifest =
   21.94 +        "Manifest-Version: 1.0\n" +
   21.95 +        "\n" +
   21.96 +        "Name: pkg2/ExtDirTestClass2.class\n" +
   21.97 +        "Digest-Algorithms: SHA MD5 \n" +
   21.98 +        "SHA-Digest: elbPaqWf8hjj1+ZkkdW3PGTsilo=\n" +
   21.99 +        "MD5-Digest: 57Nn0e2t1yEQfu/4kSw8yg==\n" +
  21.100 +        "\n" +
  21.101 +        "Name: pkg2/ExtDirTestClass2.java\n" +
  21.102 +        "Digest-Algorithms: SHA MD5 \n" +
  21.103 +        "SHA-Digest: ILJOhwHg5US+yuw1Sc1d+Avu628=\n" +
  21.104 +        "MD5-Digest: j8wnz8wneEcuJ/gjXBBQNA==\n";
  21.105 +
  21.106 +    List<String> ouputDirParam = Arrays.asList("-d", ".");
  21.107 +
  21.108 +    public static void main(String args[]) throws Exception {
  21.109 +        new ExtDirTest().run();
  21.110 +    }
  21.111 +
  21.112 +    void run() throws Exception {
  21.113 +        createJars();
  21.114 +        compileWithExtDirs();
  21.115 +    }
  21.116 +
  21.117 +    void createJars() throws Exception {
  21.118 +
  21.119 +//        for i in 1 2 3; do
  21.120 +//            if test ! -d ext${i}; then mkdir ext${i}; fi
  21.121 +//            cp ${TESTSRC}${FS}ext${i}${FS}*.jar ext${i}
  21.122 +//        done
  21.123 +        sun.tools.jar.Main jarGenerator =
  21.124 +                new sun.tools.jar.Main(System.out, System.err, "jar");
  21.125 +
  21.126 +        ToolBox.JavaToolArgs javacParams =
  21.127 +                new ToolBox.JavaToolArgs()
  21.128 +                .setOptions(ouputDirParam)
  21.129 +                .setSources(ExtDirTestClass1Src);
  21.130 +        ToolBox.javac(javacParams);
  21.131 +
  21.132 +        ToolBox.writeFile(Paths.get("pkg1", "MANIFEST.MF"), jar1Manifest);
  21.133 +        jarGenerator.run(new String[] {"cfm", "pkg1.jar", "pkg1/MANIFEST.MF",
  21.134 +            "pkg1/ExtDirTestClass1.class"});
  21.135 +
  21.136 +        javacParams.setSources(ExtDirTestClass2Src);
  21.137 +        ToolBox.javac(javacParams);
  21.138 +
  21.139 +        ToolBox.writeFile(Paths.get("pkg2", "MANIFEST.MF"), jar2Manifest);
  21.140 +        jarGenerator.run(new String[] {"cfm", "pkg2.jar", "pkg2/MANIFEST.MF",
  21.141 +            "pkg2/ExtDirTestClass2.class"});
  21.142 +
  21.143 +        ToolBox.copyFile(Paths.get("ext1", "pkg1.jar"), Paths.get("pkg1.jar"));
  21.144 +        ToolBox.copyFile(Paths.get("ext2", "pkg2.jar"), Paths.get("pkg2.jar"));
  21.145 +        ToolBox.copyFile(Paths.get("ext3", "pkg1.jar"), Paths.get("pkg1.jar"));
  21.146 +        ToolBox.copyFile(Paths.get("ext3", "pkg2.jar"), Paths.get("pkg2.jar"));
  21.147 +
  21.148 +        Files.delete(Paths.get("pkg1.jar"));
  21.149 +        Files.delete(Paths.get("pkg2.jar"));
  21.150 +
  21.151 +        Files.delete(Paths.get("pkg1", "ExtDirTestClass1.class"));
  21.152 +        Files.delete(Paths.get("pkg1", "MANIFEST.MF"));
  21.153 +        Files.delete(Paths.get("pkg1"));
  21.154 +        Files.delete(Paths.get("pkg2", "ExtDirTestClass2.class"));
  21.155 +        Files.delete(Paths.get("pkg2", "MANIFEST.MF"));
  21.156 +        Files.delete(Paths.get("pkg2"));
  21.157 +    }
  21.158 +
  21.159 +    void compileWithExtDirs() throws Exception {
  21.160 +
  21.161 +//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java"
  21.162 +        ToolBox.JavaToolArgs params =
  21.163 +                new ToolBox.JavaToolArgs()
  21.164 +                .setOptions("-d", ".", "-extdirs", "ext1")
  21.165 +                .setSources(ExtDirTest_1Src);
  21.166 +        ToolBox.javac(params);
  21.167 +
  21.168 +//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java"
  21.169 +        params.setOptions("-d", ".", "-extdirs", "ext1" + File.pathSeparator + "ext2")
  21.170 +                .setSources(ExtDirTest_2Src);
  21.171 +        ToolBox.javac(params);
  21.172 +
  21.173 +//"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java"
  21.174 +        params.setOptions("-d", ".", "-extdirs", "ext3")
  21.175 +                .setSources(ExtDirTest_3Src);
  21.176 +        ToolBox.javac(params);
  21.177 +    }
  21.178 +
  21.179 +}
    22.1 --- a/test/tools/javac/ExtDirs/ExtDirTest_1.java	Tue Feb 19 00:31:45 2013 -0800
    22.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.3 @@ -1,28 +0,0 @@
    22.4 -/*
    22.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    22.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.7 - *
    22.8 - * This code is free software; you can redistribute it and/or modify it
    22.9 - * under the terms of the GNU General Public License version 2 only, as
   22.10 - * published by the Free Software Foundation.
   22.11 - *
   22.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   22.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   22.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   22.15 - * version 2 for more details (a copy is included in the LICENSE file that
   22.16 - * accompanied this code).
   22.17 - *
   22.18 - * You should have received a copy of the GNU General Public License version
   22.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   22.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   22.21 - *
   22.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22.23 - * or visit www.oracle.com if you need additional information or have any
   22.24 - * questions.
   22.25 - */
   22.26 -
   22.27 -import pkg1.*;
   22.28 -
   22.29 -public class ExtDirTest_1 {
   22.30 -  ExtDirTestClass1 x;
   22.31 -}
    23.1 --- a/test/tools/javac/ExtDirs/ExtDirTest_2.java	Tue Feb 19 00:31:45 2013 -0800
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,30 +0,0 @@
    23.4 -/*
    23.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    23.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.7 - *
    23.8 - * This code is free software; you can redistribute it and/or modify it
    23.9 - * under the terms of the GNU General Public License version 2 only, as
   23.10 - * published by the Free Software Foundation.
   23.11 - *
   23.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   23.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   23.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   23.15 - * version 2 for more details (a copy is included in the LICENSE file that
   23.16 - * accompanied this code).
   23.17 - *
   23.18 - * You should have received a copy of the GNU General Public License version
   23.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   23.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   23.21 - *
   23.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   23.23 - * or visit www.oracle.com if you need additional information or have any
   23.24 - * questions.
   23.25 - */
   23.26 -
   23.27 -import pkg1.*;
   23.28 -import pkg2.*;
   23.29 -
   23.30 -public class ExtDirTest_2 {
   23.31 -  ExtDirTestClass1 x;
   23.32 -  ExtDirTestClass2 y;
   23.33 -}
    24.1 --- a/test/tools/javac/ExtDirs/ExtDirTest_3.java	Tue Feb 19 00:31:45 2013 -0800
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,30 +0,0 @@
    24.4 -/*
    24.5 - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
    24.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.7 - *
    24.8 - * This code is free software; you can redistribute it and/or modify it
    24.9 - * under the terms of the GNU General Public License version 2 only, as
   24.10 - * published by the Free Software Foundation.
   24.11 - *
   24.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   24.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   24.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   24.15 - * version 2 for more details (a copy is included in the LICENSE file that
   24.16 - * accompanied this code).
   24.17 - *
   24.18 - * You should have received a copy of the GNU General Public License version
   24.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   24.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24.21 - *
   24.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   24.23 - * or visit www.oracle.com if you need additional information or have any
   24.24 - * questions.
   24.25 - */
   24.26 -
   24.27 -import pkg1.*;
   24.28 -import pkg2.*;
   24.29 -
   24.30 -public class ExtDirTest_3 {
   24.31 -  ExtDirTestClass1 x;
   24.32 -  ExtDirTestClass2 y;
   24.33 -}
    25.1 --- a/test/tools/javac/ExtDirs/ExtDirs.sh	Tue Feb 19 00:31:45 2013 -0800
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,100 +0,0 @@
    25.4 -#!/bin/sh
    25.5 -
    25.6 -#
    25.7 -# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    25.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.9 -#
   25.10 -# This code is free software; you can redistribute it and/or modify it
   25.11 -# under the terms of the GNU General Public License version 2 only, as
   25.12 -# published by the Free Software Foundation.
   25.13 -#
   25.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   25.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.17 -# version 2 for more details (a copy is included in the LICENSE file that
   25.18 -# accompanied this code).
   25.19 -#
   25.20 -# You should have received a copy of the GNU General Public License version
   25.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   25.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.23 -#
   25.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   25.25 -# or visit www.oracle.com if you need additional information or have any
   25.26 -# questions.
   25.27 -#
   25.28 -
   25.29 -
   25.30 -# @test
   25.31 -# @bug 4204897 4256097 4785453 4863609
   25.32 -# @summary Test that '.jar' files in -extdirs are found.
   25.33 -# @author maddox
   25.34 -#
   25.35 -# @run shell/timeout=180 ExtDirs.sh
   25.36 -
   25.37 -if [ "${TESTSRC}" = "" ]
   25.38 -then
   25.39 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   25.40 -  exit 1
   25.41 -fi
   25.42 -echo "TESTSRC=${TESTSRC}"
   25.43 -if [ "${TESTJAVA}" = "" ]
   25.44 -then
   25.45 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   25.46 -  exit 1
   25.47 -fi
   25.48 -echo "TESTJAVA=${TESTJAVA}"
   25.49 -if [ "${TESTCLASSES}" = "" ]
   25.50 -then
   25.51 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   25.52 -  exit 1
   25.53 -fi
   25.54 -echo "TESTCLASSES=${TESTCLASSES}"
   25.55 -echo "CLASSPATH=${CLASSPATH}"
   25.56 -
   25.57 -# set platform-dependent variables
   25.58 -OS=`uname -s`
   25.59 -case "$OS" in
   25.60 -  SunOS | Linux | Darwin )
   25.61 -    PS=":"
   25.62 -    FS="/"
   25.63 -    ;;
   25.64 -  CYGWIN* )
   25.65 -    PS=";" # native PS, not Cygwin PS
   25.66 -    FS="/"
   25.67 -    ;;
   25.68 -  Windows* )
   25.69 -    PS=";"
   25.70 -    FS="\\"
   25.71 -    ;;
   25.72 -  * )
   25.73 -    echo "Unrecognized system!"
   25.74 -    exit 1;
   25.75 -    ;;
   25.76 -esac
   25.77 -
   25.78 -fail() {
   25.79 -	echo 'FAIL: unexpected result encountered'
   25.80 -        exit 1
   25.81 -}
   25.82 -
   25.83 -javac="${TESTJAVA}${FS}bin${FS}javac"
   25.84 -
   25.85 -for i in 1 2 3; do
   25.86 -    if test ! -d ext${i}; then mkdir ext${i}; fi
   25.87 -    cp ${TESTSRC}${FS}ext${i}${FS}*.jar ext${i}
   25.88 -done
   25.89 -
   25.90 -echo "Test 1"
   25.91 -"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1 "${TESTSRC}${FS}ExtDirTest_1.java"
   25.92 -if [ $? -ne 0 ] ; then fail ; fi
   25.93 -
   25.94 -echo "Test 2"
   25.95 -"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext1${PS}ext2 "${TESTSRC}${FS}ExtDirTest_2.java"
   25.96 -if [ $? -ne 0 ] ; then fail ; fi
   25.97 -
   25.98 -echo "Test 3"
   25.99 -"$javac" ${TESTTOOLVMOPTS} -d . -extdirs ext3 "${TESTSRC}${FS}ExtDirTest_3.java"
  25.100 -if [ $? -ne 0 ] ; then fail ; fi
  25.101 -
  25.102 -echo PASS: all tests gave expected results
  25.103 -exit 0
    26.1 --- a/test/tools/javac/MissingInclude.java	Tue Feb 19 00:31:45 2013 -0800
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,33 +0,0 @@
    26.4 -/*
    26.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
    26.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.7 - *
    26.8 - * This code is free software; you can redistribute it and/or modify it
    26.9 - * under the terms of the GNU General Public License version 2 only, as
   26.10 - * published by the Free Software Foundation.
   26.11 - *
   26.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   26.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   26.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   26.15 - * version 2 for more details (a copy is included in the LICENSE file that
   26.16 - * accompanied this code).
   26.17 - *
   26.18 - * You should have received a copy of the GNU General Public License version
   26.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   26.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   26.21 - *
   26.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   26.23 - * or visit www.oracle.com if you need additional information or have any
   26.24 - * questions.
   26.25 - */
   26.26 -
   26.27 -/*
   26.28 - * @test
   26.29 - * @bug 4509051 4785453
   26.30 - * @summary javac <AT>sourcefiles should catch Exception, when sourcefiles doesn't exist.
   26.31 - * @author gafter
   26.32 - *
   26.33 - * @run shell MissingInclude.sh
   26.34 - */
   26.35 -
   26.36 -class MissingInclude {}
    27.1 --- a/test/tools/javac/MissingInclude.sh	Tue Feb 19 00:31:45 2013 -0800
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,77 +0,0 @@
    27.4 -#!/bin/sh
    27.5 -
    27.6 -#
    27.7 -# Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
    27.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.9 -#
   27.10 -# This code is free software; you can redistribute it and/or modify it
   27.11 -# under the terms of the GNU General Public License version 2 only, as
   27.12 -# published by the Free Software Foundation.
   27.13 -#
   27.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   27.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   27.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   27.17 -# version 2 for more details (a copy is included in the LICENSE file that
   27.18 -# accompanied this code).
   27.19 -#
   27.20 -# You should have received a copy of the GNU General Public License version
   27.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   27.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   27.23 -#
   27.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   27.25 -# or visit www.oracle.com if you need additional information or have any
   27.26 -# questions.
   27.27 -#
   27.28 -
   27.29 -
   27.30 -if [ "${TESTSRC}" = "" ]
   27.31 -then
   27.32 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   27.33 -  exit 1
   27.34 -fi
   27.35 -echo "TESTSRC=${TESTSRC}"
   27.36 -if [ "${TESTJAVA}" = "" ]
   27.37 -then
   27.38 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   27.39 -  exit 1
   27.40 -fi
   27.41 -echo "TESTJAVA=${TESTJAVA}"
   27.42 -if [ "${TESTCLASSES}" = "" ]
   27.43 -then
   27.44 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   27.45 -  exit 1
   27.46 -fi
   27.47 -echo "TESTCLASSES=${TESTCLASSES}"
   27.48 -echo "CLASSPATH=${CLASSPATH}"
   27.49 -
   27.50 -# set platform-dependent variables
   27.51 -OS=`uname -s`
   27.52 -case "$OS" in
   27.53 -  SunOS | Linux | Darwin | CYGWIN* )
   27.54 -    FS="/"
   27.55 -    ;;
   27.56 -  Windows* )
   27.57 -    FS="\\"
   27.58 -    ;;
   27.59 -  * )
   27.60 -    echo "Unrecognized system!"
   27.61 -    exit 1;
   27.62 -    ;;
   27.63 -esac
   27.64 -
   27.65 -TMP1=OUTPUT.txt
   27.66 -
   27.67 -cp "${TESTSRC}${FS}MissingInclude.java" .
   27.68 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} @/nonexistent_file MissingInclude.java 2> ${TMP1}
   27.69 -result=$?
   27.70 -cat ${TMP1}
   27.71 -rm ${TMP1}
   27.72 -
   27.73 -if [ $result -eq 0 ]
   27.74 -then
   27.75 -  echo "Failed"
   27.76 -  exit 1
   27.77 -else
   27.78 -  echo "Passed"
   27.79 -  exit 0
   27.80 -fi
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/test/tools/javac/MissingInclude/MissingIncludeTest.java	Tue Feb 19 17:53:16 2013 +0000
    28.3 @@ -0,0 +1,50 @@
    28.4 +/*
    28.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.7 + *
    28.8 + * This code is free software; you can redistribute it and/or modify it
    28.9 + * under the terms of the GNU General Public License version 2 only, as
   28.10 + * published by the Free Software Foundation.
   28.11 + *
   28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   28.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   28.15 + * version 2 for more details (a copy is included in the LICENSE file that
   28.16 + * accompanied this code).
   28.17 + *
   28.18 + * You should have received a copy of the GNU General Public License version
   28.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   28.21 + *
   28.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   28.23 + * or visit www.oracle.com if you need additional information or have any
   28.24 + * questions.
   28.25 + */
   28.26 +
   28.27 +/*
   28.28 + * @test
   28.29 + * @bug 4509051 4785453
   28.30 + * @summary javac <AT>sourcefiles should catch Exception, when sourcefiles
   28.31 + * doesn't exist.
   28.32 + * @library /tools/javac/lib
   28.33 + * @build ToolBox
   28.34 + * @run main MissingIncludeTest
   28.35 + */
   28.36 +
   28.37 +//original test: test/tools/javac/MissingInclude.sh
   28.38 +public class MissingIncludeTest {
   28.39 +
   28.40 +    private static final String MissingIncludeSrc =
   28.41 +        "class MissingInclude {}";
   28.42 +
   28.43 +    public static void main(String[] args) throws Exception {
   28.44 +        ToolBox.createJavaFileFromSource(MissingIncludeSrc);
   28.45 +
   28.46 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} @/nonexistent_file MissingInclude.java 2> ${TMP1}
   28.47 +        ToolBox.JavaToolArgs params =
   28.48 +                new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
   28.49 +                .setAllArgs("@/nonexistent_file", "MissingInclude.java");
   28.50 +        ToolBox.javac(params);
   28.51 +    }
   28.52 +
   28.53 +}
    29.1 --- a/test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh	Tue Feb 19 00:31:45 2013 -0800
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,84 +0,0 @@
    29.4 -#
    29.5 -# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
    29.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.7 -#
    29.8 -# This code is free software; you can redistribute it and/or modify it
    29.9 -# under the terms of the GNU General Public License version 2 only, as
   29.10 -# published by the Free Software Foundation.
   29.11 -#
   29.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
   29.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   29.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   29.15 -# version 2 for more details (a copy is included in the LICENSE file that
   29.16 -# accompanied this code).
   29.17 -#
   29.18 -# You should have received a copy of the GNU General Public License version
   29.19 -# 2 along with this work; if not, write to the Free Software Foundation,
   29.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   29.21 -#
   29.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   29.23 -# or visit www.oracle.com if you need additional information or have any
   29.24 -# questions.
   29.25 -#
   29.26 -
   29.27 -# @test
   29.28 -# @bug 4087314 4800342
   29.29 -# @summary Verify allowed access to protected class from another package.
   29.30 -# @author William Maddox (maddox)
   29.31 -#
   29.32 -# @run shell ProtectedInnerClass.sh
   29.33 -
   29.34 -
   29.35 -if [ "${TESTSRC}" = "" ]
   29.36 -then
   29.37 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   29.38 -  exit 1
   29.39 -fi
   29.40 -echo "TESTSRC=${TESTSRC}"
   29.41 -if [ "${TESTJAVA}" = "" ]
   29.42 -then
   29.43 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   29.44 -  exit 1
   29.45 -fi
   29.46 -echo "TESTJAVA=${TESTJAVA}"
   29.47 -if [ "${TESTCLASSES}" = "" ]
   29.48 -then
   29.49 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   29.50 -  exit 1
   29.51 -fi
   29.52 -echo "TESTCLASSES=${TESTCLASSES}"
   29.53 -echo "CLASSPATH=${CLASSPATH}"
   29.54 -
   29.55 -# set platform-dependent variables
   29.56 -OS=`uname -s`
   29.57 -case "$OS" in
   29.58 -  SunOS | Linux | Darwin )
   29.59 -    PS=":"
   29.60 -    FS="/"
   29.61 -    ;;
   29.62 -  CYGWIN* ) 
   29.63 -    PS=";" # native PS, not Cygwin PS
   29.64 -    FS="/"
   29.65 -    ;;
   29.66 -  Windows* )
   29.67 -    PS=";"
   29.68 -    FS="\\"
   29.69 -    ;;
   29.70 -  * )
   29.71 -    echo "Unrecognized system!"
   29.72 -    exit 1;
   29.73 -    ;;
   29.74 -esac
   29.75 -
   29.76 -rm -f ${TESTCLASSES}${FS}p1${FS}*.class ${TESTCLASSES}${FS}p2${FS}*.class
   29.77 -
   29.78 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}${FS}p1${FS}ProtectedInnerClass1.java" "${TESTSRC}${FS}p2${FS}ProtectedInnerClass2.java"
   29.79 -"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
   29.80 -result=$?
   29.81 -if [ $result -eq 0 ]
   29.82 -then
   29.83 -  echo "Passed"
   29.84 -else
   29.85 -  echo "Failed"
   29.86 -fi
   29.87 -exit $result
    30.1 --- a/test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java	Tue Feb 19 00:31:45 2013 -0800
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,33 +0,0 @@
    30.4 -/*
    30.5 - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
    30.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 - *
    30.8 - * This code is free software; you can redistribute it and/or modify it
    30.9 - * under the terms of the GNU General Public License version 2 only, as
   30.10 - * published by the Free Software Foundation.
   30.11 - *
   30.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   30.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.15 - * version 2 for more details (a copy is included in the LICENSE file that
   30.16 - * accompanied this code).
   30.17 - *
   30.18 - * You should have received a copy of the GNU General Public License version
   30.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   30.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.21 - *
   30.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   30.23 - * or visit www.oracle.com if you need additional information or have any
   30.24 - * questions.
   30.25 - */
   30.26 -
   30.27 -/*
   30.28 - * @test
   30.29 - * @bug 4307565
   30.30 - * @summary Verify that access to inaccessable protected inner class is rejected.
   30.31 - * @author William Maddox (maddox)
   30.32 - *
   30.33 - * @run compile p1/ProtectedInnerClass1.java
   30.34 - * @run compile/fail p2/ProtectedInnerClass3.java
   30.35 - */
   30.36 -class Dummy {}
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/test/tools/javac/ProtectedInnerClass/ProtectedInnerClassesTest.java	Tue Feb 19 17:53:16 2013 +0000
    31.3 @@ -0,0 +1,115 @@
    31.4 +/*
    31.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 + *
    31.8 + * This code is free software; you can redistribute it and/or modify it
    31.9 + * under the terms of the GNU General Public License version 2 only, as
   31.10 + * published by the Free Software Foundation.
   31.11 + *
   31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.15 + * version 2 for more details (a copy is included in the LICENSE file that
   31.16 + * accompanied this code).
   31.17 + *
   31.18 + * You should have received a copy of the GNU General Public License version
   31.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.21 + *
   31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   31.23 + * or visit www.oracle.com if you need additional information or have any
   31.24 + * questions.
   31.25 + */
   31.26 +
   31.27 +/*
   31.28 + * @test
   31.29 + * @bug 4087314 4800342 4307565
   31.30 + * @summary Verify allowed access to protected class from another package
   31.31 + * @library /tools/javac/lib
   31.32 + * @build ToolBox
   31.33 + * @run main ProtectedInnerClassesTest
   31.34 + */
   31.35 +
   31.36 +//original tests: test/tools/javac/ProtectedInnerClass/ProtectedInnerClass.sh
   31.37 +//and test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java
   31.38 +public class ProtectedInnerClassesTest {
   31.39 +
   31.40 +    private static final String protectedInnerClass1Src =
   31.41 +        "package p1;\n" +
   31.42 +        "\n" +
   31.43 +        "public class ProtectedInnerClass1 {\n" +
   31.44 +        "    protected class Foo {\n" +
   31.45 +        "        public String getBar() { return \"bar\"; }\n" +
   31.46 +        "    }\n" +
   31.47 +        "}";
   31.48 +
   31.49 +    private static final String protectedInnerClass2Src =
   31.50 +        "package p2;\n" +
   31.51 +        "\n" +
   31.52 +        "public class ProtectedInnerClass2 extends p1.ProtectedInnerClass1\n" +
   31.53 +        "{\n" +
   31.54 +        "    class Bug extends Foo {\n" +
   31.55 +        "        String getBug() { return getBar(); }\n" +
   31.56 +        "    }\n" +
   31.57 +        "\n" +
   31.58 +        "    public static void main(String[] args) {\n" +
   31.59 +        "        ProtectedInnerClass2 x = new ProtectedInnerClass2();\n" +
   31.60 +        "        Bug y = x.new Bug();\n" +
   31.61 +        "        System.out.println(y.getBug());\n" +
   31.62 +        "    }\n" +
   31.63 +        "}";
   31.64 +
   31.65 +    private static final String protectedInnerClass3Src =
   31.66 +        "package p2;\n" +
   31.67 +        "\n" +
   31.68 +        "public class ProtectedInnerClass3 {\n" +
   31.69 +        "\n" +
   31.70 +        "  void test() {\n" +
   31.71 +        "    p1.ProtectedInnerClass1.Foo x;\n" +
   31.72 +        "  }\n" +
   31.73 +        "\n" +
   31.74 +        "}";
   31.75 +
   31.76 +    public static void main(String args[]) throws Exception {
   31.77 +        new ProtectedInnerClassesTest().run();
   31.78 +    }
   31.79 +
   31.80 +    void run() throws Exception {
   31.81 +        compileAndExecute();
   31.82 +        compileOnly();
   31.83 +    }
   31.84 +
   31.85 +    void compileAndExecute() throws Exception {
   31.86 +//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}${FS}p1${FS}ProtectedInnerClass1.java" "${TESTSRC}${FS}p2${FS}ProtectedInnerClass2.java"
   31.87 +        ToolBox.JavaToolArgs javacParams =
   31.88 +                new ToolBox.JavaToolArgs()
   31.89 +                .setOptions("-d", ".")
   31.90 +                .setSources(protectedInnerClass1Src, protectedInnerClass2Src);
   31.91 +
   31.92 +        ToolBox.javac(javacParams);
   31.93 +
   31.94 +//"${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -classpath "${CLASSPATH}${PS}${TESTCLASSES}" p2.ProtectedInnerClass2
   31.95 +        ToolBox.AnyToolArgs javaParams =
   31.96 +                new ToolBox.AnyToolArgs()
   31.97 +                .setAllArgs(ToolBox.javaBinary, "-classpath", System.getProperty("user.dir"),
   31.98 +                    "p2.ProtectedInnerClass2");
   31.99 +        ToolBox.executeCommand(javaParams);
  31.100 +    }
  31.101 +
  31.102 +//from test/tools/javac/ProtectedInnerClass/ProtectedInnerClass_2.java
  31.103 +    void compileOnly() throws Exception {
  31.104 +//@run compile p1/ProtectedInnerClass1.java
  31.105 +        ToolBox.JavaToolArgs javacParams =
  31.106 +                new ToolBox.JavaToolArgs()
  31.107 +                .setOptions("-d", ".")
  31.108 +                .setSources(protectedInnerClass1Src);
  31.109 +
  31.110 +        ToolBox.javac(javacParams);
  31.111 +
  31.112 +//@run compile/fail p2/ProtectedInnerClass3.java
  31.113 +        javacParams.setSources(protectedInnerClass3Src)
  31.114 +                .set(ToolBox.Expect.FAIL);
  31.115 +        ToolBox.javac(javacParams);
  31.116 +    }
  31.117 +
  31.118 +}
    32.1 --- a/test/tools/javac/ProtectedInnerClass/p1/ProtectedInnerClass1.java	Tue Feb 19 00:31:45 2013 -0800
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,37 +0,0 @@
    32.4 -/*
    32.5 - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
    32.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.7 - *
    32.8 - * This code is free software; you can redistribute it and/or modify it
    32.9 - * under the terms of the GNU General Public License version 2 only, as
   32.10 - * published by the Free Software Foundation.
   32.11 - *
   32.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   32.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   32.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   32.15 - * version 2 for more details (a copy is included in the LICENSE file that
   32.16 - * accompanied this code).
   32.17 - *
   32.18 - * You should have received a copy of the GNU General Public License version
   32.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   32.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   32.21 - *
   32.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   32.23 - * or visit www.oracle.com if you need additional information or have any
   32.24 - * questions.
   32.25 - */
   32.26 -
   32.27 -/*
   32.28 - * Auxiliary file for test for 4087314.
   32.29 - * Verify allowed access to protected class from another package.
   32.30 - * This file must be compiled prior to compiling p2.ProtectedInnerClass2.
   32.31 - * It is that compilation that will either succeed or fail.
   32.32 - */
   32.33 -
   32.34 -package p1;
   32.35 -
   32.36 -public class ProtectedInnerClass1 {
   32.37 -    protected class Foo {
   32.38 -        public String getBar() { return "bar"; }
   32.39 -    }
   32.40 -}
    33.1 --- a/test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass2.java	Tue Feb 19 00:31:45 2013 -0800
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,45 +0,0 @@
    33.4 -/*
    33.5 - * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
    33.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.7 - *
    33.8 - * This code is free software; you can redistribute it and/or modify it
    33.9 - * under the terms of the GNU General Public License version 2 only, as
   33.10 - * published by the Free Software Foundation.
   33.11 - *
   33.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   33.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   33.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   33.15 - * version 2 for more details (a copy is included in the LICENSE file that
   33.16 - * accompanied this code).
   33.17 - *
   33.18 - * You should have received a copy of the GNU General Public License version
   33.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   33.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   33.21 - *
   33.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   33.23 - * or visit www.oracle.com if you need additional information or have any
   33.24 - * questions.
   33.25 - */
   33.26 -
   33.27 -/*
   33.28 - * Auxiliary file for test for 4087314.
   33.29 - * Verify allowed access to protected class from another package.
   33.30 - *
   33.31 - * This file should compile and run successfully.
   33.32 - * Note that class p1.ProtectedInnerClass1 must be compiled first.
   33.33 - */
   33.34 -
   33.35 -package p2;
   33.36 -
   33.37 -public class ProtectedInnerClass2 extends p1.ProtectedInnerClass1
   33.38 -{
   33.39 -    class Bug extends Foo {
   33.40 -        String getBug() { return getBar(); }
   33.41 -    }
   33.42 -
   33.43 -    public static void main(String[] args) {
   33.44 -        ProtectedInnerClass2 x = new ProtectedInnerClass2();
   33.45 -        Bug y = x.new Bug();
   33.46 -        System.out.println(y.getBug());
   33.47 -    }
   33.48 -}
    34.1 --- a/test/tools/javac/ProtectedInnerClass/p2/ProtectedInnerClass3.java	Tue Feb 19 00:31:45 2013 -0800
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,36 +0,0 @@
    34.4 -/*
    34.5 - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
    34.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.7 - *
    34.8 - * This code is free software; you can redistribute it and/or modify it
    34.9 - * under the terms of the GNU General Public License version 2 only, as
   34.10 - * published by the Free Software Foundation.
   34.11 - *
   34.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   34.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   34.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   34.15 - * version 2 for more details (a copy is included in the LICENSE file that
   34.16 - * accompanied this code).
   34.17 - *
   34.18 - * You should have received a copy of the GNU General Public License version
   34.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   34.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   34.21 - *
   34.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   34.23 - * or visit www.oracle.com if you need additional information or have any
   34.24 - * questions.
   34.25 - */
   34.26 -
   34.27 -/*
   34.28 - * Auxiliary file for ProtectedInnerClass_2.java (bugid 4307565)
   34.29 - */
   34.30 -
   34.31 -package p2;
   34.32 -
   34.33 -public class ProtectedInnerClass3 {
   34.34 -
   34.35 -  void test() {
   34.36 -    p1.ProtectedInnerClass1.Foo x;
   34.37 -  }
   34.38 -
   34.39 -}
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/test/tools/javac/T5090006/AssertionFailureTest.java	Tue Feb 19 17:53:16 2013 +0000
    35.3 @@ -0,0 +1,69 @@
    35.4 +/*
    35.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.7 + *
    35.8 + * This code is free software; you can redistribute it and/or modify it
    35.9 + * under the terms of the GNU General Public License version 2 only, as
   35.10 + * published by the Free Software Foundation.
   35.11 + *
   35.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   35.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   35.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   35.15 + * version 2 for more details (a copy is included in the LICENSE file that
   35.16 + * accompanied this code).
   35.17 + *
   35.18 + * You should have received a copy of the GNU General Public License version
   35.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   35.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   35.21 + *
   35.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   35.23 + * or visit www.oracle.com if you need additional information or have any
   35.24 + * questions.
   35.25 + */
   35.26 +
   35.27 +/*
   35.28 + * @test
   35.29 + * @bug 5090006
   35.30 + * @summary javac fails with assertion error
   35.31 + * @library /tools/javac/lib
   35.32 + * @build ToolBox
   35.33 + * @run main AssertionFailureTest
   35.34 + */
   35.35 +
   35.36 +import java.io.File;
   35.37 +import java.nio.file.Paths;
   35.38 +
   35.39 +//original test: test/tools/javac/T5090006/compiler.sh
   35.40 +public class AssertionFailureTest {
   35.41 +
   35.42 +    private static final String testSrc =
   35.43 +        "import stub_tie_gen.wsdl_hello_lit.client.*;\n" +
   35.44 +        "import junit.framework.*;\n" +
   35.45 +        "import testutil.ClientServerTestUtil;\n" +
   35.46 +        "\n" +
   35.47 +        "public class Test {\n" +
   35.48 +        "\n" +
   35.49 +        "    void getStub() throws Exception {\n" +
   35.50 +        "        Hello_PortType_Stub x = null;\n" +
   35.51 +        "        new ClientServerTestUtil().setTransport(x, null, null, null);\n" +
   35.52 +        "    }\n" +
   35.53 +        "\n" +
   35.54 +        "    public static void main(String[] args) {\n" +
   35.55 +        "        System.out.println(\"FISK\");\n" +
   35.56 +        "    }\n" +
   35.57 +        "}";
   35.58 +
   35.59 +    public static void main(String args[]) throws Exception {
   35.60 +        String classpath = Paths.get(System.getProperty("test.src"), "broken.jar")
   35.61 +                .toString();
   35.62 +        classpath = new StringBuilder(classpath)
   35.63 +                .append(File.pathSeparator).append(".").toString();
   35.64 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -verbose -d "${TESTCLASSES}" -cp "${TESTSRC}${FS}broken.jar" "${TESTSRC}${FS}$1"
   35.65 +        ToolBox.JavaToolArgs params =
   35.66 +                new ToolBox.JavaToolArgs()
   35.67 +                .setOptions("-cp", classpath)
   35.68 +                .setSources(testSrc);
   35.69 +        ToolBox.javac(params);
   35.70 +    }
   35.71 +
   35.72 +}
    36.1 --- a/test/tools/javac/T5090006/T5090006.java	Tue Feb 19 00:31:45 2013 -0800
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,47 +0,0 @@
    36.4 -/*
    36.5 - * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
    36.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.7 - *
    36.8 - * This code is free software; you can redistribute it and/or modify it
    36.9 - * under the terms of the GNU General Public License version 2 only, as
   36.10 - * published by the Free Software Foundation.
   36.11 - *
   36.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   36.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   36.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   36.15 - * version 2 for more details (a copy is included in the LICENSE file that
   36.16 - * accompanied this code).
   36.17 - *
   36.18 - * You should have received a copy of the GNU General Public License version
   36.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   36.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   36.21 - *
   36.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   36.23 - * or visit www.oracle.com if you need additional information or have any
   36.24 - * questions.
   36.25 - */
   36.26 -
   36.27 -/*
   36.28 - * @test
   36.29 - * @bug 5090006
   36.30 - * @summary javac fails with assertion error
   36.31 - * @author Peter von der Ah\u00e9
   36.32 - * @run shell compiler.sh T5090006.java
   36.33 - * @run main T5090006
   36.34 - */
   36.35 -
   36.36 -import stub_tie_gen.wsdl_hello_lit.client.*;
   36.37 -import junit.framework.*;
   36.38 -import testutil.ClientServerTestUtil;
   36.39 -
   36.40 -public class T5090006 {
   36.41 -
   36.42 -    void getStub() throws Exception {
   36.43 -        Hello_PortType_Stub x = null;
   36.44 -        new ClientServerTestUtil().setTransport(x, null, null, null);
   36.45 -    }
   36.46 -
   36.47 -    public static void main(String[] args) {
   36.48 -        System.out.println("FISK");
   36.49 -    }
   36.50 -}
    37.1 --- a/test/tools/javac/T5090006/compiler.sh	Tue Feb 19 00:31:45 2013 -0800
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,72 +0,0 @@
    37.4 -#!/bin/sh
    37.5 -
    37.6 -#
    37.7 -# Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
    37.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.9 -#
   37.10 -# This code is free software; you can redistribute it and/or modify it
   37.11 -# under the terms of the GNU General Public License version 2 only, as
   37.12 -# published by the Free Software Foundation.
   37.13 -#
   37.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   37.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   37.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   37.17 -# version 2 for more details (a copy is included in the LICENSE file that
   37.18 -# accompanied this code).
   37.19 -#
   37.20 -# You should have received a copy of the GNU General Public License version
   37.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   37.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   37.23 -#
   37.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   37.25 -# or visit www.oracle.com if you need additional information or have any
   37.26 -# questions.
   37.27 -#
   37.28 -
   37.29 -
   37.30 -if [ "${TESTSRC}" = "" ]
   37.31 -then
   37.32 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   37.33 -  exit 1
   37.34 -fi
   37.35 -echo "TESTSRC=${TESTSRC}"
   37.36 -if [ "${TESTJAVA}" = "" ]
   37.37 -then
   37.38 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   37.39 -  exit 1
   37.40 -fi
   37.41 -echo "TESTJAVA=${TESTJAVA}"
   37.42 -if [ "${TESTCLASSES}" = "" ]
   37.43 -then
   37.44 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   37.45 -  exit 1
   37.46 -fi
   37.47 -echo "TESTCLASSES=${TESTCLASSES}"
   37.48 -echo "CLASSPATH=${CLASSPATH}"
   37.49 -
   37.50 -# set platform-dependent variables
   37.51 -OS=`uname -s`
   37.52 -case "$OS" in
   37.53 -  SunOS | Linux | Darwin | CYGWIN* )
   37.54 -    FS="/"
   37.55 -    ;;
   37.56 -  Windows* )
   37.57 -    FS="\\"
   37.58 -    ;;
   37.59 -  * )
   37.60 -    echo "Unrecognized system!"
   37.61 -    exit 1;
   37.62 -    ;;
   37.63 -esac
   37.64 -
   37.65 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -verbose -d "${TESTCLASSES}" -cp "${TESTSRC}${FS}broken.jar" "${TESTSRC}${FS}$1"
   37.66 -
   37.67 -result=$?
   37.68 -
   37.69 -if [ $result -eq 0 ]
   37.70 -then
   37.71 -  echo "Passed"
   37.72 -else
   37.73 -  echo "Failed"
   37.74 -fi
   37.75 -exit $result
    38.1 --- a/test/tools/javac/constDebug/ConstDebug.java	Tue Feb 19 00:31:45 2013 -0800
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,35 +0,0 @@
    38.4 -/*
    38.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    38.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.7 - *
    38.8 - * This code is free software; you can redistribute it and/or modify it
    38.9 - * under the terms of the GNU General Public License version 2 only, as
   38.10 - * published by the Free Software Foundation.
   38.11 - *
   38.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   38.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   38.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   38.15 - * version 2 for more details (a copy is included in the LICENSE file that
   38.16 - * accompanied this code).
   38.17 - *
   38.18 - * You should have received a copy of the GNU General Public License version
   38.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   38.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   38.21 - *
   38.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   38.23 - * or visit www.oracle.com if you need additional information or have any
   38.24 - * questions.
   38.25 - */
   38.26 -
   38.27 -/*
   38.28 - * @test
   38.29 - * @bug 4645152 4785453
   38.30 - * @summary javac compiler incorrectly inserts <clinit> when -g is specified
   38.31 - * @author gafter
   38.32 - *
   38.33 - * @run shell ConstDebug.sh ConstDebug
   38.34 - */
   38.35 -
   38.36 -public class ConstDebug {
   38.37 -    public static final long l = 12;
   38.38 -}
    39.1 --- a/test/tools/javac/constDebug/ConstDebug.sh	Tue Feb 19 00:31:45 2013 -0800
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,80 +0,0 @@
    39.4 -#!/bin/sh
    39.5 -
    39.6 -#
    39.7 -# Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
    39.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.9 -#
   39.10 -# This code is free software; you can redistribute it and/or modify it
   39.11 -# under the terms of the GNU General Public License version 2 only, as
   39.12 -# published by the Free Software Foundation.
   39.13 -#
   39.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   39.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   39.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   39.17 -# version 2 for more details (a copy is included in the LICENSE file that
   39.18 -# accompanied this code).
   39.19 -#
   39.20 -# You should have received a copy of the GNU General Public License version
   39.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   39.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   39.23 -#
   39.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   39.25 -# or visit www.oracle.com if you need additional information or have any
   39.26 -# questions.
   39.27 -#
   39.28 -
   39.29 -
   39.30 -if [ "${TESTSRC}" = "" ]
   39.31 -then
   39.32 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   39.33 -  exit 1
   39.34 -fi
   39.35 -echo "TESTSRC=${TESTSRC}"
   39.36 -if [ "${TESTJAVA}" = "" ]
   39.37 -then
   39.38 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   39.39 -  exit 1
   39.40 -fi
   39.41 -echo "TESTJAVA=${TESTJAVA}"
   39.42 -if [ "${TESTCLASSES}" = "" ]
   39.43 -then
   39.44 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   39.45 -  exit 1
   39.46 -fi
   39.47 -echo "TESTCLASSES=${TESTCLASSES}"
   39.48 -echo "CLASSPATH=${CLASSPATH}"
   39.49 -
   39.50 -# set platform-dependent variables
   39.51 -OS=`uname -s`
   39.52 -case "$OS" in
   39.53 -  SunOS | Linux | Darwin )
   39.54 -    PS=":"
   39.55 -    FS="/"
   39.56 -    ;;
   39.57 -  CYGWIN* )
   39.58 -    PS=";" # Platform PS, not Cygwin PS
   39.59 -    FS="/"
   39.60 -    ;;
   39.61 -  Windows* )
   39.62 -    PS=";"
   39.63 -    FS="\\"
   39.64 -    ;;
   39.65 -  * )
   39.66 -    echo "Unrecognized system!"
   39.67 -    exit 1;
   39.68 -    ;;
   39.69 -esac
   39.70 -
   39.71 -TMP1=OUTPUT.txt
   39.72 -
   39.73 -cp "${TESTSRC}${FS}$1.java" .
   39.74 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -g -d . -classpath .${PS}${TESTSRC} $1.java 2> ${TMP1}
   39.75 -result=$?
   39.76 -if [ $result -ne 0 ]; then exit $result; fi
   39.77 -if "${TESTJAVA}${FS}bin${FS}javap" $1.class | grep clinit; then
   39.78 -  echo "Failed"
   39.79 -  exit 1;
   39.80 -else
   39.81 -  echo "Passed"
   39.82 -  exit 0;
   39.83 -fi
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/test/tools/javac/constDebug/ConstDebugTest.java	Tue Feb 19 17:53:16 2013 +0000
    40.3 @@ -0,0 +1,51 @@
    40.4 +/*
    40.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.7 + *
    40.8 + * This code is free software; you can redistribute it and/or modify it
    40.9 + * under the terms of the GNU General Public License version 2 only, as
   40.10 + * published by the Free Software Foundation.
   40.11 + *
   40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   40.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   40.15 + * version 2 for more details (a copy is included in the LICENSE file that
   40.16 + * accompanied this code).
   40.17 + *
   40.18 + * You should have received a copy of the GNU General Public License version
   40.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   40.21 + *
   40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   40.23 + * or visit www.oracle.com if you need additional information or have any
   40.24 + * questions.
   40.25 + */
   40.26 +
   40.27 +/*
   40.28 + * @test
   40.29 + * @bug 4645152 4785453
   40.30 + * @summary javac compiler incorrectly inserts <clinit> when -g is specified
   40.31 + * @library /tools/javac/lib
   40.32 + * @build ToolBox
   40.33 + * @run compile -g ConstDebugTest.java
   40.34 + * @run main ConstDebugTest
   40.35 + */
   40.36 +
   40.37 +//original test: test/tools/javac/constDebug/ConstDebug.sh
   40.38 +public class ConstDebugTest {
   40.39 +
   40.40 +    public static final long l = 12;
   40.41 +
   40.42 +    public static void main(String args[]) throws Exception {
   40.43 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -g -d . -classpath .${PS}${TESTSRC} $1.java 2> ${TMP1}
   40.44 +//        if "${TESTJAVA}${FS}bin${FS}javap" $1.class | grep clinit; then fail
   40.45 +        ToolBox.JavaToolArgs javapArgs =
   40.46 +                new ToolBox.JavaToolArgs().setAllArgs("-v",
   40.47 +                "-classpath", System.getProperty("test.classes"), "ConstDebugTest.class");
   40.48 +        if (ToolBox.javap(javapArgs).contains("clinit")) {
   40.49 +            throw new AssertionError(
   40.50 +                "javac should not create a <clinit> method for ConstDebugTest class");
   40.51 +        }
   40.52 +    }
   40.53 +
   40.54 +}
    41.1 --- a/test/tools/javac/fatalErrors/NoJavaLang.java	Tue Feb 19 00:31:45 2013 -0800
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,40 +0,0 @@
    41.4 -/*
    41.5 - * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
    41.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.7 - *
    41.8 - * This code is free software; you can redistribute it and/or modify it
    41.9 - * under the terms of the GNU General Public License version 2 only, as
   41.10 - * published by the Free Software Foundation.
   41.11 - *
   41.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   41.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   41.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   41.15 - * version 2 for more details (a copy is included in the LICENSE file that
   41.16 - * accompanied this code).
   41.17 - *
   41.18 - * You should have received a copy of the GNU General Public License version
   41.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   41.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   41.21 - *
   41.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   41.23 - * or visit www.oracle.com if you need additional information or have any
   41.24 - * questions.
   41.25 - */
   41.26 -
   41.27 -/**
   41.28 - * @test
   41.29 - * @bug 4263768 4785453
   41.30 - * @summary Verify that the compiler does not crash when java.lang is not
   41.31 - * found.
   41.32 - * @author iag
   41.33 - *
   41.34 - * @run shell NoJavaLang.sh
   41.35 - */
   41.36 -
   41.37 -public class NoJavaLang {
   41.38 -    private String s;
   41.39 -
   41.40 -    public String s() {
   41.41 -        return s;
   41.42 -    }
   41.43 -}
    42.1 --- a/test/tools/javac/fatalErrors/NoJavaLang.out	Tue Feb 19 00:31:45 2013 -0800
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,1 +0,0 @@
    42.4 -Fatal Error: Unable to find package java.lang in classpath or bootclasspath
    43.1 --- a/test/tools/javac/fatalErrors/NoJavaLang.sh	Tue Feb 19 00:31:45 2013 -0800
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,114 +0,0 @@
    43.4 -#!/bin/sh
    43.5 -
    43.6 -#
    43.7 -# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
    43.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.9 -#
   43.10 -# This code is free software; you can redistribute it and/or modify it
   43.11 -# under the terms of the GNU General Public License version 2 only, as
   43.12 -# published by the Free Software Foundation.
   43.13 -#
   43.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   43.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   43.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   43.17 -# version 2 for more details (a copy is included in the LICENSE file that
   43.18 -# accompanied this code).
   43.19 -#
   43.20 -# You should have received a copy of the GNU General Public License version
   43.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   43.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   43.23 -#
   43.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   43.25 -# or visit www.oracle.com if you need additional information or have any
   43.26 -# questions.
   43.27 -#
   43.28 -
   43.29 -
   43.30 -if [ "${TESTSRC}" = "" ]
   43.31 -then
   43.32 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   43.33 -  exit 1
   43.34 -fi
   43.35 -printf '%s' "TESTSRC=${TESTSRC}" ; echo
   43.36 -if [ "${TESTJAVA}" = "" ]
   43.37 -then
   43.38 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   43.39 -  exit 1
   43.40 -fi
   43.41 -printf '%s' "TESTJAVA=${TESTJAVA}" ; echo
   43.42 -if [ "${TESTCLASSES}" = "" ]
   43.43 -then
   43.44 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   43.45 -  exit 1
   43.46 -fi
   43.47 -printf '%s' "TESTCLASSES=${TESTCLASSES}" ; echo
   43.48 -printf '%s' "CLASSPATH=${CLASSPATH}" ; echo
   43.49 -echo
   43.50 -
   43.51 -# set platform-dependent variables
   43.52 -OS=`uname -s`
   43.53 -case "$OS" in
   43.54 -  SunOS | Linux | Darwin )
   43.55 -    FS="/"
   43.56 -    ;;
   43.57 -  CYGWIN* )
   43.58 -    FS="/"
   43.59 -    DIFFOPTS="--strip-trailing-cr"
   43.60 -    ;;
   43.61 -  Windows* )
   43.62 -    FS="\\"
   43.63 -    ;;
   43.64 -  * )
   43.65 -    echo "Unrecognized system!"
   43.66 -    exit 1;
   43.67 -    ;;
   43.68 -esac
   43.69 -
   43.70 -TMP1=OUTPUT.txt
   43.71 -
   43.72 -cp "${TESTSRC}${FS}NoJavaLang.java" .
   43.73 -
   43.74 -echo "- verifing that fatal error is not produced in the regular case" 
   43.75 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} NoJavaLang.java 2> "${TMP1}"
   43.76 -result=$?
   43.77 -
   43.78 -if [ $result -eq 0 ]
   43.79 -then
   43.80 -  echo "Passed - base compilation successful"
   43.81 -else
   43.82 -  echo "Failed - unable to compile test"
   43.83 -  exit $result
   43.84 -fi
   43.85 -
   43.86 -echo
   43.87 -
   43.88 -echo "- verifing the fatal error is produced"
   43.89 -rm "${TMP1}"
   43.90 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -bootclasspath . NoJavaLang.java 2> "${TMP1}"
   43.91 -
   43.92 -# return code should be EXIT_SYSERR
   43.93 -result=$?
   43.94 -if [ $result -ne 3 ]
   43.95 -then
   43.96 -  echo "Failed - unexpected return code"
   43.97 -  exit $result
   43.98 -else
   43.99 -  echo "Passed - expected return code"
  43.100 -fi
  43.101 -
  43.102 -# expected message
  43.103 -cat "${TMP1}"
  43.104 -diff ${DIFFOPTS} -c "${TESTSRC}${FS}NoJavaLang.out" "${TMP1}"
  43.105 -result=$?
  43.106 -rm "${TMP1}"
  43.107 -
  43.108 -if [ $result -eq 0 ]
  43.109 -then
  43.110 -  echo "Passed - expected message"
  43.111 -else
  43.112 -  echo "Failed - unexpected message"
  43.113 -  exit $result
  43.114 -
  43.115 -fi
  43.116 -
  43.117 -exit
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/test/tools/javac/fatalErrors/NoJavaLangTest.java	Tue Feb 19 17:53:16 2013 +0000
    44.3 @@ -0,0 +1,76 @@
    44.4 +/*
    44.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    44.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44.7 + *
    44.8 + * This code is free software; you can redistribute it and/or modify it
    44.9 + * under the terms of the GNU General Public License version 2 only, as
   44.10 + * published by the Free Software Foundation.
   44.11 + *
   44.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   44.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   44.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   44.15 + * version 2 for more details (a copy is included in the LICENSE file that
   44.16 + * accompanied this code).
   44.17 + *
   44.18 + * You should have received a copy of the GNU General Public License version
   44.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   44.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   44.21 + *
   44.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   44.23 + * or visit www.oracle.com if you need additional information or have any
   44.24 + * questions.
   44.25 + */
   44.26 +
   44.27 +/*
   44.28 + * @test
   44.29 + * @bug 4263768 4785453
   44.30 + * @summary Verify that the compiler does not crash when java.lang is not
   44.31 + * @library /tools/javac/lib
   44.32 + * @build ToolBox
   44.33 + * @run main NoJavaLangTest
   44.34 + */
   44.35 +
   44.36 +import java.util.ArrayList;
   44.37 +import java.util.List;
   44.38 +
   44.39 +//original test: test/tools/javac/fatalErrors/NoJavaLang.sh
   44.40 +public class NoJavaLangTest {
   44.41 +
   44.42 +    private static final String noJavaLangSrc =
   44.43 +        "public class NoJavaLang {\n" +
   44.44 +        "    private String s;\n" +
   44.45 +        "\n" +
   44.46 +        "    public String s() {\n" +
   44.47 +        "        return s;\n" +
   44.48 +        "    }\n" +
   44.49 +        "}";
   44.50 +
   44.51 +    private static final String compilerErrorMessage =
   44.52 +        "Fatal Error: Unable to find package java.lang in classpath or bootclasspath";
   44.53 +
   44.54 +    public static void main(String[] args) throws Exception {
   44.55 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} NoJavaLang.java 2> "${TMP1}"
   44.56 +        ToolBox.JavaToolArgs javacSuccessArgs =
   44.57 +                new ToolBox.JavaToolArgs().setSources(noJavaLangSrc);
   44.58 +        ToolBox.javac(javacSuccessArgs);
   44.59 +
   44.60 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -bootclasspath . NoJavaLang.java 2> "${TMP1}"
   44.61 +        List<String> output = new ArrayList<>();
   44.62 +        ToolBox.JavaToolArgs javacFailArgs =
   44.63 +                new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
   44.64 +                .setOptions("-bootclasspath", ".")
   44.65 +                .setSources(noJavaLangSrc)
   44.66 +                .setErrOutput(output);
   44.67 +
   44.68 +        int cr = ToolBox.javac(javacFailArgs);
   44.69 +        if (cr != 3) {
   44.70 +            throw new AssertionError("Compiler exit result should be 3");
   44.71 +        }
   44.72 +
   44.73 +//        diff ${DIFFOPTS} -c "${TESTSRC}${FS}NoJavaLang.out" "${TMP1}"
   44.74 +        if (!(output.size() == 1 && output.get(0).equals(compilerErrorMessage))) {
   44.75 +            throw new AssertionError("javac generated error output is not correct");
   44.76 +        }
   44.77 +    }
   44.78 +
   44.79 +}
    45.1 --- a/test/tools/javac/innerClassFile/Driver.sh	Tue Feb 19 00:31:45 2013 -0800
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,73 +0,0 @@
    45.4 -#!/bin/sh
    45.5 -
    45.6 -#
    45.7 -# Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
    45.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.9 -#
   45.10 -# This code is free software; you can redistribute it and/or modify it
   45.11 -# under the terms of the GNU General Public License version 2 only, as
   45.12 -# published by the Free Software Foundation.
   45.13 -#
   45.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   45.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   45.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   45.17 -# version 2 for more details (a copy is included in the LICENSE file that
   45.18 -# accompanied this code).
   45.19 -#
   45.20 -# You should have received a copy of the GNU General Public License version
   45.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   45.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   45.23 -#
   45.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   45.25 -# or visit www.oracle.com if you need additional information or have any
   45.26 -# questions.
   45.27 -#
   45.28 -
   45.29 -# @test
   45.30 -# @bug 4491755 4785453
   45.31 -# @summary Prob w/static inner class with same name as a regular class
   45.32 -# @author gafter
   45.33 -#
   45.34 -# @run shell Driver.sh
   45.35 -
   45.36 -if [ "${TESTSRC}" = "" ]
   45.37 -then
   45.38 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   45.39 -  exit 1
   45.40 -fi
   45.41 -echo "TESTSRC=${TESTSRC}"
   45.42 -if [ "${TESTJAVA}" = "" ]
   45.43 -then
   45.44 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   45.45 -  exit 1
   45.46 -fi
   45.47 -echo "TESTJAVA=${TESTJAVA}"
   45.48 -if [ "${TESTCLASSES}" = "" ]
   45.49 -then
   45.50 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   45.51 -  exit 1
   45.52 -fi
   45.53 -echo "TESTCLASSES=${TESTCLASSES}"
   45.54 -echo "CLASSPATH=${CLASSPATH}"
   45.55 -
   45.56 -# set platform-dependent variables
   45.57 -OS=`uname -s`
   45.58 -case "$OS" in
   45.59 -  SunOS | Linux | Darwin | CYGWIN* )
   45.60 -    FS="/"
   45.61 -    ;;
   45.62 -  Windows* )
   45.63 -    FS="\\"
   45.64 -    ;;
   45.65 -  * )
   45.66 -    echo "Unrecognized system!"
   45.67 -    exit 1;
   45.68 -    ;;
   45.69 -esac
   45.70 -
   45.71 -set -x
   45.72 -mkdir src
   45.73 -cp -r ${TESTSRC}${FS}* src
   45.74 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath . -sourcepath src src/x/B.java src/x/C.java src/y/Main.java
   45.75 -rm y/R3.class
   45.76 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath . -sourcepath src src/y/Main.java
    46.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.2 +++ b/test/tools/javac/innerClassFile/InnerClassFileTest.java	Tue Feb 19 17:53:16 2013 +0000
    46.3 @@ -0,0 +1,127 @@
    46.4 +/*
    46.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    46.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.7 + *
    46.8 + * This code is free software; you can redistribute it and/or modify it
    46.9 + * under the terms of the GNU General Public License version 2 only, as
   46.10 + * published by the Free Software Foundation.
   46.11 + *
   46.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   46.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   46.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   46.15 + * version 2 for more details (a copy is included in the LICENSE file that
   46.16 + * accompanied this code).
   46.17 + *
   46.18 + * You should have received a copy of the GNU General Public License version
   46.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   46.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   46.21 + *
   46.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   46.23 + * or visit www.oracle.com if you need additional information or have any
   46.24 + * questions.
   46.25 + */
   46.26 +
   46.27 +/*
   46.28 + * @test
   46.29 + * @bug 4491755 4785453
   46.30 + * @summary Prob w/static inner class with same name as a regular class
   46.31 + * @library /tools/javac/lib
   46.32 + * @build ToolBox
   46.33 + * @run main InnerClassFileTest
   46.34 + */
   46.35 +
   46.36 +import java.nio.file.Paths;
   46.37 +
   46.38 +//original test: test/tools/javac/innerClassFile/Driver.sh
   46.39 +public class InnerClassFileTest {
   46.40 +
   46.41 +    private static final String BSrc =
   46.42 +        "package x;\n" +
   46.43 +        "\n" +
   46.44 +        "import x.*;\n" +
   46.45 +        "\n" +
   46.46 +        "public class B {\n" +
   46.47 +        "    public static class C {}\n" +
   46.48 +        "}";
   46.49 +
   46.50 +    private static final String CSrc =
   46.51 +        "package x;\n" +
   46.52 +        "\n" +
   46.53 +        "import x.*;\n" +
   46.54 +        "\n" +
   46.55 +        "public class C {}";
   46.56 +
   46.57 +    private static final String MainSrc =
   46.58 +        "package y;\n" +
   46.59 +        "\n" +
   46.60 +        "class Main {\n" +
   46.61 +        "        private R1 a;\n" +
   46.62 +        "        private R2 b;\n" +
   46.63 +        "        private R3 c;\n" +
   46.64 +        "}";
   46.65 +
   46.66 +    private static final String R1Src =
   46.67 +        "package y;\n" +
   46.68 +        "\n" +
   46.69 +        "public final class R1 {\n" +
   46.70 +        "    x.B.C a = null;\n" +
   46.71 +        "    x.C b = null;\n" +
   46.72 +        "    R2 c = new R2();\n" +
   46.73 +        "}";
   46.74 +
   46.75 +    private static final String R2Src =
   46.76 +        "package y;\n" +
   46.77 +        "\n" +
   46.78 +        "public final class R2 {\n" +
   46.79 +        "    x.B.C a = null;\n" +
   46.80 +        "    x.C b = null;\n" +
   46.81 +        "}";
   46.82 +
   46.83 +    private static final String R3Src =
   46.84 +        "package y;\n" +
   46.85 +        "\n" +
   46.86 +        "public final class R3 {\n" +
   46.87 +        "    x.B.C a = null;\n" +
   46.88 +        "    x.C b = null;\n" +
   46.89 +        "    R1 c = new R1();\n" +
   46.90 +        "}";
   46.91 +
   46.92 +    public static void main(String args[]) throws Exception {
   46.93 +        new InnerClassFileTest().run();
   46.94 +    }
   46.95 +
   46.96 +    void run() throws Exception {
   46.97 +        createFiles();
   46.98 +        compileFiles();
   46.99 +    }
  46.100 +
  46.101 +    void createFiles() throws Exception {
  46.102 +//        mkdir src
  46.103 +//        cp -r ${TESTSRC}${FS}* src
  46.104 +        ToolBox.createJavaFileFromSource(Paths.get("src"), BSrc);
  46.105 +        ToolBox.createJavaFileFromSource(Paths.get("src"), CSrc);
  46.106 +        ToolBox.createJavaFileFromSource(Paths.get("src"), MainSrc);
  46.107 +        ToolBox.createJavaFileFromSource(Paths.get("src"), R1Src);
  46.108 +        ToolBox.createJavaFileFromSource(Paths.get("src"), R2Src);
  46.109 +        ToolBox.createJavaFileFromSource(Paths.get("src"), R3Src);
  46.110 +    }
  46.111 +
  46.112 +    void compileFiles() throws Exception {
  46.113 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath .
  46.114 +//              -sourcepath src src/x/B.java src/x/C.java src/y/Main.java
  46.115 +        ToolBox.JavaToolArgs args =
  46.116 +                new ToolBox.JavaToolArgs()
  46.117 +                .setAllArgs("-d", ".", "-cp" , ".", "-sourcepath", "src",
  46.118 +                "src/x/B.java", "src/x/C.java", "src/y/Main.java");
  46.119 +        ToolBox.javac(args);
  46.120 +
  46.121 +//        rm y/R3.class
  46.122 +        ToolBox.rm(Paths.get("y", "R3.class"));
  46.123 +
  46.124 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath .
  46.125 +//                -sourcepath src src/y/Main.java
  46.126 +        args.setAllArgs("-d", ".", "-cp", ".", "-sourcepath", "src", "src/y/Main.java");
  46.127 +        ToolBox.javac(args);
  46.128 +    }
  46.129 +
  46.130 +}
    47.1 --- a/test/tools/javac/innerClassFile/x/B.java	Tue Feb 19 00:31:45 2013 -0800
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,30 +0,0 @@
    47.4 -/*
    47.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    47.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.7 - *
    47.8 - * This code is free software; you can redistribute it and/or modify it
    47.9 - * under the terms of the GNU General Public License version 2 only, as
   47.10 - * published by the Free Software Foundation.
   47.11 - *
   47.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   47.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   47.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   47.15 - * version 2 for more details (a copy is included in the LICENSE file that
   47.16 - * accompanied this code).
   47.17 - *
   47.18 - * You should have received a copy of the GNU General Public License version
   47.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   47.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   47.21 - *
   47.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   47.23 - * or visit www.oracle.com if you need additional information or have any
   47.24 - * questions.
   47.25 - */
   47.26 -
   47.27 -package x;
   47.28 -
   47.29 -import x.*;
   47.30 -
   47.31 -public class B {
   47.32 -    public static class C {}
   47.33 -}
    48.1 --- a/test/tools/javac/innerClassFile/x/C.java	Tue Feb 19 00:31:45 2013 -0800
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,28 +0,0 @@
    48.4 -/*
    48.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    48.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.7 - *
    48.8 - * This code is free software; you can redistribute it and/or modify it
    48.9 - * under the terms of the GNU General Public License version 2 only, as
   48.10 - * published by the Free Software Foundation.
   48.11 - *
   48.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   48.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   48.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   48.15 - * version 2 for more details (a copy is included in the LICENSE file that
   48.16 - * accompanied this code).
   48.17 - *
   48.18 - * You should have received a copy of the GNU General Public License version
   48.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   48.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   48.21 - *
   48.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   48.23 - * or visit www.oracle.com if you need additional information or have any
   48.24 - * questions.
   48.25 - */
   48.26 -
   48.27 -package x;
   48.28 -
   48.29 -import x.*;
   48.30 -
   48.31 -public class C {}
    49.1 --- a/test/tools/javac/innerClassFile/y/Main.java	Tue Feb 19 00:31:45 2013 -0800
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,30 +0,0 @@
    49.4 -/*
    49.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    49.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.7 - *
    49.8 - * This code is free software; you can redistribute it and/or modify it
    49.9 - * under the terms of the GNU General Public License version 2 only, as
   49.10 - * published by the Free Software Foundation.
   49.11 - *
   49.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   49.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   49.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   49.15 - * version 2 for more details (a copy is included in the LICENSE file that
   49.16 - * accompanied this code).
   49.17 - *
   49.18 - * You should have received a copy of the GNU General Public License version
   49.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   49.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   49.21 - *
   49.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   49.23 - * or visit www.oracle.com if you need additional information or have any
   49.24 - * questions.
   49.25 - */
   49.26 -
   49.27 -package y;
   49.28 -
   49.29 -class Main {
   49.30 -        private R1 a;
   49.31 -        private R2 b;
   49.32 -        private R3 c;
   49.33 -}
    50.1 --- a/test/tools/javac/innerClassFile/y/R1.java	Tue Feb 19 00:31:45 2013 -0800
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,30 +0,0 @@
    50.4 -/*
    50.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    50.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 - *
    50.8 - * This code is free software; you can redistribute it and/or modify it
    50.9 - * under the terms of the GNU General Public License version 2 only, as
   50.10 - * published by the Free Software Foundation.
   50.11 - *
   50.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   50.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.15 - * version 2 for more details (a copy is included in the LICENSE file that
   50.16 - * accompanied this code).
   50.17 - *
   50.18 - * You should have received a copy of the GNU General Public License version
   50.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   50.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.21 - *
   50.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   50.23 - * or visit www.oracle.com if you need additional information or have any
   50.24 - * questions.
   50.25 - */
   50.26 -
   50.27 -package y;
   50.28 -
   50.29 -public final class R1 {
   50.30 -    x.B.C a = null;
   50.31 -    x.C b = null;
   50.32 -    R2 c = new R2();
   50.33 -}
    51.1 --- a/test/tools/javac/innerClassFile/y/R2.java	Tue Feb 19 00:31:45 2013 -0800
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,29 +0,0 @@
    51.4 -/*
    51.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    51.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    51.7 - *
    51.8 - * This code is free software; you can redistribute it and/or modify it
    51.9 - * under the terms of the GNU General Public License version 2 only, as
   51.10 - * published by the Free Software Foundation.
   51.11 - *
   51.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   51.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   51.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   51.15 - * version 2 for more details (a copy is included in the LICENSE file that
   51.16 - * accompanied this code).
   51.17 - *
   51.18 - * You should have received a copy of the GNU General Public License version
   51.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   51.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   51.21 - *
   51.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   51.23 - * or visit www.oracle.com if you need additional information or have any
   51.24 - * questions.
   51.25 - */
   51.26 -
   51.27 -package y;
   51.28 -
   51.29 -public final class R2 {
   51.30 -    x.B.C a = null;
   51.31 -    x.C b = null;
   51.32 -}
    52.1 --- a/test/tools/javac/innerClassFile/y/R3.java	Tue Feb 19 00:31:45 2013 -0800
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,30 +0,0 @@
    52.4 -/*
    52.5 - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
    52.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.7 - *
    52.8 - * This code is free software; you can redistribute it and/or modify it
    52.9 - * under the terms of the GNU General Public License version 2 only, as
   52.10 - * published by the Free Software Foundation.
   52.11 - *
   52.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   52.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   52.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   52.15 - * version 2 for more details (a copy is included in the LICENSE file that
   52.16 - * accompanied this code).
   52.17 - *
   52.18 - * You should have received a copy of the GNU General Public License version
   52.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   52.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   52.21 - *
   52.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   52.23 - * or visit www.oracle.com if you need additional information or have any
   52.24 - * questions.
   52.25 - */
   52.26 -
   52.27 -package y;
   52.28 -
   52.29 -public final class R3 {
   52.30 -    x.B.C a = null;
   52.31 -    x.C b = null;
   52.32 -    R1 c = new R1();
   52.33 -}
    53.1 --- a/test/tools/javac/javazip/A.java	Tue Feb 19 00:31:45 2013 -0800
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,27 +0,0 @@
    53.4 -/*
    53.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
    53.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.7 - *
    53.8 - * This code is free software; you can redistribute it and/or modify it
    53.9 - * under the terms of the GNU General Public License version 2 only, as
   53.10 - * published by the Free Software Foundation.
   53.11 - *
   53.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   53.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.15 - * version 2 for more details (a copy is included in the LICENSE file that
   53.16 - * accompanied this code).
   53.17 - *
   53.18 - * You should have received a copy of the GNU General Public License version
   53.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   53.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.21 - *
   53.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   53.23 - * or visit www.oracle.com if you need additional information or have any
   53.24 - * questions.
   53.25 - */
   53.26 -
   53.27 -// A class that references another
   53.28 -class A {
   53.29 -    B b;
   53.30 -}
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/test/tools/javac/javazip/JavaZipTest.java	Tue Feb 19 17:53:16 2013 +0000
    54.3 @@ -0,0 +1,126 @@
    54.4 +/*
    54.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    54.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.7 + *
    54.8 + * This code is free software; you can redistribute it and/or modify it
    54.9 + * under the terms of the GNU General Public License version 2 only, as
   54.10 + * published by the Free Software Foundation.
   54.11 + *
   54.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   54.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   54.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   54.15 + * version 2 for more details (a copy is included in the LICENSE file that
   54.16 + * accompanied this code).
   54.17 + *
   54.18 + * You should have received a copy of the GNU General Public License version
   54.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   54.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   54.21 + *
   54.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   54.23 + * or visit www.oracle.com if you need additional information or have any
   54.24 + * questions.
   54.25 + */
   54.26 +
   54.27 +/*
   54.28 + * @test
   54.29 + * @bug 4098712 6304984 6388453
   54.30 + * @summary check that source files inside zip files on the class path are ignored
   54.31 + * @library /tools/javac/lib
   54.32 + * @build ToolBox
   54.33 + * @run main JavaZipTest
   54.34 + */
   54.35 +
   54.36 +import java.io.File;
   54.37 +import java.nio.file.Paths;
   54.38 +
   54.39 +//original test: test/tools/javac/javazip/Test.sh
   54.40 +public class JavaZipTest {
   54.41 +
   54.42 +    private static final String ASrc =
   54.43 +        "class A {\n" +
   54.44 +        "    B b;\n" +
   54.45 +        "}";
   54.46 +
   54.47 +    private static final String BGoodSrc =
   54.48 +        "public class B {}";
   54.49 +
   54.50 +    private static final String BBadSrc =
   54.51 +        "class B";
   54.52 +
   54.53 +    private static final String[][] jarArgs = {
   54.54 +        {"cf", "good.jar", "-C", "good", "B.java"},
   54.55 +        {"cf", "good.zip", "-C", "good", "B.java"},
   54.56 +        {"cf", "bad.jar", "-C", "bad", "B.java"},
   54.57 +        {"cf", "bad.zip", "-C", "bad", "B.java"},
   54.58 +    };
   54.59 +
   54.60 +    private static final String[][] successfulCompilationArgs = {
   54.61 +        {"-d", "output", "A.java", "good/B.java"},
   54.62 +        {"-d", "output", "-cp", "good", "A.java"},
   54.63 +        {"-d", "output", "-sourcepath", "good", "A.java"},
   54.64 +        {"-d", "output", "-cp", "good.zip", "A.java"},
   54.65 +        {"-d", "output", "-cp", "good.jar", "A.java"},
   54.66 +    };
   54.67 +
   54.68 +    private static final String[][] unSuccessfulCompilationArgs = {
   54.69 +        {"-d", "output", "A.java", "bad/B.java"},
   54.70 +        {"-d", "output", "-cp", "bad", "A.java"},
   54.71 +        {"-d", "output", "-sourcepath", "bad", "A.java"},
   54.72 +        {"-d", "output", "-sourcepath", "bad.zip", "A.java"},
   54.73 +        {"-d", "output", "-sourcepath", "bad.jar", "A.java"},
   54.74 +    };
   54.75 +
   54.76 +    public static void main(String[] args) throws Exception {
   54.77 +        new JavaZipTest().test();
   54.78 +    }
   54.79 +
   54.80 +    public void test() throws Exception {
   54.81 +        createOutputDirAndSourceFiles();
   54.82 +        createZipsAndJars();
   54.83 +        check(ToolBox.Expect.SUCCESS, successfulCompilationArgs);
   54.84 +        check(ToolBox.Expect.FAIL, unSuccessfulCompilationArgs);
   54.85 +    }
   54.86 +
   54.87 +    void createOutputDirAndSourceFiles() throws Exception {
   54.88 +        //create output dir
   54.89 +        new File("output").mkdir();
   54.90 +
   54.91 +        //source file creation
   54.92 +        ToolBox.createJavaFileFromSource(Paths.get("good"), BGoodSrc);
   54.93 +        ToolBox.createJavaFileFromSource(Paths.get("bad"), BBadSrc);
   54.94 +        ToolBox.createJavaFileFromSource(ASrc);
   54.95 +    }
   54.96 +
   54.97 +    void createZipsAndJars() throws Exception {
   54.98 +        //jar and zip creation
   54.99 +//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.jar" -C "${TESTSRC}${FS}good" B.java
  54.100 +//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.zip" -C "${TESTSRC}${FS}good" B.java
  54.101 +//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.jar"  -C "${TESTSRC}${FS}bad" B.java
  54.102 +//        check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.zip"  -C "${TESTSRC}${FS}bad" B.java
  54.103 +        for (String[] args: jarArgs) {
  54.104 +            ToolBox.jar(args);
  54.105 +        }
  54.106 +    }
  54.107 +
  54.108 +    void check(ToolBox.Expect whatToExpect, String[][] theArgs) throws Exception {
  54.109 +//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}good${FS}B.java"
  54.110 +//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}good"   "${TESTSRC}${FS}A.java"
  54.111 +//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}good"  "${TESTSRC}${FS}A.java"
  54.112 +//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.zip"   "${TESTSRC}${FS}A.java"
  54.113 +//        check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.jar"   "${TESTSRC}${FS}A.java"
  54.114 +
  54.115 +//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}bad${FS}B.java"
  54.116 +//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}bad"    "${TESTSRC}${FS}A.java"
  54.117 +//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}bad"   "${TESTSRC}${FS}A.java"
  54.118 +//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.zip"   "${TESTSRC}${FS}A.java"
  54.119 +//        check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.jar"   "${TESTSRC}${FS}A.java"
  54.120 +        ToolBox.JavaToolArgs args =
  54.121 +                new ToolBox.JavaToolArgs(whatToExpect);
  54.122 +
  54.123 +        for (String[] allArgs: theArgs) {
  54.124 +            args.setAllArgs(allArgs);
  54.125 +            ToolBox.javac(args);
  54.126 +        }
  54.127 +    }
  54.128 +
  54.129 +}
    55.1 --- a/test/tools/javac/javazip/Test.sh	Tue Feb 19 00:31:45 2013 -0800
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,111 +0,0 @@
    55.4 -#! /bin/sh -f
    55.5 -
    55.6 -#
    55.7 -# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    55.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.9 -#
   55.10 -# This code is free software; you can redistribute it and/or modify it
   55.11 -# under the terms of the GNU General Public License version 2 only, as
   55.12 -# published by the Free Software Foundation.
   55.13 -#
   55.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   55.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.17 -# version 2 for more details (a copy is included in the LICENSE file that
   55.18 -# accompanied this code).
   55.19 -#
   55.20 -# You should have received a copy of the GNU General Public License version
   55.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   55.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.23 -#
   55.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   55.25 -# or visit www.oracle.com if you need additional information or have any
   55.26 -# questions.
   55.27 -#
   55.28 -
   55.29 -# @test
   55.30 -# @bug 4098712 6304984 6388453
   55.31 -# @summary check that source files inside zip files on the class path are ignored
   55.32 -# @run shell Test.sh
   55.33 -
   55.34 -TS=${TESTSRC-.}
   55.35 -TC=${TESTCLASSES-.}
   55.36 -SCR=`pwd`
   55.37 -
   55.38 -if [ "${TESTJAVA}" = "" ]
   55.39 -then
   55.40 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   55.41 -  exit 1
   55.42 -fi
   55.43 -
   55.44 -# set platform-dependent variables
   55.45 -OS=`uname -s`
   55.46 -case "$OS" in
   55.47 -  SunOS | Linux | Darwin )
   55.48 -    FS="/"
   55.49 -    SCR=`pwd`
   55.50 -    ;;
   55.51 -  CYGWIN* )
   55.52 -    FS="/"
   55.53 -    SCR=`pwd | cygpath -d -f -`
   55.54 -    ;;
   55.55 -  Windows* )
   55.56 -    FS="\\"
   55.57 -    SCR=`pwd`
   55.58 -    ;;
   55.59 -  * )
   55.60 -    echo "Unrecognized system!"
   55.61 -    exit 1;
   55.62 -    ;;
   55.63 -esac
   55.64 -
   55.65 -check() {
   55.66 -    expected=$1
   55.67 -    shift
   55.68 -
   55.69 -    # clean old classes
   55.70 -    rm -f ${TC}${FS}*.class 
   55.71 -
   55.72 -    echo "$@"
   55.73 -    if "$@" 2>&1 ; then
   55.74 -      actual=ok
   55.75 -    else
   55.76 -      actual=err
   55.77 -    fi
   55.78 -    if [ "$actual" != "$expected" ]; then
   55.79 -      case "$actual" in
   55.80 -        ok  ) echo "error: unexpected result: command succeeded" ;;
   55.81 -        err ) echo "error: unexpected result: command failed"
   55.82 -      esac
   55.83 -      exit 1
   55.84 -    else 
   55.85 -      case "$actual" in
   55.86 -        ok  ) echo "command succeeded as expected" ;;
   55.87 -        err ) echo "command failed as expected."
   55.88 -      esac
   55.89 -    fi
   55.90 -
   55.91 -    echo 
   55.92 -}
   55.93 -
   55.94 -echo "# create zip/jar files with source code"
   55.95 -check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.jar" -C "${TESTSRC}${FS}good" B.java
   55.96 -check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}good.zip" -C "${TESTSRC}${FS}good" B.java
   55.97 -check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.jar"  -C "${TESTSRC}${FS}bad" B.java
   55.98 -check ok   "${TESTJAVA}${FS}bin${FS}jar" cf "${SCR}${FS}bad.zip"  -C "${TESTSRC}${FS}bad" B.java
   55.99 -
  55.100 -echo "# control tests, with no paths"
  55.101 -check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}good${FS}B.java"
  55.102 -check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} "${TESTSRC}${FS}A.java" "${TESTSRC}${FS}bad${FS}B.java"
  55.103 -
  55.104 -echo "# test that source files are found in directories on path"
  55.105 -check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}good"   "${TESTSRC}${FS}A.java"
  55.106 -check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}good"  "${TESTSRC}${FS}A.java"
  55.107 -check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${TESTSRC}${FS}bad"    "${TESTSRC}${FS}A.java"
  55.108 -check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${TESTSRC}${FS}bad"   "${TESTSRC}${FS}A.java"
  55.109 -
  55.110 -echo "# test that source files are found in zip/jar files on path"
  55.111 -check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.zip"   "${TESTSRC}${FS}A.java"
  55.112 -check ok   "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -classpath "${SCR}${FS}good.jar"   "${TESTSRC}${FS}A.java"
  55.113 -check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.zip"   "${TESTSRC}${FS}A.java"  
  55.114 -check err  "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d ${TC} -sourcepath "${SCR}${FS}bad.jar"   "${TESTSRC}${FS}A.java" 
    56.1 --- a/test/tools/javac/javazip/bad/B.java	Tue Feb 19 00:31:45 2013 -0800
    56.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.3 @@ -1,25 +0,0 @@
    56.4 -/*
    56.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
    56.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.7 - *
    56.8 - * This code is free software; you can redistribute it and/or modify it
    56.9 - * under the terms of the GNU General Public License version 2 only, as
   56.10 - * published by the Free Software Foundation.
   56.11 - *
   56.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   56.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   56.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   56.15 - * version 2 for more details (a copy is included in the LICENSE file that
   56.16 - * accompanied this code).
   56.17 - *
   56.18 - * You should have received a copy of the GNU General Public License version
   56.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   56.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   56.21 - *
   56.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   56.23 - * or visit www.oracle.com if you need additional information or have any
   56.24 - * questions.
   56.25 - */
   56.26 -
   56.27 -// this class is invalid
   56.28 -class B
    57.1 --- a/test/tools/javac/javazip/good/B.java	Tue Feb 19 00:31:45 2013 -0800
    57.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.3 @@ -1,26 +0,0 @@
    57.4 -/*
    57.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
    57.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.7 - *
    57.8 - * This code is free software; you can redistribute it and/or modify it
    57.9 - * under the terms of the GNU General Public License version 2 only, as
   57.10 - * published by the Free Software Foundation.
   57.11 - *
   57.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   57.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   57.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   57.15 - * version 2 for more details (a copy is included in the LICENSE file that
   57.16 - * accompanied this code).
   57.17 - *
   57.18 - * You should have received a copy of the GNU General Public License version
   57.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   57.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   57.21 - *
   57.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   57.23 - * or visit www.oracle.com if you need additional information or have any
   57.24 - * questions.
   57.25 - */
   57.26 -
   57.27 -// this is a valid class
   57.28 -public class B {
   57.29 -}
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/tools/javac/lib/ToolBox.java	Tue Feb 19 17:53:16 2013 +0000
    58.3 @@ -0,0 +1,911 @@
    58.4 +/*
    58.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.7 + *
    58.8 + * This code is free software; you can redistribute it and/or modify it
    58.9 + * under the terms of the GNU General Public License version 2 only, as
   58.10 + * published by the Free Software Foundation.
   58.11 + *
   58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   58.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   58.15 + * version 2 for more details (a copy is included in the LICENSE file that
   58.16 + * accompanied this code).
   58.17 + *
   58.18 + * You should have received a copy of the GNU General Public License version
   58.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   58.21 + *
   58.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   58.23 + * or visit www.oracle.com if you need additional information or have any
   58.24 + * questions.
   58.25 + */
   58.26 +
   58.27 +import java.io.BufferedReader;
   58.28 +import java.io.File;
   58.29 +import java.io.FileNotFoundException;
   58.30 +import java.io.FileWriter;
   58.31 +import java.io.IOException;
   58.32 +import java.io.InputStreamReader;
   58.33 +import java.io.PrintWriter;
   58.34 +import java.io.StringWriter;
   58.35 +import java.net.URI;
   58.36 +import java.nio.charset.Charset;
   58.37 +import java.nio.file.Files;
   58.38 +import java.nio.file.Path;
   58.39 +import java.nio.file.Paths;
   58.40 +import java.nio.file.StandardOpenOption;
   58.41 +import java.util.ArrayList;
   58.42 +import java.util.Arrays;
   58.43 +import java.util.Collection;
   58.44 +import java.util.EnumSet;
   58.45 +import java.util.List;
   58.46 +import java.util.Map;
   58.47 +import java.util.Set;
   58.48 +import java.util.regex.Matcher;
   58.49 +import java.util.regex.Pattern;
   58.50 +
   58.51 +import javax.tools.JavaCompiler;
   58.52 +import javax.tools.JavaFileObject;
   58.53 +import javax.tools.SimpleJavaFileObject;
   58.54 +import javax.tools.ToolProvider;
   58.55 +
   58.56 +import com.sun.source.util.JavacTask;
   58.57 +import com.sun.tools.javac.api.JavacTaskImpl;
   58.58 +
   58.59 +import sun.tools.jar.Main;
   58.60 +
   58.61 +import static java.nio.file.StandardCopyOption.*;
   58.62 +
   58.63 +/**
   58.64 + * Toolbox for jtreg tests.
   58.65 + */
   58.66 +
   58.67 +public class ToolBox {
   58.68 +
   58.69 +    public static final String lineSeparator = System.getProperty("line.separator");
   58.70 +    public static final String jdkUnderTest = System.getProperty("test.jdk");
   58.71 +    public static final String testVMOpts = System.getProperty("test.tool.vm.opts");
   58.72 +    public static final String javaBinary = Paths.get(jdkUnderTest, "bin", "java").toString();
   58.73 +    //why this one private. Because the function which provide also the test options should be used
   58.74 +    private static final String javacBinary = Paths.get(jdkUnderTest, "bin", "javac").toString();
   58.75 +
   58.76 +    private static final Charset defaultCharset = Charset.defaultCharset();
   58.77 +
   58.78 +    static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
   58.79 +
   58.80 +    /**
   58.81 +     * The expected result of command-like method execution.
   58.82 +     */
   58.83 +    public enum Expect {SUCCESS, FAIL}
   58.84 +
   58.85 +    enum AcceptedParams {
   58.86 +        EXPECT,
   58.87 +        SOURCES,
   58.88 +        OPTIONS,
   58.89 +        STD_OUTPUT,
   58.90 +        ERR_OUTPUT,
   58.91 +        EXTRA_ENV,
   58.92 +    }
   58.93 +
   58.94 +    enum OutputKind {STD, ERR}
   58.95 +
   58.96 +    /**
   58.97 +     * Helper class to abstract the processing of command's output.
   58.98 +     */
   58.99 +    static abstract class WriterHelper {
  58.100 +        OutputKind kind;
  58.101 +        public abstract void pipeOutput(ProcessBuilder pb);
  58.102 +        public abstract void readFromStream(Process p) throws IOException;
  58.103 +        public abstract void addAll(Collection<? extends String> c) throws IOException;
  58.104 +    }
  58.105 +
  58.106 +    /**
  58.107 +     * Helper class for redirecting command's output to a file.
  58.108 +     */
  58.109 +    static class FileWriterHelper extends WriterHelper {
  58.110 +        File file;
  58.111 +
  58.112 +        FileWriterHelper(File file, OutputKind kind) {
  58.113 +            this.file = file;
  58.114 +            this.kind = kind;
  58.115 +        }
  58.116 +
  58.117 +        @Override
  58.118 +        public void pipeOutput(ProcessBuilder pb) {
  58.119 +            if (file != null) {
  58.120 +                switch (kind) {
  58.121 +                    case STD:
  58.122 +                        pb.redirectInput(file);
  58.123 +                        break;
  58.124 +                    case ERR:
  58.125 +                        pb.redirectError(file);
  58.126 +                        break;
  58.127 +                }
  58.128 +            }
  58.129 +        }
  58.130 +
  58.131 +        @Override
  58.132 +        public void readFromStream(Process p) throws IOException {}
  58.133 +
  58.134 +        @Override
  58.135 +        public void addAll(Collection<? extends String> c) throws IOException {
  58.136 +            if (file.exists())
  58.137 +                Files.write(file.toPath(), c, defaultCharset,
  58.138 +                        StandardOpenOption.WRITE, StandardOpenOption.APPEND);
  58.139 +            else
  58.140 +                Files.write(file.toPath(), c, defaultCharset);
  58.141 +        }
  58.142 +    }
  58.143 +
  58.144 +    /**
  58.145 +     * Helper class for redirecting command's output to a String list.
  58.146 +     */
  58.147 +    static class ListWriterHelper extends WriterHelper {
  58.148 +        List<String> list;
  58.149 +
  58.150 +        public ListWriterHelper(List<String> list, OutputKind kind) {
  58.151 +            this.kind = kind;
  58.152 +            this.list = list;
  58.153 +        }
  58.154 +
  58.155 +        @Override
  58.156 +        public void pipeOutput(ProcessBuilder pb) {}
  58.157 +
  58.158 +        @Override
  58.159 +        public void readFromStream(Process p) throws IOException {
  58.160 +            BufferedReader br = null;
  58.161 +            switch (kind) {
  58.162 +                case STD:
  58.163 +                    br = new BufferedReader(new InputStreamReader(p.getInputStream()));
  58.164 +                    break;
  58.165 +                case ERR:
  58.166 +                    br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
  58.167 +                    break;
  58.168 +            }
  58.169 +            String line;
  58.170 +            while ((line = br.readLine()) != null) {
  58.171 +                list.add(line);
  58.172 +            }
  58.173 +        }
  58.174 +
  58.175 +        public void addAll(Collection<? extends String> c) {
  58.176 +            list.addAll(c);
  58.177 +        }
  58.178 +    }
  58.179 +
  58.180 +    /**
  58.181 +     * Simple factory class for creating a WriterHelper instance.
  58.182 +     */
  58.183 +    static class WriterHelperFactory {
  58.184 +        static WriterHelper make(File file, OutputKind kind) {
  58.185 +            return new FileWriterHelper(file, kind);
  58.186 +        }
  58.187 +
  58.188 +        static WriterHelper make(List<String> list, OutputKind kind) {
  58.189 +            return new ListWriterHelper(list, kind);
  58.190 +        }
  58.191 +    }
  58.192 +
  58.193 +    /**
  58.194 +     * A generic class for holding command's arguments.
  58.195 +     */
  58.196 +    public static abstract class GenericArgs <T extends GenericArgs> {
  58.197 +        protected static List<Set<AcceptedParams>> minAcceptedParams;
  58.198 +
  58.199 +        protected Set<AcceptedParams> currentParams =
  58.200 +                EnumSet.<AcceptedParams>noneOf(AcceptedParams.class);
  58.201 +
  58.202 +        protected Expect whatToExpect;
  58.203 +        protected WriterHelper stdOutput;
  58.204 +        protected WriterHelper errOutput;
  58.205 +        protected List<String> options;
  58.206 +        protected String[] optionsArr;
  58.207 +
  58.208 +        protected GenericArgs() {
  58.209 +            set(Expect.SUCCESS);
  58.210 +        }
  58.211 +
  58.212 +        public T set(Expect whatToExpt) {
  58.213 +            currentParams.add(AcceptedParams.EXPECT);
  58.214 +            this.whatToExpect = whatToExpt;
  58.215 +            return (T)this;
  58.216 +        }
  58.217 +
  58.218 +        public T setStdOutput(List<String> stdOutput) {
  58.219 +            currentParams.add(AcceptedParams.STD_OUTPUT);
  58.220 +            this.stdOutput = WriterHelperFactory.make(stdOutput, OutputKind.STD);
  58.221 +            return (T)this;
  58.222 +        }
  58.223 +
  58.224 +        public T setStdOutput(File output) {
  58.225 +            currentParams.add(AcceptedParams.STD_OUTPUT);
  58.226 +            this.stdOutput = WriterHelperFactory.make(output, OutputKind.STD);
  58.227 +            return (T)this;
  58.228 +        }
  58.229 +
  58.230 +        public T setErrOutput(List<String> errOutput) {
  58.231 +            currentParams.add(AcceptedParams.ERR_OUTPUT);
  58.232 +            this.errOutput = WriterHelperFactory.make(errOutput, OutputKind.ERR);
  58.233 +            return (T)this;
  58.234 +        }
  58.235 +
  58.236 +        public T setErrOutput(File errOutput) {
  58.237 +            currentParams.add(AcceptedParams.ERR_OUTPUT);
  58.238 +            this.errOutput = WriterHelperFactory.make(errOutput, OutputKind.ERR);
  58.239 +            return (T)this;
  58.240 +        }
  58.241 +
  58.242 +        public T setAllArgs(String... args) {
  58.243 +            currentParams.add(AcceptedParams.OPTIONS);
  58.244 +            this.optionsArr = args;
  58.245 +            return (T)this;
  58.246 +        }
  58.247 +
  58.248 +        public T setOptions(List<String> options) {
  58.249 +            currentParams.add(AcceptedParams.OPTIONS);
  58.250 +            this.options = options;
  58.251 +            return (T)this;
  58.252 +        }
  58.253 +
  58.254 +        public T setOptions(String... options) {
  58.255 +            currentParams.add(AcceptedParams.OPTIONS);
  58.256 +            this.options = Arrays.asList(options);
  58.257 +            return (T)this;
  58.258 +        }
  58.259 +
  58.260 +        public boolean hasMinParams() {
  58.261 +            for (Set<AcceptedParams> minSet : minAcceptedParams) {
  58.262 +                if (currentParams.containsAll(minSet)) {
  58.263 +                    return true;
  58.264 +                }
  58.265 +            }
  58.266 +            return false;
  58.267 +        }
  58.268 +    }
  58.269 +
  58.270 +    /**
  58.271 +     * A more specific class for holding javac-like command's arguments.
  58.272 +     */
  58.273 +    public static class JavaToolArgs extends GenericArgs<JavaToolArgs> {
  58.274 +
  58.275 +        static {
  58.276 +            minAcceptedParams = new ArrayList<>();
  58.277 +            minAcceptedParams.add(EnumSet.<AcceptedParams>of(
  58.278 +                    AcceptedParams.EXPECT, AcceptedParams.OPTIONS));
  58.279 +            minAcceptedParams.add(EnumSet.<AcceptedParams>of(
  58.280 +                    AcceptedParams.EXPECT, AcceptedParams.SOURCES));
  58.281 +        }
  58.282 +
  58.283 +        protected List<? extends JavaFileObject> sources;
  58.284 +
  58.285 +        public JavaToolArgs() {
  58.286 +            super();
  58.287 +        }
  58.288 +
  58.289 +        public JavaToolArgs(Expect whatToExpt) {
  58.290 +            super.set(whatToExpt);
  58.291 +        }
  58.292 +
  58.293 +        public JavaToolArgs setSources(List<? extends JavaFileObject> sources) {
  58.294 +            currentParams.add(AcceptedParams.SOURCES);
  58.295 +            this.sources = sources;
  58.296 +            return this;
  58.297 +        }
  58.298 +
  58.299 +        public JavaToolArgs setSources(JavaSource... sources) {
  58.300 +            return setSources(Arrays.asList(sources));
  58.301 +        }
  58.302 +
  58.303 +        public JavaToolArgs setSources(String... sources) {
  58.304 +            List<JavaSource> javaSrcs = new ArrayList<>();
  58.305 +            for (String source : sources) {
  58.306 +                javaSrcs.add(new JavaSource(source));
  58.307 +            }
  58.308 +            return setSources(javaSrcs);
  58.309 +        }
  58.310 +    }
  58.311 +
  58.312 +    /**
  58.313 +     * A more specific class for holding any command's arguments.
  58.314 +     */
  58.315 +    public static class AnyToolArgs extends GenericArgs<AnyToolArgs> {
  58.316 +
  58.317 +        static {
  58.318 +            minAcceptedParams = new ArrayList<>();
  58.319 +            minAcceptedParams.add(EnumSet.<AcceptedParams>of(
  58.320 +                    AcceptedParams.EXPECT, AcceptedParams.OPTIONS));
  58.321 +        }
  58.322 +
  58.323 +        Map<String, String> extraEnv;
  58.324 +
  58.325 +        public AnyToolArgs() {
  58.326 +            super();
  58.327 +        }
  58.328 +
  58.329 +        public AnyToolArgs(Expect whatToExpt) {
  58.330 +            set(whatToExpt);
  58.331 +        }
  58.332 +
  58.333 +        public AnyToolArgs set(Map<String, String> extraEnv) {
  58.334 +            currentParams.add(AcceptedParams.EXTRA_ENV);
  58.335 +            this.extraEnv = extraEnv;
  58.336 +            return this;
  58.337 +        }
  58.338 +    }
  58.339 +
  58.340 +    /**
  58.341 +     * Custom exception for bad command execution.
  58.342 +     */
  58.343 +    public static class CommandExecutionException extends Exception {
  58.344 +        CommandExecutionException(List<String> command, Expect whatToExpt) {
  58.345 +            super(createMessage(command, whatToExpt));
  58.346 +        }
  58.347 +
  58.348 +        CommandExecutionException(Expect whatToExpt, String... command) {
  58.349 +            this(Arrays.asList(command), whatToExpt);
  58.350 +        }
  58.351 +
  58.352 +        private static String createMessage(List<String> command, Expect whatToExpt) {
  58.353 +            StringBuilder sb = new StringBuilder().append("Command : ");
  58.354 +            sb.append(command.toString()).append(lineSeparator);
  58.355 +            switch (whatToExpt) {
  58.356 +                case SUCCESS:
  58.357 +                    sb.append("    has unexpectedly failed");
  58.358 +                    break;
  58.359 +                case FAIL:
  58.360 +                    sb.append("    has been unexpectedly successful");
  58.361 +                    break;
  58.362 +            }
  58.363 +            return sb.toString();
  58.364 +        }
  58.365 +    }
  58.366 +
  58.367 +    /**
  58.368 +     * Custom exception for not equal resources.
  58.369 +     */
  58.370 +    public static class ResourcesNotEqualException extends Exception {
  58.371 +        public ResourcesNotEqualException() {
  58.372 +            super("The resources provided for comparison are different");
  58.373 +        }
  58.374 +
  58.375 +        public ResourcesNotEqualException(Path path1, Path path2) {
  58.376 +            super(createMessage(path1, path2));
  58.377 +        }
  58.378 +
  58.379 +        private static String createMessage(Path path1, Path path2) {
  58.380 +            return new StringBuilder()
  58.381 +                    .append("The resources provided for comparison in paths \n")
  58.382 +                    .append(path1.toString()).append(" and \n")
  58.383 +                    .append(path2.toString()).append("are different").toString();
  58.384 +        }
  58.385 +    }
  58.386 +
  58.387 +    /**
  58.388 +     * Method to get the a path to the javac command available at the jdk being
  58.389 +     * tested along with the test vm options.
  58.390 +     * @return a String[] with the two components mentioned.
  58.391 +     */
  58.392 +    public static String[] getJavacBin() {
  58.393 +        return new String[]{javacBinary, testVMOpts};
  58.394 +    }
  58.395 +
  58.396 +    /**
  58.397 +     * A javac compiler caller method.
  58.398 +     */
  58.399 +    public static int javac(JavaToolArgs params)
  58.400 +            throws CommandExecutionException, IOException {
  58.401 +        if (params.hasMinParams()) {
  58.402 +            if (params.optionsArr != null) {
  58.403 +                return genericJavaCMD(JavaCMD.JAVAC, params);
  58.404 +            } else {
  58.405 +                return genericJavaCMD(JavaCMD.JAVAC_API, params);
  58.406 +            }
  58.407 +        }
  58.408 +        throw new AssertionError("javac command has been invoked with less parameters than needed");
  58.409 +    }
  58.410 +
  58.411 +    /**
  58.412 +     * A javap calling method.
  58.413 +     */
  58.414 +    public static String javap(JavaToolArgs params)
  58.415 +            throws CommandExecutionException, IOException {
  58.416 +        if (params.hasMinParams()) {
  58.417 +            List<String> list = new ArrayList<>();
  58.418 +            params.setErrOutput(list);
  58.419 +            genericJavaCMD(JavaCMD.JAVAP, params);
  58.420 +            return listToString(list);
  58.421 +        }
  58.422 +        throw new AssertionError("javap command has been invoked with less parameters than needed");
  58.423 +    }
  58.424 +
  58.425 +    /**
  58.426 +     * A javah calling method.
  58.427 +     */
  58.428 +    public static int javah(JavaToolArgs params)
  58.429 +            throws CommandExecutionException, IOException {
  58.430 +        if (params.hasMinParams()) {
  58.431 +            return genericJavaCMD(JavaCMD.JAVAH, params);
  58.432 +        }
  58.433 +        throw new AssertionError("javah command has been invoked with less parameters than needed");
  58.434 +    }
  58.435 +
  58.436 +    /**
  58.437 +     * A enum class for langtools commands.
  58.438 +     */
  58.439 +    enum JavaCMD {
  58.440 +        JAVAC {
  58.441 +            @Override
  58.442 +            int run(JavaToolArgs params, PrintWriter pw) {
  58.443 +                return com.sun.tools.javac.Main.compile(params.optionsArr, pw);
  58.444 +            }
  58.445 +        },
  58.446 +        JAVAC_API {
  58.447 +            @Override
  58.448 +            int run(JavaToolArgs params, PrintWriter pw) {
  58.449 +                JavacTask ct = (JavacTask)comp.getTask(pw, null, null,
  58.450 +                        params.options, null, params.sources);
  58.451 +                return ((JavacTaskImpl)ct).doCall().exitCode;
  58.452 +            }
  58.453 +
  58.454 +            @Override
  58.455 +            String getName() {
  58.456 +                return "javac";
  58.457 +            }
  58.458 +
  58.459 +            @Override
  58.460 +            List<String> getExceptionMsgContent(JavaToolArgs params) {
  58.461 +                List<String> result = super.getExceptionMsgContent(params);
  58.462 +                for (JavaFileObject source : params.sources) {
  58.463 +                    if (source instanceof JavaSource) {
  58.464 +                        result.add(((JavaSource)source).name);
  58.465 +                    }
  58.466 +                }
  58.467 +                return result;
  58.468 +            }
  58.469 +        },
  58.470 +        JAVAH {
  58.471 +            @Override
  58.472 +            int run(JavaToolArgs params, PrintWriter pw) {
  58.473 +                return com.sun.tools.javah.Main.run(params.optionsArr, pw);
  58.474 +            }
  58.475 +        },
  58.476 +        JAVAP {
  58.477 +            @Override
  58.478 +            int run(JavaToolArgs params, PrintWriter pw) {
  58.479 +                return com.sun.tools.javap.Main.run(params.optionsArr, pw);
  58.480 +            }
  58.481 +        };
  58.482 +
  58.483 +        abstract int run(JavaToolArgs params, PrintWriter pw);
  58.484 +
  58.485 +        String getName() {
  58.486 +            return this.name().toLowerCase();
  58.487 +        }
  58.488 +
  58.489 +        List<String> getExceptionMsgContent(JavaToolArgs params) {
  58.490 +            List<String> result = new ArrayList<>();
  58.491 +            result.add(getName());
  58.492 +            result.addAll(params.optionsArr != null ?
  58.493 +                    Arrays.asList(params.optionsArr) :
  58.494 +                    params.options);
  58.495 +            return result;
  58.496 +        }
  58.497 +    }
  58.498 +
  58.499 +    /**
  58.500 +     * A helper method for executing langtools commands.
  58.501 +     */
  58.502 +    private static int genericJavaCMD(
  58.503 +            JavaCMD cmd,
  58.504 +            JavaToolArgs params)
  58.505 +            throws CommandExecutionException, IOException {
  58.506 +        int rc = 0;
  58.507 +        StringWriter sw = null;
  58.508 +        try (PrintWriter pw = (params.errOutput == null) ?
  58.509 +                null : new PrintWriter(sw = new StringWriter())) {
  58.510 +            rc = cmd.run(params, pw);
  58.511 +        }
  58.512 +        String out = (sw == null) ? null : sw.toString();
  58.513 +
  58.514 +        if (params.errOutput != null && (out != null) && !out.isEmpty()) {
  58.515 +            params.errOutput.addAll(splitLines(out));
  58.516 +        }
  58.517 +
  58.518 +        if ( (rc == 0 && params.whatToExpect == Expect.SUCCESS) ||
  58.519 +             (rc != 0 && params.whatToExpect == Expect.FAIL) ) {
  58.520 +            return rc;
  58.521 +        }
  58.522 +
  58.523 +        throw new CommandExecutionException(cmd.getExceptionMsgContent(params),
  58.524 +                params.whatToExpect);
  58.525 +    }
  58.526 +
  58.527 +    /**
  58.528 +     * A jar calling method.
  58.529 +     */
  58.530 +    public static boolean jar(String... params) throws CommandExecutionException {
  58.531 +        Main jarGenerator = new Main(System.out, System.err, "jar");
  58.532 +        boolean result = jarGenerator.run(params);
  58.533 +        if (!result) {
  58.534 +            List<String> command = new ArrayList<>();
  58.535 +            command.add("jar");
  58.536 +            command.addAll(Arrays.asList(params));
  58.537 +            throw new CommandExecutionException(command, Expect.SUCCESS);
  58.538 +        }
  58.539 +        return result;
  58.540 +    }
  58.541 +
  58.542 +    /**
  58.543 +     * A general command calling method.
  58.544 +     */
  58.545 +    public static int executeCommand(AnyToolArgs params)
  58.546 +            throws CommandExecutionException, IOException, InterruptedException {
  58.547 +        if (params.hasMinParams()) {
  58.548 +            List<String> cmd = (params.options != null) ?
  58.549 +                    params.options :
  58.550 +                    Arrays.asList(params.optionsArr);
  58.551 +            return executeCommand(cmd, params.extraEnv, params.stdOutput,
  58.552 +                    params.errOutput, params.whatToExpect);
  58.553 +        }
  58.554 +        throw new AssertionError("command has been invoked with less parameters than needed");
  58.555 +    }
  58.556 +
  58.557 +    /**
  58.558 +     * A helper method for calling a general command.
  58.559 +     */
  58.560 +    private static int executeCommand(
  58.561 +            List<String> command,
  58.562 +            Map<String, String> extraEnv,
  58.563 +            WriterHelper stdOutput,
  58.564 +            WriterHelper errOutput,
  58.565 +            Expect whatToExpt)
  58.566 +            throws IOException, InterruptedException, CommandExecutionException {
  58.567 +        ProcessBuilder pb = new ProcessBuilder(command);
  58.568 +
  58.569 +        if (stdOutput != null) stdOutput.pipeOutput(pb);
  58.570 +        if (errOutput != null) errOutput.pipeOutput(pb);
  58.571 +
  58.572 +        if (extraEnv != null) {
  58.573 +            pb.environment().putAll(extraEnv);
  58.574 +        }
  58.575 +
  58.576 +        Process p = pb.start();
  58.577 +
  58.578 +        if (stdOutput != null) stdOutput.readFromStream(p);
  58.579 +        if (errOutput != null) errOutput.readFromStream(p);
  58.580 +
  58.581 +        int result = p.waitFor();
  58.582 +        if ( (result == 0 && whatToExpt == Expect.SUCCESS) ||
  58.583 +             (result != 0 && whatToExpt == Expect.FAIL) ) {
  58.584 +            return result;
  58.585 +        }
  58.586 +
  58.587 +        throw new CommandExecutionException(command, whatToExpt);
  58.588 +    }
  58.589 +
  58.590 +    /**
  58.591 +     * This set of methods can be used instead of diff when the only needed
  58.592 +     * result is the equality or inequality of the two given resources.
  58.593 +     *
  58.594 +     * A resource can be a file or a String list.
  58.595 +     */
  58.596 +    public static void compareLines(Path aPath, Path otherPath, String encoding)
  58.597 +            throws FileNotFoundException, IOException, ResourcesNotEqualException {
  58.598 +        compareLines(aPath, otherPath, encoding, false);
  58.599 +    }
  58.600 +
  58.601 +    public static void compareLines(
  58.602 +            Path aPath, Path otherPath, String encoding, boolean trim)
  58.603 +            throws FileNotFoundException, IOException, ResourcesNotEqualException {
  58.604 +        Charset charset = encoding != null ?
  58.605 +                Charset.forName(encoding) :
  58.606 +                defaultCharset;
  58.607 +        List<String> list1 = Files.readAllLines(aPath, charset);
  58.608 +        List<String> list2 = Files.readAllLines(otherPath, charset);
  58.609 +        compareLines(list1, list2, trim);
  58.610 +    }
  58.611 +
  58.612 +    public static void compareLines(Path path, List<String> strings, String encoding)
  58.613 +            throws FileNotFoundException, IOException, ResourcesNotEqualException {
  58.614 +        compareLines(path, strings, encoding, false);
  58.615 +    }
  58.616 +
  58.617 +    public static void compareLines(Path path, List<String> strings,
  58.618 +            String encoding, boolean trim)
  58.619 +            throws FileNotFoundException, IOException, ResourcesNotEqualException {
  58.620 +        Charset charset = encoding != null ?
  58.621 +                Charset.forName(encoding) :
  58.622 +                defaultCharset;
  58.623 +        List<String> list = Files.readAllLines(path, charset);
  58.624 +        compareLines(list, strings, trim);
  58.625 +    }
  58.626 +
  58.627 +    public static void compareLines(List<String> list1, List<String> list2)
  58.628 +            throws ResourcesNotEqualException {
  58.629 +        compareLines(list1, list2, false);
  58.630 +    }
  58.631 +
  58.632 +    public static void compareLines(List<String> list1,
  58.633 +            List<String> list2, boolean trim) throws ResourcesNotEqualException {
  58.634 +        if ((list1 == list2) || (list1 == null && list2 == null)) return;
  58.635 +        if (list1.size() != list2.size())
  58.636 +            throw new ResourcesNotEqualException();
  58.637 +        int i = 0;
  58.638 +        int j = 0;
  58.639 +        while (i < list1.size() &&
  58.640 +               j < list2.size() &&
  58.641 +               equals(list1.get(i), list2.get(j), trim)) {
  58.642 +            i++; j++;
  58.643 +        }
  58.644 +        if (!(i == list1.size() && j == list2.size()))
  58.645 +            throw new ResourcesNotEqualException();
  58.646 +    }
  58.647 +
  58.648 +    private static boolean equals(String s1, String s2, boolean trim) {
  58.649 +        return (trim ? s1.trim().equals(s2.trim()) : s1.equals(s2));
  58.650 +    }
  58.651 +
  58.652 +    /**
  58.653 +     * A set of simple grep-like methods, looks for regExpr in text.
  58.654 +     * The content of text is split using the new line character as a pattern
  58.655 +     * and later the regExpr is seek in every split line. If a match is found,
  58.656 +     * the whole line is added to the result.
  58.657 +     */
  58.658 +    public static List<String> grep(String regExpr, String text) {
  58.659 +        return grep(regExpr, splitLines(text));
  58.660 +    }
  58.661 +
  58.662 +    public static List<String> grep(String regExpr, List<String> text) {
  58.663 +        List<String> result = new ArrayList<>();
  58.664 +        Pattern pattern = Pattern.compile(regExpr);
  58.665 +        for (String s : text) {
  58.666 +            if (pattern.matcher(s).find()) {
  58.667 +                result.add(s);
  58.668 +            }
  58.669 +        }
  58.670 +        return result;
  58.671 +    }
  58.672 +
  58.673 +    public static List<String> grep(String regExpr, File f)
  58.674 +            throws IOException {
  58.675 +        List<String> lines = Files.readAllLines(f.toPath(), defaultCharset);
  58.676 +        return grep(regExpr, lines);
  58.677 +    }
  58.678 +
  58.679 +    /**
  58.680 +     * A touch-like method.
  58.681 +     */
  58.682 +    public static boolean touch(String fileName) {
  58.683 +        File file = new File(fileName);
  58.684 +        return touch(file);
  58.685 +    }
  58.686 +
  58.687 +    public static boolean touch(File file) {
  58.688 +        if (file.exists()) {
  58.689 +            file.setLastModified(System.currentTimeMillis());
  58.690 +            return true;
  58.691 +        }
  58.692 +        return false;
  58.693 +    }
  58.694 +
  58.695 +    public static void createJavaFile(File outFile) throws IOException {
  58.696 +        createJavaFile(outFile, null);
  58.697 +    }
  58.698 +
  58.699 +    /**
  58.700 +     * A method for creating a valid but very simple java file.
  58.701 +     */
  58.702 +    public static void createJavaFile(File outFile, File superClass)
  58.703 +            throws IOException {
  58.704 +        String srcStr = "public class " + getSimpleName(outFile) + " ";
  58.705 +        if (superClass != null) {
  58.706 +            srcStr = srcStr.concat("extends " + getSimpleName(superClass) + " ");
  58.707 +        }
  58.708 +        srcStr = srcStr.concat("{}");
  58.709 +        try (PrintWriter ps = new PrintWriter(new FileWriter(outFile))) {
  58.710 +            ps.println(srcStr);
  58.711 +        }
  58.712 +    }
  58.713 +
  58.714 +    /**
  58.715 +     * Creates a java file name given its source.
  58.716 +     * The file is created in the working directory, creating a directory
  58.717 +     * tree if there is a package declaration.
  58.718 +     */
  58.719 +    public static void createJavaFileFromSource(String source) throws IOException {
  58.720 +        createJavaFileFromSource(null, source);
  58.721 +    }
  58.722 +
  58.723 +    /**
  58.724 +     * Creates a java file name given its source.
  58.725 +     * The file is created in the working directory, creating a directory
  58.726 +     * tree if there is a package declaration or the argument initialPath
  58.727 +     * has a valid path.
  58.728 +     *
  58.729 +     * e.i. if initialPath is foo/ and the source is:
  58.730 +     * package bar;
  58.731 +     *
  58.732 +     * public class bazz {}
  58.733 +     *
  58.734 +     * this method will create the file foo/bar/bazz.java in the working
  58.735 +     * directory.
  58.736 +     */
  58.737 +    public static void createJavaFileFromSource(Path initialPath,
  58.738 +            String source) throws IOException {
  58.739 +        String fileName = getJavaFileNameFromSource(source);
  58.740 +        String dirTree = getDirTreeFromSource(source);
  58.741 +        Path path = (dirTree != null) ?
  58.742 +                Paths.get(dirTree, fileName) :
  58.743 +                Paths.get(fileName);
  58.744 +        path = (initialPath != null) ?
  58.745 +                initialPath.resolve(path):
  58.746 +                path;
  58.747 +        writeFile(path, source);
  58.748 +    }
  58.749 +
  58.750 +    static Pattern publicClassPattern =
  58.751 +            Pattern.compile("public\\s+(?:class|enum|interface){1}\\s+(\\w+)");
  58.752 +    static Pattern packageClassPattern =
  58.753 +            Pattern.compile("(?:class|enum|interface){1}\\s+(\\w+)");
  58.754 +
  58.755 +    /**
  58.756 +     * Extracts the java file name from the class declaration.
  58.757 +     * This method is intended for simple files and uses regular expressions,
  58.758 +     * so comments matching the pattern can make the method fail.
  58.759 +     */
  58.760 +    private static String getJavaFileNameFromSource(String source) {
  58.761 +        String className = null;
  58.762 +        Matcher matcher = publicClassPattern.matcher(source);
  58.763 +        if (matcher.find()) {
  58.764 +            className = matcher.group(1) + ".java";
  58.765 +        } else {
  58.766 +            matcher = packageClassPattern.matcher(source);
  58.767 +            if (matcher.find()) {
  58.768 +                className = matcher.group(1) + ".java";
  58.769 +            } else {
  58.770 +                throw new AssertionError("Could not extract the java class " +
  58.771 +                        "name from the provided source");
  58.772 +            }
  58.773 +        }
  58.774 +        return className;
  58.775 +    }
  58.776 +
  58.777 +    static Pattern packagePattern =
  58.778 +            Pattern.compile("package\\s+(((?:\\w+\\.)*)(?:\\w+))");
  58.779 +
  58.780 +    /**
  58.781 +     * Extracts the path from the package declaration if present.
  58.782 +     * This method is intended for simple files and uses regular expressions,
  58.783 +     * so comments matching the pattern can make the method fail.
  58.784 +     */
  58.785 +    private static String getDirTreeFromSource(String source) {
  58.786 +        Matcher matcher = packagePattern.matcher(source);
  58.787 +        return matcher.find() ?
  58.788 +            matcher.group(1).replace(".", File.separator) :
  58.789 +            null;
  58.790 +    }
  58.791 +
  58.792 +    /**
  58.793 +     * A method for creating a jar's manifest file with supplied data.
  58.794 +     */
  58.795 +    public static void mkManifestWithClassPath(String mainClass,
  58.796 +            String... classes) throws IOException {
  58.797 +        List <String> lines = new ArrayList<>();
  58.798 +
  58.799 +        StringBuilder sb = new StringBuilder("Class-Path: ".length() +
  58.800 +                classes[0].length()).append("Class-Path: ").append(classes[0]);
  58.801 +        for (int i = 1; i < classes.length; i++) {
  58.802 +            sb.append(" ").append(classes[i]);
  58.803 +        }
  58.804 +        lines.add(sb.toString());
  58.805 +        if (mainClass != null) {
  58.806 +            lines.add(new StringBuilder("Main-Class: ".length() +
  58.807 +                      mainClass.length())
  58.808 +                      .append("Main-Class: ")
  58.809 +                      .append(mainClass).toString());
  58.810 +        }
  58.811 +        Files.write(Paths.get("MANIFEST.MF"), lines, null);
  58.812 +    }
  58.813 +
  58.814 +    /**
  58.815 +     * A utility method to obtain the file name.
  58.816 +     */
  58.817 +    static String getSimpleName(File inFile) {
  58.818 +        return inFile.toPath().getFileName().toString();
  58.819 +    }
  58.820 +
  58.821 +    /**
  58.822 +     * A method to write to a file, the directory tree is created if needed.
  58.823 +     */
  58.824 +    public static File writeFile(Path path, String body) throws IOException {
  58.825 +        File result;
  58.826 +        if (path.getParent() != null) {
  58.827 +            Files.createDirectories(path.getParent());
  58.828 +        }
  58.829 +        try (FileWriter out = new FileWriter(result = path.toAbsolutePath().toFile())) {
  58.830 +            out.write(body);
  58.831 +        }
  58.832 +        return result;
  58.833 +    }
  58.834 +
  58.835 +    public static File writeFile(String path, String body) throws IOException {
  58.836 +        return writeFile(Paths.get(path), body);
  58.837 +    }
  58.838 +
  58.839 +    /**
  58.840 +     * A rm-like method, the file is deleted only if it exists.
  58.841 +     */
  58.842 +    public static void rm(Path path) throws Exception {
  58.843 +        Files.deleteIfExists(path);
  58.844 +    }
  58.845 +
  58.846 +    public static void rm(String filename) throws Exception {
  58.847 +        rm(Paths.get(filename));
  58.848 +    }
  58.849 +
  58.850 +    public static void rm(File f) throws Exception {
  58.851 +        rm(f.toPath());
  58.852 +    }
  58.853 +
  58.854 +    /**
  58.855 +     * Copy source file to destination file.
  58.856 +     */
  58.857 +    public static void copyFile(File destfile, File srcfile)
  58.858 +        throws IOException {
  58.859 +        copyFile(destfile.toPath(), srcfile.toPath());
  58.860 +    }
  58.861 +
  58.862 +    public static void copyFile(Path destPath, Path srcPath)
  58.863 +        throws IOException {
  58.864 +        Files.createDirectories(destPath);
  58.865 +        Files.copy(srcPath, destPath, REPLACE_EXISTING);
  58.866 +    }
  58.867 +
  58.868 +    /**
  58.869 +     * Splits a String using the System's line separator character as splitting point.
  58.870 +     */
  58.871 +    public static List<String> splitLines(String lines) {
  58.872 +        return Arrays.asList(lines.split(lineSeparator));
  58.873 +    }
  58.874 +
  58.875 +    /**
  58.876 +     * Converts a String list into one String by appending the System's line separator
  58.877 +     * character after each component.
  58.878 +     */
  58.879 +    private static String listToString(List<String> lines) {
  58.880 +        StringBuilder sb = new StringBuilder();
  58.881 +        for (String s : lines) {
  58.882 +            sb.append(s).append(lineSeparator);
  58.883 +        }
  58.884 +        return sb.toString();
  58.885 +    }
  58.886 +
  58.887 +    /**
  58.888 +     * Class representing an in-memory java source file. It is able to extract
  58.889 +     * the file name from simple source codes using regular expressions.
  58.890 +     */
  58.891 +    public static class JavaSource extends SimpleJavaFileObject {
  58.892 +        String source;
  58.893 +        String name;
  58.894 +
  58.895 +        public JavaSource(String className, String source) {
  58.896 +            super(URI.create(className),
  58.897 +                    JavaFileObject.Kind.SOURCE);
  58.898 +            this.name = className;
  58.899 +            this.source = source;
  58.900 +        }
  58.901 +
  58.902 +        public JavaSource(String source) {
  58.903 +            super(URI.create(getJavaFileNameFromSource(source)),
  58.904 +                    JavaFileObject.Kind.SOURCE);
  58.905 +            this.name = getJavaFileNameFromSource(source);
  58.906 +            this.source = source;
  58.907 +        }
  58.908 +
  58.909 +        @Override
  58.910 +        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
  58.911 +            return source;
  58.912 +        }
  58.913 +    }
  58.914 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/tools/javac/links/LinksTest.java	Tue Feb 19 17:53:16 2013 +0000
    59.3 @@ -0,0 +1,63 @@
    59.4 +/*
    59.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.7 + *
    59.8 + * This code is free software; you can redistribute it and/or modify it
    59.9 + * under the terms of the GNU General Public License version 2 only, as
   59.10 + * published by the Free Software Foundation.
   59.11 + *
   59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   59.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   59.15 + * version 2 for more details (a copy is included in the LICENSE file that
   59.16 + * accompanied this code).
   59.17 + *
   59.18 + * You should have received a copy of the GNU General Public License version
   59.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   59.21 + *
   59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   59.23 + * or visit www.oracle.com if you need additional information or have any
   59.24 + * questions.
   59.25 + */
   59.26 +
   59.27 +/*
   59.28 + * @test
   59.29 + * @bug 4266026
   59.30 + * @summary javac no longer follows symlinks
   59.31 + * @library /tools/javac/lib
   59.32 + * @build ToolBox
   59.33 + * @run main LinksTest
   59.34 + */
   59.35 +
   59.36 +import java.nio.file.Files;
   59.37 +import java.nio.file.Paths;
   59.38 +
   59.39 +//original test: test/tools/javac/links/links.sh
   59.40 +public class LinksTest {
   59.41 +
   59.42 +    private static final String BSrc =
   59.43 +        "package a;\n" +
   59.44 +        "\n" +
   59.45 +        "public class B {}";
   59.46 +
   59.47 +    private static final String TSrc =
   59.48 +        "class T extends a.B {}";
   59.49 +
   59.50 +    public static void main(String args[])
   59.51 +            throws Exception {
   59.52 +//      mkdir tmp
   59.53 +//      cp ${TESTSRC}/b/B.java tmp
   59.54 +        ToolBox.writeFile(Paths.get("tmp", "B.java"), BSrc);
   59.55 +
   59.56 +//        ln -s `pwd`/tmp "${TESTCLASSES}/a"
   59.57 +        Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp"));
   59.58 +//
   59.59 +////"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
   59.60 +        ToolBox.JavaToolArgs javacArgs =
   59.61 +                new ToolBox.JavaToolArgs()
   59.62 +                .setOptions("-sourcepath", ".", "-d", ".").setSources(TSrc);
   59.63 +        ToolBox.javac(javacArgs);
   59.64 +    }
   59.65 +
   59.66 +}
    60.1 --- a/test/tools/javac/links/T.java	Tue Feb 19 00:31:45 2013 -0800
    60.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.3 @@ -1,24 +0,0 @@
    60.4 -/*
    60.5 - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
    60.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 - *
    60.8 - * This code is free software; you can redistribute it and/or modify it
    60.9 - * under the terms of the GNU General Public License version 2 only, as
   60.10 - * published by the Free Software Foundation.
   60.11 - *
   60.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   60.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.15 - * version 2 for more details (a copy is included in the LICENSE file that
   60.16 - * accompanied this code).
   60.17 - *
   60.18 - * You should have received a copy of the GNU General Public License version
   60.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   60.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.21 - *
   60.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.23 - * or visit www.oracle.com if you need additional information or have any
   60.24 - * questions.
   60.25 - */
   60.26 -
   60.27 -class T extends a.B {}
    61.1 --- a/test/tools/javac/links/b/B.java	Tue Feb 19 00:31:45 2013 -0800
    61.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.3 @@ -1,26 +0,0 @@
    61.4 -/*
    61.5 - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
    61.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.7 - *
    61.8 - * This code is free software; you can redistribute it and/or modify it
    61.9 - * under the terms of the GNU General Public License version 2 only, as
   61.10 - * published by the Free Software Foundation.
   61.11 - *
   61.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   61.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   61.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   61.15 - * version 2 for more details (a copy is included in the LICENSE file that
   61.16 - * accompanied this code).
   61.17 - *
   61.18 - * You should have received a copy of the GNU General Public License version
   61.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   61.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   61.21 - *
   61.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   61.23 - * or visit www.oracle.com if you need additional information or have any
   61.24 - * questions.
   61.25 - */
   61.26 -
   61.27 -package a;
   61.28 -
   61.29 -public class B {}
    62.1 --- a/test/tools/javac/links/links.sh	Tue Feb 19 00:31:45 2013 -0800
    62.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.3 @@ -1,74 +0,0 @@
    62.4 -#!/bin/sh
    62.5 -
    62.6 -#
    62.7 -# Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
    62.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.9 -#
   62.10 -# This code is free software; you can redistribute it and/or modify it
   62.11 -# under the terms of the GNU General Public License version 2 only, as
   62.12 -# published by the Free Software Foundation.
   62.13 -#
   62.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   62.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   62.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   62.17 -# version 2 for more details (a copy is included in the LICENSE file that
   62.18 -# accompanied this code).
   62.19 -#
   62.20 -# You should have received a copy of the GNU General Public License version
   62.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   62.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   62.23 -#
   62.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   62.25 -# or visit www.oracle.com if you need additional information or have any
   62.26 -# questions.
   62.27 -#
   62.28 -
   62.29 -# @test
   62.30 -# @bug 4266026
   62.31 -# @summary javac no longer follows symlinks
   62.32 -#
   62.33 -# @run shell links.sh
   62.34 -
   62.35 -
   62.36 -if [ "${TESTSRC}" = "" ]
   62.37 -then
   62.38 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   62.39 -  exit 1
   62.40 -fi
   62.41 -echo "TESTSRC=${TESTSRC}"
   62.42 -if [ "${TESTJAVA}" = "" ]
   62.43 -then
   62.44 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   62.45 -  exit 1
   62.46 -fi
   62.47 -echo "TESTJAVA=${TESTJAVA}"
   62.48 -if [ "${TESTCLASSES}" = "" ]
   62.49 -then
   62.50 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   62.51 -  exit 1
   62.52 -fi
   62.53 -echo "TESTCLASSES=${TESTCLASSES}"
   62.54 -echo "CLASSPATH=${CLASSPATH}"
   62.55 -
   62.56 -# set platform-dependent variables
   62.57 -OS=`uname -s`
   62.58 -case "$OS" in
   62.59 -  SunOS | Linux | Darwin )
   62.60 -    NULL=/dev/null
   62.61 -    PS=":"
   62.62 -    FS="/"
   62.63 -    ;;
   62.64 -  * )
   62.65 -    echo "Unrecognized system - test skipped."
   62.66 -    exit 0;
   62.67 -    ;;
   62.68 -esac
   62.69 -
   62.70 -mkdir tmp
   62.71 -cp ${TESTSRC}/b/B.java tmp
   62.72 -
   62.73 -rm -rf T.class B.class b/B.class "${TESTCLASSES}/a" "${TESTCLASSES}/classes"
   62.74 -ln -s `pwd`/tmp "${TESTCLASSES}/a"
   62.75 -mkdir "${TESTCLASSES}/classes"
   62.76 -
   62.77 -"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/test/tools/javac/newlines/NewLineTest.java	Tue Feb 19 17:53:16 2013 +0000
    63.3 @@ -0,0 +1,62 @@
    63.4 +/*
    63.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    63.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.7 + *
    63.8 + * This code is free software; you can redistribute it and/or modify it
    63.9 + * under the terms of the GNU General Public License version 2 only, as
   63.10 + * published by the Free Software Foundation.
   63.11 + *
   63.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   63.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   63.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   63.15 + * version 2 for more details (a copy is included in the LICENSE file that
   63.16 + * accompanied this code).
   63.17 + *
   63.18 + * You should have received a copy of the GNU General Public License version
   63.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   63.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   63.21 + *
   63.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   63.23 + * or visit www.oracle.com if you need additional information or have any
   63.24 + * questions.
   63.25 + */
   63.26 +
   63.27 +/*
   63.28 + * @test
   63.29 + * @bug 4110560 4785453
   63.30 + * @summary portability : javac.properties
   63.31 + * @library /tools/javac/lib
   63.32 + * @build ToolBox
   63.33 + * @run main NewLineTest
   63.34 + */
   63.35 +
   63.36 +import java.io.File;
   63.37 +import java.nio.charset.Charset;
   63.38 +import java.nio.file.Files;
   63.39 +import java.util.List;
   63.40 +import com.sun.tools.javac.util.ArrayUtils;
   63.41 +
   63.42 +//original test: test/tools/javac/newlines/Newlines.sh
   63.43 +public class NewLineTest {
   63.44 +
   63.45 +    public static void main(String args[]) throws Exception {
   63.46 +        String[] mainArgs = ToolBox.getJavacBin();
   63.47 +
   63.48 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Dline.separator='@' > ${TMP1} 2>&1
   63.49 +        File javacErrOutput = new File("output.txt");
   63.50 +        ToolBox.AnyToolArgs cmdArgs =
   63.51 +                new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL)
   63.52 +                .setAllArgs(ArrayUtils.concatOpen(mainArgs, "-J-Dline.separator='@'"))
   63.53 +                .setErrOutput(javacErrOutput);
   63.54 +        ToolBox.executeCommand(cmdArgs);
   63.55 +
   63.56 +//        result=`cat ${TMP1} | wc -l`
   63.57 +//        if [ "$result" -eq 0 ] passed
   63.58 +        List<String> lines = Files.readAllLines(javacErrOutput.toPath(),
   63.59 +                Charset.defaultCharset());
   63.60 +        if (lines.size() != 1) {
   63.61 +            throw new AssertionError("The compiler output should have one line only");
   63.62 +        }
   63.63 +    }
   63.64 +
   63.65 +}
    64.1 --- a/test/tools/javac/newlines/Newlines.sh	Tue Feb 19 00:31:45 2013 -0800
    64.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.3 @@ -1,76 +0,0 @@
    64.4 -#
    64.5 -# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
    64.6 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.7 -#
    64.8 -# This code is free software; you can redistribute it and/or modify it
    64.9 -# under the terms of the GNU General Public License version 2 only, as
   64.10 -# published by the Free Software Foundation.
   64.11 -#
   64.12 -# This code is distributed in the hope that it will be useful, but WITHOUT
   64.13 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   64.14 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   64.15 -# version 2 for more details (a copy is included in the LICENSE file that
   64.16 -# accompanied this code).
   64.17 -#
   64.18 -# You should have received a copy of the GNU General Public License version
   64.19 -# 2 along with this work; if not, write to the Free Software Foundation,
   64.20 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   64.21 -#
   64.22 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   64.23 -# or visit www.oracle.com if you need additional information or have any
   64.24 -# questions.
   64.25 -#
   64.26 -
   64.27 -# @test
   64.28 -# @bug 4110560 4785453
   64.29 -# @summary portability : javac.properties
   64.30 -#
   64.31 -# @run shell Newlines.sh
   64.32 -
   64.33 -if [ "${TESTSRC}" = "" ]
   64.34 -then
   64.35 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   64.36 -  exit 1
   64.37 -fi
   64.38 -echo "TESTSRC=${TESTSRC}"
   64.39 -if [ "${TESTJAVA}" = "" ]
   64.40 -then
   64.41 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   64.42 -  exit 1
   64.43 -fi
   64.44 -echo "TESTJAVA=${TESTJAVA}"
   64.45 -if [ "${TESTCLASSES}" = "" ]
   64.46 -then
   64.47 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   64.48 -  exit 1
   64.49 -fi
   64.50 -echo "TESTCLASSES=${TESTCLASSES}"
   64.51 -echo "CLASSPATH=${CLASSPATH}"
   64.52 -
   64.53 -# set platform-dependent variables
   64.54 -OS=`uname -s`
   64.55 -case "$OS" in
   64.56 -  SunOS | Linux | Darwin | CYGWIN* )
   64.57 -    FS="/"
   64.58 -    ;;
   64.59 -  Windows* )
   64.60 -    FS="\\"
   64.61 -    ;;
   64.62 -  * )
   64.63 -    echo "Unrecognized system!"
   64.64 -    exit 1;
   64.65 -    ;;
   64.66 -esac
   64.67 -
   64.68 -TMP1=OUTPUT.txt
   64.69 -
   64.70 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Dline.separator='@' > ${TMP1} 2>&1
   64.71 -cat ${TMP1}
   64.72 -result=`cat ${TMP1} | wc -l`
   64.73 -if [ "$result" -eq 0 ]
   64.74 -then
   64.75 -  echo "Passed"
   64.76 -else
   64.77 -  echo "Failed"
   64.78 -fi
   64.79 -exit $result
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/test/tools/javac/stackmap/StackMapTest.java	Tue Feb 19 17:53:16 2013 +0000
    65.3 @@ -0,0 +1,65 @@
    65.4 +/*
    65.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    65.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.7 + *
    65.8 + * This code is free software; you can redistribute it and/or modify it
    65.9 + * under the terms of the GNU General Public License version 2 only, as
   65.10 + * published by the Free Software Foundation.
   65.11 + *
   65.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   65.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   65.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   65.15 + * version 2 for more details (a copy is included in the LICENSE file that
   65.16 + * accompanied this code).
   65.17 + *
   65.18 + * You should have received a copy of the GNU General Public License version
   65.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   65.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   65.21 + *
   65.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   65.23 + * or visit www.oracle.com if you need additional information or have any
   65.24 + * questions.
   65.25 + */
   65.26 +
   65.27 +/*
   65.28 + * @test
   65.29 + * @bug 4955930
   65.30 + * @summary The "method0" StackMap attribute should have two entries instead of three
   65.31 + * @library /tools/javac/lib
   65.32 + * @build ToolBox
   65.33 + * @run compile -source 6 -target 6 StackMapTest.java
   65.34 + * @run main StackMapTest
   65.35 + */
   65.36 +
   65.37 +import java.nio.file.Path;
   65.38 +import java.nio.file.Paths;
   65.39 +
   65.40 +//original test: test/tools/javac/stackmap/T4955930.sh
   65.41 +public class StackMapTest {
   65.42 +
   65.43 +    class Test {
   65.44 +        void method0(boolean aboolean) throws Exception {
   65.45 +            label_0:
   65.46 +            while (true) {
   65.47 +                if (aboolean) ;
   65.48 +                else break label_0;
   65.49 +            }
   65.50 +        }
   65.51 +    }
   65.52 +
   65.53 +    public static void main(String args[]) throws Exception {
   65.54 +//    "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -source 6 -target 6 T4955930.java
   65.55 +
   65.56 +//    "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -verbose T4955930 > ${TMP1}
   65.57 +        Path pathToClass = Paths.get(System.getProperty("test.classes"),
   65.58 +                "StackMapTest$Test.class");
   65.59 +        ToolBox.JavaToolArgs javapArgs =
   65.60 +                new ToolBox.JavaToolArgs().setAllArgs("-v", pathToClass.toString());
   65.61 +
   65.62 +//        grep "StackMapTable: number_of_entries = 2" ${TMP1}
   65.63 +        if (!ToolBox.javap(javapArgs).contains("StackMapTable: number_of_entries = 2"))
   65.64 +            throw new AssertionError("The number of entries of the stack map "
   65.65 +                    + "table should be equal to 2");
   65.66 +    }
   65.67 +
   65.68 +}
    66.1 --- a/test/tools/javac/stackmap/T4955930.java	Tue Feb 19 00:31:45 2013 -0800
    66.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.3 @@ -1,47 +0,0 @@
    66.4 -/*
    66.5 - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
    66.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.7 - *
    66.8 - * This code is free software; you can redistribute it and/or modify it
    66.9 - * under the terms of the GNU General Public License version 2 only, as
   66.10 - * published by the Free Software Foundation.
   66.11 - *
   66.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   66.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   66.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   66.15 - * version 2 for more details (a copy is included in the LICENSE file that
   66.16 - * accompanied this code).
   66.17 - *
   66.18 - * You should have received a copy of the GNU General Public License version
   66.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   66.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   66.21 - *
   66.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   66.23 - * or visit www.oracle.com if you need additional information or have any
   66.24 - * questions.
   66.25 - */
   66.26 -
   66.27 -/*
   66.28 - * @test
   66.29 - * @bug 4955930
   66.30 - * @summary The "method0" StackMap attribute should have two entries instead of three
   66.31 - * @author wtao
   66.32 - *
   66.33 - * @run shell T4955930.sh
   66.34 - */
   66.35 -
   66.36 -public class T4955930 {
   66.37 -
   66.38 -   void method0(boolean aboolean) throws Exception {
   66.39 -      label_0:
   66.40 -      while (true) {
   66.41 -         if (aboolean) {
   66.42 -            ;
   66.43 -         }
   66.44 -         else {
   66.45 -            break label_0;
   66.46 -         }
   66.47 -         System.out.println("");
   66.48 -      }
   66.49 -   }
   66.50 -}
    67.1 --- a/test/tools/javac/stackmap/T4955930.sh	Tue Feb 19 00:31:45 2013 -0800
    67.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.3 @@ -1,76 +0,0 @@
    67.4 -#!/bin/sh
    67.5 -
    67.6 -#
    67.7 -# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
    67.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.9 -#
   67.10 -# This code is free software; you can redistribute it and/or modify it
   67.11 -# under the terms of the GNU General Public License version 2 only, as
   67.12 -# published by the Free Software Foundation.
   67.13 -#
   67.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   67.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   67.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   67.17 -# version 2 for more details (a copy is included in the LICENSE file that
   67.18 -# accompanied this code).
   67.19 -#
   67.20 -# You should have received a copy of the GNU General Public License version
   67.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   67.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   67.23 -#
   67.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   67.25 -# or visit www.oracle.com if you need additional information or have any
   67.26 -# questions.
   67.27 -#
   67.28 -
   67.29 -
   67.30 -if [ "${TESTSRC}" = "" ]
   67.31 -then
   67.32 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   67.33 -  exit 1
   67.34 -fi
   67.35 -echo "TESTSRC=${TESTSRC}"
   67.36 -if [ "${TESTJAVA}" = "" ]
   67.37 -then
   67.38 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   67.39 -  exit 1
   67.40 -fi
   67.41 -echo "TESTJAVA=${TESTJAVA}"
   67.42 -echo "CLASSPATH=${CLASSPATH}"
   67.43 -
   67.44 -# set platform-dependent variables
   67.45 -OS=`uname -s`
   67.46 -case "$OS" in
   67.47 -  SunOS | Linux | Darwin | CYGWIN* )
   67.48 -    FS="/"
   67.49 -    ;;
   67.50 -  Windows_95 | Windows_98 | Windows_NT )
   67.51 -    FS="\\"
   67.52 -    ;;
   67.53 -  * )
   67.54 -    echo "Unrecognized system!"
   67.55 -    exit 1;
   67.56 -    ;;
   67.57 -esac
   67.58 -
   67.59 -TMP1=T4955930.javap
   67.60 -
   67.61 -cp "${TESTSRC}${FS}T4955930.java" .
   67.62 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -source 6 -target 6 T4955930.java
   67.63 -result=$?
   67.64 -if [ $result -ne 0 ]
   67.65 -then
   67.66 -    exit $result
   67.67 -fi
   67.68 -
   67.69 -"${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -verbose T4955930 > ${TMP1}
   67.70 -grep "StackMapTable: number_of_entries = 2" ${TMP1}
   67.71 -result=$?
   67.72 -
   67.73 -if [ $result -eq 0 ]
   67.74 -then
   67.75 -  echo "Passed"
   67.76 -else
   67.77 -  echo "Failed"
   67.78 -fi
   67.79 -exit $result
    68.1 --- a/test/tools/javac/unicode/SupplementaryJavaID6.java	Tue Feb 19 00:31:45 2013 -0800
    68.2 +++ b/test/tools/javac/unicode/SupplementaryJavaID6.java	Tue Feb 19 17:53:16 2013 +0000
    68.3 @@ -1,5 +1,5 @@
    68.4  /*
    68.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
    68.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    68.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.8   *
    68.9   * This code is free software; you can redistribute it and/or modify it
   68.10 @@ -21,12 +21,20 @@
   68.11   * questions.
   68.12   */
   68.13  
   68.14 +/*
   68.15 + * @test
   68.16 + * @bug 4914724 4973116 5014511
   68.17 + * @summary Ensure that a supplementary character can be used as part/whole of a
   68.18 + * class name on platforms that have Unicode aware filesystems.
   68.19 + * @run main SupplementaryJavaID6
   68.20 + */
   68.21 +
   68.22  public class SupplementaryJavaID6 {
   68.23      public static void main(String[] s) {
   68.24 -        new SupplementaryJavaID6();
   68.25 +        new SupplementaryJavaID6().test();
   68.26      }
   68.27  
   68.28 -    public SupplementaryJavaID6() {
   68.29 +    void test() {
   68.30          \ud801\udc00 instance = new \ud801\udc00();
   68.31          instance.\ud801\udc01();
   68.32      }
    69.1 --- a/test/tools/javac/unicode/SupplementaryJavaID6.sh	Tue Feb 19 00:31:45 2013 -0800
    69.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.3 @@ -1,114 +0,0 @@
    69.4 -#!/bin/sh
    69.5 -
    69.6 -#
    69.7 -# Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
    69.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.9 -#
   69.10 -# This code is free software; you can redistribute it and/or modify it
   69.11 -# under the terms of the GNU General Public License version 2 only, as
   69.12 -# published by the Free Software Foundation.
   69.13 -#
   69.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   69.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   69.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   69.17 -# version 2 for more details (a copy is included in the LICENSE file that
   69.18 -# accompanied this code).
   69.19 -#
   69.20 -# You should have received a copy of the GNU General Public License version
   69.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   69.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   69.23 -#
   69.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   69.25 -# or visit www.oracle.com if you need additional information or have any
   69.26 -# questions.
   69.27 -#
   69.28 -
   69.29 -#
   69.30 -# @test
   69.31 -# @bug 4914724 4973116 5014511
   69.32 -# @summary Ensure that a supplementary character can be used as part/whole of a class
   69.33 -#          name on platforms that have Unicode aware filesystems.
   69.34 -# @author Naoto Sato
   69.35 -# @run shell SupplementaryJavaID6.sh SupplementaryJavaID6
   69.36 -
   69.37 -
   69.38 -if [ "${TESTSRC}" = "" ]
   69.39 -then
   69.40 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   69.41 -  exit 1
   69.42 -fi
   69.43 -echo "TESTSRC=${TESTSRC}"
   69.44 -if [ "${TESTJAVA}" = "" ]
   69.45 -then
   69.46 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   69.47 -  exit 1
   69.48 -fi
   69.49 -echo "TESTJAVA=${TESTJAVA}"
   69.50 -if [ "${TESTCLASSES}" = "" ]
   69.51 -then
   69.52 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   69.53 -  exit 1
   69.54 -fi
   69.55 -echo "TESTCLASSES=${TESTCLASSES}"
   69.56 -echo "CLASSPATH=${CLASSPATH}"
   69.57 -
   69.58 -# set platform-dependent variables
   69.59 -OS=`uname -s`
   69.60 -case "$OS" in
   69.61 -  SunOS | Linux | Darwin )
   69.62 -    if [ -d /usr/lib/locale/en_US.UTF-8 -o -d /usr/lib/locale/en_US.utf8 ]
   69.63 -    then
   69.64 -        ENV="env LANG=en_US.UTF-8"
   69.65 -        PS=":"
   69.66 -        FS="/"
   69.67 -    else
   69.68 -        echo "As there is no en_US.UTF-8 locale available on this system, the compilation of the test case may or may not fail.  Ignoring this test."
   69.69 -        exit 0;
   69.70 -    fi
   69.71 -    ;;
   69.72 -  Windows_98 | Windows_ME )
   69.73 -    echo "As Windows 98/Me do not provide Unicode-aware file system, the compilation of the test case is expected to fail on these platforms.  Ignoring this test."
   69.74 -    exit 0;
   69.75 -    ;;
   69.76 -  Windows* )
   69.77 -    ENV=""
   69.78 -    PS=";"
   69.79 -    FS="\\"
   69.80 -    ;;
   69.81 -  CYGWIN* )
   69.82 -    ENV=""
   69.83 -    PS=";" # platform PS, not cygwin PS
   69.84 -    FS="/"
   69.85 -    ;;
   69.86 -  * )
   69.87 -    echo "Unrecognized system!"
   69.88 -    exit 1;
   69.89 -    ;;
   69.90 -esac
   69.91 -
   69.92 -# compile
   69.93 -cp "${TESTSRC}${FS}$1.java" .
   69.94 -${ENV} "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . -classpath ".${PS}${TESTSRC}" $1.java
   69.95 -result=$?
   69.96 -
   69.97 -if [ $result -ne 0 ]
   69.98 -then
   69.99 -  echo "Failed"
  69.100 -  exit $result
  69.101 -fi
  69.102 -
  69.103 -# run
  69.104 -${ENV} "${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} $1 
  69.105 -result=$?
  69.106 -
  69.107 -if [ $result -eq 0 ]
  69.108 -then
  69.109 -  echo "Passed"
  69.110 -else
  69.111 -  echo "Failed"
  69.112 -fi
  69.113 -
  69.114 -# Cleanup
  69.115 -${ENV} rm -f ./$1*.class
  69.116 -
  69.117 -exit $result
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/test/tools/javah/6257087/T6257087.java	Tue Feb 19 17:53:16 2013 +0000
    70.3 @@ -0,0 +1,81 @@
    70.4 +/*
    70.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    70.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.7 + *
    70.8 + * This code is free software; you can redistribute it and/or modify it
    70.9 + * under the terms of the GNU General Public License version 2 only, as
   70.10 + * published by the Free Software Foundation.
   70.11 + *
   70.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   70.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   70.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   70.15 + * version 2 for more details (a copy is included in the LICENSE file that
   70.16 + * accompanied this code).
   70.17 + *
   70.18 + * You should have received a copy of the GNU General Public License version
   70.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   70.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   70.21 + *
   70.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   70.23 + * or visit www.oracle.com if you need additional information or have any
   70.24 + * questions.
   70.25 + */
   70.26 +
   70.27 +/*
   70.28 + * @test
   70.29 + * @bug 6257087
   70.30 + * @summary javah doesn't produce proper signatures for inner class native methods
   70.31 + * @library /tools/javac/lib
   70.32 + * @build ToolBox
   70.33 + * @run main T6257087
   70.34 + */
   70.35 +
   70.36 +import java.nio.file.Paths;
   70.37 +
   70.38 +//original test: test/tools/javah/6257087/foo.sh
   70.39 +public class T6257087 {
   70.40 +
   70.41 +    private static final String fooBarGoldenFile =
   70.42 +        "/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
   70.43 +        "#include <jni.h>\n" +
   70.44 +        "/* Header for class foo_bar */\n" +
   70.45 +        "\n" +
   70.46 +        "#ifndef _Included_foo_bar\n" +
   70.47 +        "#define _Included_foo_bar\n" +
   70.48 +        "#ifdef __cplusplus\n" +
   70.49 +        "extern \"C\" {\n" +
   70.50 +        "#endif\n" +
   70.51 +        "/*\n" +
   70.52 +        " * Class:     foo_bar\n" +
   70.53 +        " * Method:    aardvark\n" +
   70.54 +        " * Signature: ()V\n" +
   70.55 +        " */\n" +
   70.56 +        "JNIEXPORT void JNICALL Java_foo_00024bar_aardvark\n" +
   70.57 +        "  (JNIEnv *, jobject);\n" +
   70.58 +        "\n" +
   70.59 +        "#ifdef __cplusplus\n" +
   70.60 +        "}\n" +
   70.61 +        "#endif\n" +
   70.62 +        "#endif";
   70.63 +
   70.64 +    public static void main(String[] args) throws Exception {
   70.65 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TC}" "${TS}${FS}foo.java"
   70.66 +
   70.67 +//        "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} -classpath "${TC}" -d "${TC}" foo
   70.68 +        ToolBox.JavaToolArgs javahArgs =
   70.69 +                new ToolBox.JavaToolArgs()
   70.70 +                .setAllArgs("-cp", System.getProperty("test.classes"), "foo");
   70.71 +        ToolBox.javah(javahArgs);
   70.72 +
   70.73 +//        diff ${DIFFOPTS} -c "${TS}${FS}foo_bar.h" "${TC}${FS}foo_bar.h"
   70.74 +        ToolBox.compareLines(Paths.get("foo_bar.h"),
   70.75 +                ToolBox.splitLines(fooBarGoldenFile), null);
   70.76 +    }
   70.77 +
   70.78 +}
   70.79 +
   70.80 +class foo {
   70.81 +    class bar {
   70.82 +        public native void aardvark();
   70.83 +    }
   70.84 +}
    71.1 --- a/test/tools/javah/6257087/foo.java	Tue Feb 19 00:31:45 2013 -0800
    71.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.3 @@ -1,29 +0,0 @@
    71.4 -/*
    71.5 - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
    71.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.7 - *
    71.8 - * This code is free software; you can redistribute it and/or modify it
    71.9 - * under the terms of the GNU General Public License version 2 only, as
   71.10 - * published by the Free Software Foundation.
   71.11 - *
   71.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   71.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   71.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   71.15 - * version 2 for more details (a copy is included in the LICENSE file that
   71.16 - * accompanied this code).
   71.17 - *
   71.18 - * You should have received a copy of the GNU General Public License version
   71.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   71.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   71.21 - *
   71.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   71.23 - * or visit www.oracle.com if you need additional information or have any
   71.24 - * questions.
   71.25 - */
   71.26 -
   71.27 -
   71.28 -class foo {
   71.29 -    class bar {
   71.30 -        public native void aardvark();
   71.31 -    }
   71.32 -}
    72.1 --- a/test/tools/javah/6257087/foo.sh	Tue Feb 19 00:31:45 2013 -0800
    72.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.3 @@ -1,74 +0,0 @@
    72.4 -#! /bin/sh -f
    72.5 -
    72.6 -#
    72.7 -# Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
    72.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.9 -#
   72.10 -# This code is free software; you can redistribute it and/or modify it
   72.11 -# under the terms of the GNU General Public License version 2 only, as
   72.12 -# published by the Free Software Foundation.
   72.13 -#
   72.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   72.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   72.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   72.17 -# version 2 for more details (a copy is included in the LICENSE file that
   72.18 -# accompanied this code).
   72.19 -#
   72.20 -# You should have received a copy of the GNU General Public License version
   72.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   72.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   72.23 -#
   72.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   72.25 -# or visit www.oracle.com if you need additional information or have any
   72.26 -# questions.
   72.27 -#
   72.28 -
   72.29 -# 
   72.30 -# @test
   72.31 -# @bug 6257087
   72.32 -# @run shell foo.sh
   72.33 -
   72.34 -
   72.35 -TS=${TESTSRC-.}
   72.36 -TC=${TESTCLASSES-.}
   72.37 -
   72.38 -if [ "${TESTJAVA}" = "" ]
   72.39 -then
   72.40 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   72.41 -  exit 1
   72.42 -fi
   72.43 -
   72.44 -# set platform-dependent variables
   72.45 -OS=`uname -s`
   72.46 -case "$OS" in
   72.47 -  SunOS | Linux | Darwin )
   72.48 -    PS=":"
   72.49 -    FS="/"
   72.50 -    ;;
   72.51 -  CYGWIN* )
   72.52 -    PS=":"
   72.53 -    FS="/"
   72.54 -    DIFFOPTS="--strip-trailing-cr"
   72.55 -    ;;
   72.56 -  Windows* )
   72.57 -    PS=";"
   72.58 -    FS="\\"
   72.59 -    ;;
   72.60 -  * )
   72.61 -    echo "Unrecognized system!"
   72.62 -    exit 1;
   72.63 -    ;;
   72.64 -esac
   72.65 -
   72.66 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TC}" "${TS}${FS}foo.java" 
   72.67 -"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} -classpath "${TC}" -d "${TC}" foo
   72.68 -diff ${DIFFOPTS} -c "${TS}${FS}foo_bar.h" "${TC}${FS}foo_bar.h"
   72.69 -result=$?
   72.70 -
   72.71 -if [ $result -eq 0 ]
   72.72 -then
   72.73 -  echo "Passed"
   72.74 -else
   72.75 -  echo "Failed"
   72.76 -fi
   72.77 -exit $result
    73.1 --- a/test/tools/javah/6257087/foo_bar.h	Tue Feb 19 00:31:45 2013 -0800
    73.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.3 @@ -1,21 +0,0 @@
    73.4 -/* DO NOT EDIT THIS FILE - it is machine generated */
    73.5 -#include <jni.h>
    73.6 -/* Header for class foo_bar */
    73.7 -
    73.8 -#ifndef _Included_foo_bar
    73.9 -#define _Included_foo_bar
   73.10 -#ifdef __cplusplus
   73.11 -extern "C" {
   73.12 -#endif
   73.13 -/*
   73.14 - * Class:     foo_bar
   73.15 - * Method:    aardvark
   73.16 - * Signature: ()V
   73.17 - */
   73.18 -JNIEXPORT void JNICALL Java_foo_00024bar_aardvark
   73.19 -  (JNIEnv *, jobject);
   73.20 -
   73.21 -#ifdef __cplusplus
   73.22 -}
   73.23 -#endif
   73.24 -#endif
    74.1 --- a/test/tools/javah/ConstMacroTest.sh	Tue Feb 19 00:31:45 2013 -0800
    74.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.3 @@ -1,102 +0,0 @@
    74.4 -#!/bin/sh
    74.5 -
    74.6 -#
    74.7 -# Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
    74.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    74.9 -#
   74.10 -# This code is free software; you can redistribute it and/or modify it
   74.11 -# under the terms of the GNU General Public License version 2 only, as
   74.12 -# published by the Free Software Foundation.
   74.13 -#
   74.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   74.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   74.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   74.17 -# version 2 for more details (a copy is included in the LICENSE file that
   74.18 -# accompanied this code).
   74.19 -#
   74.20 -# You should have received a copy of the GNU General Public License version
   74.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   74.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   74.23 -#
   74.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   74.25 -# or visit www.oracle.com if you need additional information or have any
   74.26 -# questions.
   74.27 -#
   74.28 -
   74.29 -# @test	
   74.30 -#
   74.31 -# @bug 4786406 4781221 4780341 6214324
   74.32 -
   74.33 -# Validates rewritten javah handling of class defined constants
   74.34 -# and ensures that the appropriate macro definitions are placed
   74.35 -# in the generated header file.
   74.36 -
   74.37 -if [ "${TESTSRC}" = "" ]
   74.38 -then
   74.39 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   74.40 -  exit 1
   74.41 -fi
   74.42 -echo "TESTSRC=${TESTSRC}"
   74.43 -if [ "${TESTJAVA}" = "" ]
   74.44 -then
   74.45 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   74.46 -  exit 1
   74.47 -fi
   74.48 -echo "TESTJAVA=${TESTJAVA}"
   74.49 -if [ "${TESTCLASSES}" = "" ]
   74.50 -then
   74.51 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   74.52 -  exit 1
   74.53 -fi
   74.54 -echo "TESTCLASSES=${TESTCLASSES}"
   74.55 -echo "CLASSPATH=${CLASSPATH}"
   74.56 -
   74.57 -EXPECTED_JAVAH_OUT_FILE=SubClassConsts.out
   74.58 -
   74.59 -# set platform-dependent variables
   74.60 -OS=`uname -s`
   74.61 -case "$OS" in
   74.62 -  SunOS | Linux | Darwin )
   74.63 -    PS=":"
   74.64 -    FS="/"
   74.65 -    ;;
   74.66 -  CYGWIN* )
   74.67 -    PS=":"
   74.68 -    FS="/"
   74.69 -    DIFFOPTS="--strip-trailing-cr"
   74.70 -    EXPECTED_JAVAH_OUT_FILE=SubClassConsts.win
   74.71 -    ;;
   74.72 -  Windows* )
   74.73 -    PS=";"
   74.74 -    FS="\\"
   74.75 -    EXPECTED_JAVAH_OUT_FILE=SubClassConsts.win
   74.76 -    ;;
   74.77 -  * )
   74.78 -    echo "Unrecognized system!"
   74.79 -    exit 1;
   74.80 -    ;;
   74.81 - esac
   74.82 -
   74.83 -GENERATED_HEADER_FILE=SubClassConsts.h
   74.84 -HEADER_FILE_FILTERED=SubClassConsts.h.linefeed-filtered
   74.85 -
   74.86 -rm -rf SuperClassConsts.class SubClassConsts.class
   74.87 -
   74.88 -cp "${TESTSRC}${FS}SuperClassConsts.java" .
   74.89 -cp "${TESTSRC}${FS}SubClassConsts.java" .
   74.90 -
   74.91 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}SubClassConsts.java"
   74.92 -
   74.93 -"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} SubClassConsts
   74.94 -
   74.95 -diff ${DIFFOPTS} "${TESTSRC}${FS}${EXPECTED_JAVAH_OUT_FILE}" "${GENERATED_HEADER_FILE}"
   74.96 -result=$?
   74.97 -rm ${GENERATED_HEADER_FILE}
   74.98 -
   74.99 -if [ $result -eq 0 ]
  74.100 -then
  74.101 -  echo "Passed"
  74.102 -else
  74.103 -  echo "Failed"
  74.104 -fi
  74.105 -exit $result
    75.1 --- a/test/tools/javah/MissingParamClassException.java	Tue Feb 19 00:31:45 2013 -0800
    75.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.3 @@ -1,35 +0,0 @@
    75.4 -/*
    75.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
    75.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.7 - *
    75.8 - * This code is free software; you can redistribute it and/or modify it
    75.9 - * under the terms of the GNU General Public License version 2 only, as
   75.10 - * published by the Free Software Foundation.
   75.11 - *
   75.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   75.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   75.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   75.15 - * version 2 for more details (a copy is included in the LICENSE file that
   75.16 - * accompanied this code).
   75.17 - *
   75.18 - * You should have received a copy of the GNU General Public License version
   75.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   75.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   75.21 - *
   75.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   75.23 - * or visit www.oracle.com if you need additional information or have any
   75.24 - * questions.
   75.25 - */
   75.26 -
   75.27 -
   75.28 -/*
   75.29 - * ParamClassTest has a native method param which subclasses
   75.30 - * this class
   75.31 - *
   75.32 - */
   75.33 -
   75.34 -public class MissingParamClassException extends Exception {
   75.35 -    public MissingParamClassException() {
   75.36 -        System.out.println("MissingParamClassException constructor called");
   75.37 -    }
   75.38 -}
    76.1 --- a/test/tools/javah/MissingParamClassTest.sh	Tue Feb 19 00:31:45 2013 -0800
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,124 +0,0 @@
    76.4 -#!/bin/sh
    76.5 -
    76.6 -#
    76.7 -# Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
    76.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    76.9 -#
   76.10 -# This code is free software; you can redistribute it and/or modify it
   76.11 -# under the terms of the GNU General Public License version 2 only, as
   76.12 -# published by the Free Software Foundation.
   76.13 -#
   76.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   76.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   76.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   76.17 -# version 2 for more details (a copy is included in the LICENSE file that
   76.18 -# accompanied this code).
   76.19 -#
   76.20 -# You should have received a copy of the GNU General Public License version
   76.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   76.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   76.23 -#
   76.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   76.25 -# or visit www.oracle.com if you need additional information or have any
   76.26 -# questions.
   76.27 -#
   76.28 -
   76.29 -# @test	
   76.30 -#
   76.31 -# @bug 4942232
   76.32 -
   76.33 -#
   76.34 -# Verifies that javah won't attempt to generate a header file
   76.35 -# if a native method in a supplied class contains a parameter
   76.36 -# type whose corresponding class is missing or not in the 
   76.37 -# classpath
   76.38 -
   76.39 -TMP1=OUTPUT.txt
   76.40 -
   76.41 -if [ "${TESTSRC}" = "" ]
   76.42 -then
   76.43 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   76.44 -  exit 1
   76.45 -fi
   76.46 -echo "TESTSRC=${TESTSRC}"
   76.47 -if [ "${TESTJAVA}" = "" ]
   76.48 -then
   76.49 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   76.50 -  exit 1
   76.51 -fi
   76.52 -echo "TESTJAVA=${TESTJAVA}"
   76.53 -if [ "${TESTCLASSES}" = "" ]
   76.54 -then
   76.55 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   76.56 -  exit 1
   76.57 -fi
   76.58 -echo "TESTCLASSES=${TESTCLASSES}"
   76.59 -echo "CLASSPATH=${CLASSPATH}"
   76.60 -
   76.61 -# set platform-dependent variables
   76.62 -OS=`uname -s`
   76.63 -case "$OS" in
   76.64 -  SunOS | Linux | Darwin | CYGWIN* )
   76.65 -    PS=":"
   76.66 -    FS="/"
   76.67 -    ;;
   76.68 -  Windows* )
   76.69 -    PS=";"
   76.70 -    FS="\\"
   76.71 -    ;;
   76.72 -  * )
   76.73 -    echo "Unrecognized system!"
   76.74 -    exit 1;
   76.75 -    ;;
   76.76 - esac
   76.77 -
   76.78 -GENERATED_HEADER_FILE=ParamClassTest.h
   76.79 -
   76.80 -rm -f ParamClassTest.class MissingParamClassException.class ParamClassTest.h
   76.81 -rm -f ${TMP1}
   76.82 -
   76.83 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
   76.84 -
   76.85 -# Before running javah remove dependent class file
   76.86 -rm -f MissingParamClassException.class 
   76.87 -
   76.88 -"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
   76.89 -
   76.90 -if [ -f $GENERATED_HEADER_FILE ]; then
   76.91 -     echo "1-- Failed: $GENERATED_HEADER_FILE found"
   76.92 -     rc=1
   76.93 -fi
   76.94 -if [ ! -s ${TMP1} ]; then
   76.95 -     echo "1-- Failed: ${TMP1} is empty"
   76.96 -     rc=1
   76.97 -fi
   76.98 -
   76.99 -# Clean out work dir
  76.100 -rm -f MissingParamClassException.class ParamClassTest.class
  76.101 -rm -f $GENERATED_HEADER_FILE $TMP1 
  76.102 -
  76.103 -# Re-compile everything
  76.104 -
  76.105 -"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
  76.106 -
  76.107 -
  76.108 -# Before re-run of javah remove dependent class file Param.class 
  76.109 -rm -f Param.class
  76.110 -
  76.111 -"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
  76.112 -
  76.113 -if [ -f $GENERATED_HEADER_FILE ]; then
  76.114 -     echo "2-- Failed: $GENERATED_HEADER_FILE found"
  76.115 -     rc=1
  76.116 -fi
  76.117 -if [ ! -s ${TMP1} ]; then
  76.118 -     echo "2-- Failed: ${TMP1} is empty"
  76.119 -     rc=1
  76.120 -fi
  76.121 -
  76.122 -if [ "$rc" = "" ]; then
  76.123 -    echo Passed
  76.124 -else
  76.125 -    echo Failed
  76.126 -    exit 1
  76.127 -fi
    77.1 --- a/test/tools/javah/ParamClassTest.java	Tue Feb 19 00:31:45 2013 -0800
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,41 +0,0 @@
    77.4 -/*
    77.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
    77.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 - *
    77.8 - * This code is free software; you can redistribute it and/or modify it
    77.9 - * under the terms of the GNU General Public License version 2 only, as
   77.10 - * published by the Free Software Foundation.
   77.11 - *
   77.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 - * version 2 for more details (a copy is included in the LICENSE file that
   77.16 - * accompanied this code).
   77.17 - *
   77.18 - * You should have received a copy of the GNU General Public License version
   77.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 - *
   77.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 - * or visit www.oracle.com if you need additional information or have any
   77.24 - * questions.
   77.25 - */
   77.26 -
   77.27 -
   77.28 -/*
   77.29 - * Class containing a native method which contains a native
   77.30 - * method with non primitive type
   77.31 - */
   77.32 -
   77.33 -public class ParamClassTest {
   77.34 -    public native void method(Param s);
   77.35 -
   77.36 -    public static void main(String args[]) {
   77.37 -    }
   77.38 -}
   77.39 -
   77.40 -class Param extends MissingParamClassException {
   77.41 -    Param() {
   77.42 -        System.out.println("Param constructor");
   77.43 -    }
   77.44 -}
    78.1 --- a/test/tools/javah/SubClassConsts.java	Tue Feb 19 00:31:45 2013 -0800
    78.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.3 @@ -1,40 +0,0 @@
    78.4 -/*
    78.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
    78.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    78.7 - *
    78.8 - * This code is free software; you can redistribute it and/or modify it
    78.9 - * under the terms of the GNU General Public License version 2 only, as
   78.10 - * published by the Free Software Foundation.
   78.11 - *
   78.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   78.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   78.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   78.15 - * version 2 for more details (a copy is included in the LICENSE file that
   78.16 - * accompanied this code).
   78.17 - *
   78.18 - * You should have received a copy of the GNU General Public License version
   78.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   78.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   78.21 - *
   78.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   78.23 - * or visit www.oracle.com if you need additional information or have any
   78.24 - * questions.
   78.25 - */
   78.26 -
   78.27 -
   78.28 -/*
   78.29 - * Subclass defines its own set of constants
   78.30 - * It is itself serializable by virtue of extending SuperClassConsts
   78.31 - *
   78.32 - */
   78.33 -public class SubClassConsts extends SuperClassConsts {
   78.34 -
   78.35 -    private final static int SUB_INT_CONSTANT = 2;
   78.36 -    private final static double SUB_DOUBLE_CONSTANT = 2.25;
   78.37 -    private final static float SUB_FLOAT_CONSTANT = 7.90f;
   78.38 -    private final static boolean SUB_BOOLEAN_CONSTANT = true;
   78.39 -
   78.40 -    public SubClassConsts(String p) {
   78.41 -        super(p);
   78.42 -    }
   78.43 -}
    79.1 --- a/test/tools/javah/SubClassConsts.out	Tue Feb 19 00:31:45 2013 -0800
    79.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.3 @@ -1,31 +0,0 @@
    79.4 -/* DO NOT EDIT THIS FILE - it is machine generated */
    79.5 -#include <jni.h>
    79.6 -/* Header for class SubClassConsts */
    79.7 -
    79.8 -#ifndef _Included_SubClassConsts
    79.9 -#define _Included_SubClassConsts
   79.10 -#ifdef __cplusplus
   79.11 -extern "C" {
   79.12 -#endif
   79.13 -#undef SubClassConsts_serialVersionUID
   79.14 -#define SubClassConsts_serialVersionUID 6733861379283244755LL
   79.15 -#undef SubClassConsts_SUPER_INT_CONSTANT
   79.16 -#define SubClassConsts_SUPER_INT_CONSTANT 3L
   79.17 -#undef SubClassConsts_SUPER_FLOAT_CONSTANT
   79.18 -#define SubClassConsts_SUPER_FLOAT_CONSTANT 99.3f
   79.19 -#undef SubClassConsts_SUPER_DOUBLE_CONSTANT
   79.20 -#define SubClassConsts_SUPER_DOUBLE_CONSTANT 33.2
   79.21 -#undef SubClassConsts_SUPER_BOOLEAN_CONSTANT
   79.22 -#define SubClassConsts_SUPER_BOOLEAN_CONSTANT 0L
   79.23 -#undef SubClassConsts_SUB_INT_CONSTANT
   79.24 -#define SubClassConsts_SUB_INT_CONSTANT 2L
   79.25 -#undef SubClassConsts_SUB_DOUBLE_CONSTANT
   79.26 -#define SubClassConsts_SUB_DOUBLE_CONSTANT 2.25
   79.27 -#undef SubClassConsts_SUB_FLOAT_CONSTANT
   79.28 -#define SubClassConsts_SUB_FLOAT_CONSTANT 7.9f
   79.29 -#undef SubClassConsts_SUB_BOOLEAN_CONSTANT
   79.30 -#define SubClassConsts_SUB_BOOLEAN_CONSTANT 1L
   79.31 -#ifdef __cplusplus
   79.32 -}
   79.33 -#endif
   79.34 -#endif
    80.1 --- a/test/tools/javah/SubClassConsts.win	Tue Feb 19 00:31:45 2013 -0800
    80.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.3 @@ -1,31 +0,0 @@
    80.4 -/* DO NOT EDIT THIS FILE - it is machine generated */
    80.5 -#include <jni.h>
    80.6 -/* Header for class SubClassConsts */
    80.7 -
    80.8 -#ifndef _Included_SubClassConsts
    80.9 -#define _Included_SubClassConsts
   80.10 -#ifdef __cplusplus
   80.11 -extern "C" {
   80.12 -#endif
   80.13 -#undef SubClassConsts_serialVersionUID
   80.14 -#define SubClassConsts_serialVersionUID 6733861379283244755i64
   80.15 -#undef SubClassConsts_SUPER_INT_CONSTANT
   80.16 -#define SubClassConsts_SUPER_INT_CONSTANT 3L
   80.17 -#undef SubClassConsts_SUPER_FLOAT_CONSTANT
   80.18 -#define SubClassConsts_SUPER_FLOAT_CONSTANT 99.3f
   80.19 -#undef SubClassConsts_SUPER_DOUBLE_CONSTANT
   80.20 -#define SubClassConsts_SUPER_DOUBLE_CONSTANT 33.2
   80.21 -#undef SubClassConsts_SUPER_BOOLEAN_CONSTANT
   80.22 -#define SubClassConsts_SUPER_BOOLEAN_CONSTANT 0L
   80.23 -#undef SubClassConsts_SUB_INT_CONSTANT
   80.24 -#define SubClassConsts_SUB_INT_CONSTANT 2L
   80.25 -#undef SubClassConsts_SUB_DOUBLE_CONSTANT
   80.26 -#define SubClassConsts_SUB_DOUBLE_CONSTANT 2.25
   80.27 -#undef SubClassConsts_SUB_FLOAT_CONSTANT
   80.28 -#define SubClassConsts_SUB_FLOAT_CONSTANT 7.9f
   80.29 -#undef SubClassConsts_SUB_BOOLEAN_CONSTANT
   80.30 -#define SubClassConsts_SUB_BOOLEAN_CONSTANT 1L
   80.31 -#ifdef __cplusplus
   80.32 -}
   80.33 -#endif
   80.34 -#endif
    81.1 --- a/test/tools/javah/SuperClassConsts.java	Tue Feb 19 00:31:45 2013 -0800
    81.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.3 @@ -1,66 +0,0 @@
    81.4 -/*
    81.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
    81.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    81.7 - *
    81.8 - * This code is free software; you can redistribute it and/or modify it
    81.9 - * under the terms of the GNU General Public License version 2 only, as
   81.10 - * published by the Free Software Foundation.
   81.11 - *
   81.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   81.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   81.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   81.15 - * version 2 for more details (a copy is included in the LICENSE file that
   81.16 - * accompanied this code).
   81.17 - *
   81.18 - * You should have received a copy of the GNU General Public License version
   81.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   81.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   81.21 - *
   81.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   81.23 - * or visit www.oracle.com if you need additional information or have any
   81.24 - * questions.
   81.25 - */
   81.26 -
   81.27 -
   81.28 -/*
   81.29 - * Parent class implements serializable and provides static initializers
   81.30 - * for a bunch of primitive type class constants
   81.31 - * (required for regtest 4786406, 4780341)
   81.32 - */
   81.33 -
   81.34 -import java.io.*;
   81.35 -
   81.36 -public class SuperClassConsts implements Serializable {
   81.37 -
   81.38 -    // Define class constant values, base class is serializable
   81.39 -
   81.40 -    private static final long serialVersionUID = 6733861379283244755L;
   81.41 -    public static final int SUPER_INT_CONSTANT = 3;
   81.42 -    public final static float SUPER_FLOAT_CONSTANT = 99.3f;
   81.43 -    public final static double SUPER_DOUBLE_CONSTANT  = 33.2;
   81.44 -    public final static boolean SUPER_BOOLEAN_CONSTANT  = false;
   81.45 -
   81.46 -    // A token instance field
   81.47 -    int instanceField;
   81.48 -
   81.49 -    public SuperClassConsts(String p) {
   81.50 -    }
   81.51 -
   81.52 -    public native int numValues();
   81.53 -
   81.54 -    private void writeObject(ObjectOutputStream s)
   81.55 -        throws IOException
   81.56 -    {
   81.57 -        System.err.println("writing state");
   81.58 -    }
   81.59 -
   81.60 -    /**
   81.61 -     * readObject is called to restore the state of the FilePermission from
   81.62 -     * a stream.
   81.63 -     */
   81.64 -    private void readObject(ObjectInputStream s)
   81.65 -         throws IOException, ClassNotFoundException
   81.66 -    {
   81.67 -        System.err.println("reading back state");
   81.68 -    }
   81.69 -}
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/test/tools/javah/T4942232/MissingParamClassTest.java	Tue Feb 19 17:53:16 2013 +0000
    82.3 @@ -0,0 +1,89 @@
    82.4 +/*
    82.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    82.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    82.7 + *
    82.8 + * This code is free software; you can redistribute it and/or modify it
    82.9 + * under the terms of the GNU General Public License version 2 only, as
   82.10 + * published by the Free Software Foundation.
   82.11 + *
   82.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   82.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   82.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   82.15 + * version 2 for more details (a copy is included in the LICENSE file that
   82.16 + * accompanied this code).
   82.17 + *
   82.18 + * You should have received a copy of the GNU General Public License version
   82.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   82.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   82.21 + *
   82.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   82.23 + * or visit www.oracle.com if you need additional information or have any
   82.24 + * questions.
   82.25 + */
   82.26 +
   82.27 +/*
   82.28 + * @test
   82.29 + * @bug 4942232
   82.30 + * @summary Verifies that javah won't attempt to generate a header file if a
   82.31 + * native method in a supplied class contains a parameter type whose corresponding
   82.32 + * class is missing or not in the classpath
   82.33 + * @library /tools/javac/lib
   82.34 + * @build ToolBox
   82.35 + * @run compile MissingParamClassTest.java
   82.36 + * @clean MissingParamClassException
   82.37 + * @run main MissingParamClassTest
   82.38 + * @run compile MissingParamClassTest.java
   82.39 + * @clean Param
   82.40 + * @run main MissingParamClassTest
   82.41 + */
   82.42 +
   82.43 +import java.nio.file.Files;
   82.44 +import java.nio.file.Paths;
   82.45 +import java.util.ArrayList;
   82.46 +import java.util.List;
   82.47 +
   82.48 +//original test: test/tools/javah/MissingParamClassTest.sh
   82.49 +public class MissingParamClassTest {
   82.50 +
   82.51 +    public static void main(String[] args) throws Exception {
   82.52 +        //first steps done now by jtreg
   82.53 +//"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}ParamClassTest.java" "${TESTSRC}${FS}MissingParamClassException.java"
   82.54 +//rm -f MissingParamClassException.class
   82.55 +
   82.56 +//"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} ParamClassTest 2>${TMP1}
   82.57 +        List<String> errOutput = new ArrayList<>();
   82.58 +        ToolBox.JavaToolArgs javahParams =
   82.59 +            new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL)
   82.60 +            .setAllArgs("-classpath", System.getProperty("test.classes"), "ParamClassTest")
   82.61 +            .setErrOutput(errOutput);
   82.62 +        ToolBox.javah(javahParams);
   82.63 +
   82.64 +//if [ -f $GENERATED_HEADER_FILE ]; then  fail
   82.65 +//if [ ! -s ${TMP1} ]; then fail
   82.66 +        if (Files.exists(Paths.get("ParamClassTest.h")) || errOutput.size() == 0)
   82.67 +            throw new AssertionError("The only output generated by javah must be an error message");
   82.68 +        //jtreg again
   82.69 +//rm -f MissingParamClassException.class ParamClassTest.class
   82.70 +//rm -f $GENERATED_HEADER_FILE $TMP1
   82.71 +    }
   82.72 +
   82.73 +}
   82.74 +
   82.75 +class MissingParamClassException extends Exception {
   82.76 +    public MissingParamClassException() {
   82.77 +        System.out.println("MissingParamClassException constructor called");
   82.78 +    }
   82.79 +}
   82.80 +
   82.81 +class ParamClassTest {
   82.82 +    public native void method(Param s);
   82.83 +
   82.84 +    public static void main(String args[]) {
   82.85 +    }
   82.86 +}
   82.87 +
   82.88 +class Param extends MissingParamClassException {
   82.89 +    Param() {
   82.90 +        System.out.println("Param constructor");
   82.91 +    }
   82.92 +}
    83.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    83.2 +++ b/test/tools/javah/constMacroTest/ConstMacroTest.java	Tue Feb 19 17:53:16 2013 +0000
    83.3 @@ -0,0 +1,112 @@
    83.4 +/*
    83.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    83.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.7 + *
    83.8 + * This code is free software; you can redistribute it and/or modify it
    83.9 + * under the terms of the GNU General Public License version 2 only, as
   83.10 + * published by the Free Software Foundation.
   83.11 + *
   83.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   83.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   83.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   83.15 + * version 2 for more details (a copy is included in the LICENSE file that
   83.16 + * accompanied this code).
   83.17 + *
   83.18 + * You should have received a copy of the GNU General Public License version
   83.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   83.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   83.21 + *
   83.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   83.23 + * or visit www.oracle.com if you need additional information or have any
   83.24 + * questions.
   83.25 + */
   83.26 +
   83.27 +/*
   83.28 + * @test
   83.29 + * @bug 4786406 4781221 4780341 6214324
   83.30 + * @summary Validates rewritten javah handling of class defined constants and
   83.31 + * ensures that the appropriate macro definitions are placed in the generated
   83.32 + * header file.
   83.33 + * @library /tools/javac/lib
   83.34 + * @build ToolBox
   83.35 + * @run main ConstMacroTest
   83.36 + */
   83.37 +
   83.38 +import java.io.*;
   83.39 +import java.nio.file.Paths;
   83.40 +
   83.41 +//original test: test/tools/javah/ConstMacroTest.sh
   83.42 +public class ConstMacroTest {
   83.43 +
   83.44 +    private static final String SubClassConstsGoldenFile =
   83.45 +        "/* DO NOT EDIT THIS FILE - it is machine generated */\n" +
   83.46 +        "#include <jni.h>\n" +
   83.47 +        "/* Header for class SubClassConsts */\n" +
   83.48 +        "\n" +
   83.49 +        "#ifndef _Included_SubClassConsts\n" +
   83.50 +        "#define _Included_SubClassConsts\n" +
   83.51 +        "#ifdef __cplusplus\n" +
   83.52 +        "extern \"C\" {\n" +
   83.53 +        "#endif\n" +
   83.54 +        "#undef SubClassConsts_serialVersionUID\n" +
   83.55 +        "#define SubClassConsts_serialVersionUID 6733861379283244755LL\n" +
   83.56 +        "#undef SubClassConsts_SUPER_INT_CONSTANT\n" +
   83.57 +        "#define SubClassConsts_SUPER_INT_CONSTANT 3L\n" +
   83.58 +        "#undef SubClassConsts_SUPER_FLOAT_CONSTANT\n" +
   83.59 +        "#define SubClassConsts_SUPER_FLOAT_CONSTANT 99.3f\n" +
   83.60 +        "#undef SubClassConsts_SUPER_DOUBLE_CONSTANT\n" +
   83.61 +        "#define SubClassConsts_SUPER_DOUBLE_CONSTANT 33.2\n" +
   83.62 +        "#undef SubClassConsts_SUPER_BOOLEAN_CONSTANT\n" +
   83.63 +        "#define SubClassConsts_SUPER_BOOLEAN_CONSTANT 0L\n" +
   83.64 +        "#undef SubClassConsts_SUB_INT_CONSTANT\n" +
   83.65 +        "#define SubClassConsts_SUB_INT_CONSTANT 2L\n" +
   83.66 +        "#undef SubClassConsts_SUB_DOUBLE_CONSTANT\n" +
   83.67 +        "#define SubClassConsts_SUB_DOUBLE_CONSTANT 2.25\n" +
   83.68 +        "#undef SubClassConsts_SUB_FLOAT_CONSTANT\n" +
   83.69 +        "#define SubClassConsts_SUB_FLOAT_CONSTANT 7.9f\n" +
   83.70 +        "#undef SubClassConsts_SUB_BOOLEAN_CONSTANT\n" +
   83.71 +        "#define SubClassConsts_SUB_BOOLEAN_CONSTANT 1L\n" +
   83.72 +        "#ifdef __cplusplus\n" +
   83.73 +        "}\n" +
   83.74 +        "#endif\n" +
   83.75 +        "#endif";
   83.76 +
   83.77 +    public static void main(String[] args) throws Exception {
   83.78 +        //first steps are now done by jtreg
   83.79 +//        cp "${TESTSRC}${FS}SuperClassConsts.java" .
   83.80 +//        cp "${TESTSRC}${FS}SubClassConsts.java" .
   83.81 +
   83.82 +//        "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d . "${TESTSRC}${FS}SubClassConsts.java"
   83.83 +
   83.84 +//        "${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} SubClassConsts
   83.85 +        ToolBox.JavaToolArgs successParams =
   83.86 +                new ToolBox.JavaToolArgs()
   83.87 +                .setAllArgs("-cp", System.getProperty("test.classes"), "SubClassConsts");
   83.88 +        ToolBox.javah(successParams);
   83.89 +
   83.90 +//        diff ${DIFFOPTS} "${TESTSRC}${FS}${EXPECTED_JAVAH_OUT_FILE}" "${GENERATED_HEADER_FILE}"
   83.91 +        ToolBox.compareLines(Paths.get("SubClassConsts.h"),
   83.92 +                ToolBox.splitLines(SubClassConstsGoldenFile), null);
   83.93 +    }
   83.94 +
   83.95 +}
   83.96 +
   83.97 +class SuperClassConsts implements Serializable {
   83.98 +    // Define class constant values, base class is serializable
   83.99 +    private static final long serialVersionUID = 6733861379283244755L;
  83.100 +    public static final int SUPER_INT_CONSTANT = 3;
  83.101 +    public final static float SUPER_FLOAT_CONSTANT = 99.3f;
  83.102 +    public final static double SUPER_DOUBLE_CONSTANT  = 33.2;
  83.103 +    public final static boolean SUPER_BOOLEAN_CONSTANT  = false;
  83.104 +    // A token instance field
  83.105 +    int instanceField;
  83.106 +
  83.107 +    public native int numValues();
  83.108 +}
  83.109 +
  83.110 +class SubClassConsts extends SuperClassConsts {
  83.111 +    private final static int SUB_INT_CONSTANT = 2;
  83.112 +    private final static double SUB_DOUBLE_CONSTANT = 2.25;
  83.113 +    private final static float SUB_FLOAT_CONSTANT = 7.90f;
  83.114 +    private final static boolean SUB_BOOLEAN_CONSTANT = true;
  83.115 +}
    84.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    84.2 +++ b/test/tools/javap/4798312/JavapShouldLoadClassesFromRTJarTest.java	Tue Feb 19 17:53:16 2013 +0000
    84.3 @@ -0,0 +1,43 @@
    84.4 +/*
    84.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    84.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.7 + *
    84.8 + * This code is free software; you can redistribute it and/or modify it
    84.9 + * under the terms of the GNU General Public License version 2 only, as
   84.10 + * published by the Free Software Foundation.
   84.11 + *
   84.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   84.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   84.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   84.15 + * version 2 for more details (a copy is included in the LICENSE file that
   84.16 + * accompanied this code).
   84.17 + *
   84.18 + * You should have received a copy of the GNU General Public License version
   84.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   84.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   84.21 + *
   84.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   84.23 + * or visit www.oracle.com if you need additional information or have any
   84.24 + * questions.
   84.25 + */
   84.26 +
   84.27 +/*
   84.28 + * @test
   84.29 + * @bug 4798312
   84.30 + * @summary In Windows, javap doesnt load classes from rt.jar
   84.31 + * @library /tools/javac/lib
   84.32 + * @build ToolBox
   84.33 + * @run main JavapShouldLoadClassesFromRTJarTest
   84.34 + */
   84.35 +public class JavapShouldLoadClassesFromRTJarTest {
   84.36 +
   84.37 +    public static void main(String[] args) throws Exception {
   84.38 +//        "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} java.lang.String
   84.39 +        ToolBox.JavaToolArgs params =
   84.40 +                new ToolBox.JavaToolArgs().
   84.41 +                setAllArgs("-v", "java.lang.String");
   84.42 +        if (ToolBox.javap(params).isEmpty())
   84.43 +            throw new AssertionError("javap generated no output");
   84.44 +    }
   84.45 +
   84.46 +}
    85.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    85.2 +++ b/test/tools/javap/4866831/PublicInterfaceTest.java	Tue Feb 19 17:53:16 2013 +0000
    85.3 @@ -0,0 +1,52 @@
    85.4 +
    85.5 +import java.nio.file.Path;
    85.6 +import java.nio.file.Paths;
    85.7 +
    85.8 +/*
    85.9 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   85.10 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   85.11 + *
   85.12 + * This code is free software; you can redistribute it and/or modify it
   85.13 + * under the terms of the GNU General Public License version 2 only, as
   85.14 + * published by the Free Software Foundation.
   85.15 + *
   85.16 + * This code is distributed in the hope that it will be useful, but WITHOUT
   85.17 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   85.18 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   85.19 + * version 2 for more details (a copy is included in the LICENSE file that
   85.20 + * accompanied this code).
   85.21 + *
   85.22 + * You should have received a copy of the GNU General Public License version
   85.23 + * 2 along with this work; if not, write to the Free Software Foundation,
   85.24 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   85.25 + *
   85.26 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   85.27 + * or visit www.oracle.com if you need additional information or have any
   85.28 + * questions.
   85.29 + */
   85.30 +
   85.31 +/*
   85.32 + * @test
   85.33 + * @bug 4866831
   85.34 + * @summary Verify that javap marks public interfaces as public
   85.35 + * @library /tools/javac/lib
   85.36 + * @build ToolBox
   85.37 + * @run main PublicInterfaceTest
   85.38 + */
   85.39 +
   85.40 +//original test: test/tools/javap/PublicInterfaceTest.sh
   85.41 +public class PublicInterfaceTest {
   85.42 +    public interface Test {}
   85.43 +
   85.44 +    public static void main(String[] args) throws Exception {
   85.45 +//        "$JAVAP" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" NotPackagePrivateInterface | grep public
   85.46 +        Path pathToClass = Paths.get(System.getProperty("test.classes"),
   85.47 +                "PublicInterfaceTest$Test.class");
   85.48 +        ToolBox.JavaToolArgs javapParams =
   85.49 +                new ToolBox.JavaToolArgs()
   85.50 +                .setAllArgs(pathToClass.toString());
   85.51 +        if (!ToolBox.javap(javapParams).contains("public"))
   85.52 +            throw new AssertionError("The javap output does not contain \"public\"");
   85.53 +    }
   85.54 +
   85.55 +}
    86.1 --- a/test/tools/javap/NotPackagePrivateInterface.java	Tue Feb 19 00:31:45 2013 -0800
    86.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    86.3 @@ -1,34 +0,0 @@
    86.4 -/*
    86.5 - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
    86.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    86.7 - *
    86.8 - * This code is free software; you can redistribute it and/or modify it
    86.9 - * under the terms of the GNU General Public License version 2 only, as
   86.10 - * published by the Free Software Foundation.
   86.11 - *
   86.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   86.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   86.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   86.15 - * version 2 for more details (a copy is included in the LICENSE file that
   86.16 - * accompanied this code).
   86.17 - *
   86.18 - * You should have received a copy of the GNU General Public License version
   86.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   86.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   86.21 - *
   86.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   86.23 - * or visit www.oracle.com if you need additional information or have any
   86.24 - * questions.
   86.25 - */
   86.26 -
   86.27 -
   86.28 -/*
   86.29 - * This class is used by PublicInterfaceTest.sh to generate a class
   86.30 - * file with a public interface to verify javap will output the
   86.31 - * "public" modifier for such interfaces.  (At the vm level, the only
   86.32 - * access control properties an interface can can have are public and
   86.33 - * package private.)
   86.34 - */
   86.35 -
   86.36 -public interface NotPackagePrivateInterface {
   86.37 -}
    87.1 --- a/test/tools/javap/PublicInterfaceTest.sh	Tue Feb 19 00:31:45 2013 -0800
    87.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    87.3 @@ -1,62 +0,0 @@
    87.4 -#!/bin/sh
    87.5 -
    87.6 -#
    87.7 -# Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
    87.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    87.9 -#
   87.10 -# This code is free software; you can redistribute it and/or modify it
   87.11 -# under the terms of the GNU General Public License version 2 only, as
   87.12 -# published by the Free Software Foundation.
   87.13 -#
   87.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   87.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   87.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   87.17 -# version 2 for more details (a copy is included in the LICENSE file that
   87.18 -# accompanied this code).
   87.19 -#
   87.20 -# You should have received a copy of the GNU General Public License version
   87.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   87.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   87.23 -#
   87.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   87.25 -# or visit www.oracle.com if you need additional information or have any
   87.26 -# questions.
   87.27 -#
   87.28 -
   87.29 -# @test
   87.30 -# @bug 4866831
   87.31 -# @build NotPackagePrivateInterface
   87.32 -# @run shell PublicInterfaceTest.sh
   87.33 -# @summary Verify that javap marks public interfaces as public
   87.34 -# @author Joseph D. Darcy
   87.35 -
   87.36 -# Verify directory context variables are set
   87.37 -if [ "${TESTJAVA}" = "" ]
   87.38 -then
   87.39 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   87.40 -  exit 1
   87.41 -fi
   87.42 -
   87.43 -if [ "${TESTCLASSES}" = "" ]
   87.44 -then
   87.45 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   87.46 -  exit 1
   87.47 -fi
   87.48 -
   87.49 -JAVAP="${TESTJAVA}/bin/javap"
   87.50 -
   87.51 -"$JAVAP" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" NotPackagePrivateInterface | grep public
   87.52 -
   87.53 -# If the exit status of grep is 0, then "public" was correctly found
   87.54 -# in the output of javap.
   87.55 -
   87.56 -RESULT=$?
   87.57 -case "$RESULT" in
   87.58 -        0  )
   87.59 -	exit 0;
   87.60 -        ;;
   87.61 -
   87.62 -        * )
   87.63 -        echo "The javap tool did not output \"public\" for a public interface."
   87.64 -        exit 1
   87.65 -esac
    88.1 --- a/test/tools/javap/pathsep.sh	Tue Feb 19 00:31:45 2013 -0800
    88.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    88.3 @@ -1,63 +0,0 @@
    88.4 -#!/bin/sh
    88.5 -
    88.6 -#
    88.7 -# Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
    88.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    88.9 -#
   88.10 -# This code is free software; you can redistribute it and/or modify it
   88.11 -# under the terms of the GNU General Public License version 2 only, as
   88.12 -# published by the Free Software Foundation.
   88.13 -#
   88.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   88.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   88.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   88.17 -# version 2 for more details (a copy is included in the LICENSE file that
   88.18 -# accompanied this code).
   88.19 -#
   88.20 -# You should have received a copy of the GNU General Public License version
   88.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   88.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   88.23 -#
   88.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   88.25 -# or visit www.oracle.com if you need additional information or have any
   88.26 -# questions.
   88.27 -#
   88.28 -
   88.29 -# @test
   88.30 -# @bug 4798312
   88.31 -# @summary In Windows, javap doesnt load classes from rt.jar
   88.32 -# @author gafter
   88.33 -#
   88.34 -# @run shell pathsep.sh
   88.35 -
   88.36 -if [ "${TESTJAVA}" = "" ]
   88.37 -then
   88.38 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   88.39 -  exit 1
   88.40 -fi
   88.41 -echo "TESTJAVA=${TESTJAVA}"
   88.42 -
   88.43 -# set platform-dependent variables
   88.44 -OS=`uname -s`
   88.45 -case "$OS" in
   88.46 -  SunOS | Linux | Darwin | CYGWIN* )
   88.47 -    FS="/"
   88.48 -    ;;
   88.49 -  Windows* )
   88.50 -    FS="\\"
   88.51 -    ;;
   88.52 -  * )
   88.53 -    echo "Unrecognized system!"
   88.54 -    exit 1;
   88.55 -    ;;
   88.56 -esac
   88.57 -
   88.58 -"${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} java.lang.String
   88.59 -result=$?
   88.60 -if [ $result -eq 0 ]
   88.61 -then
   88.62 -  echo "Passed"
   88.63 -else
   88.64 -  echo "Failed"
   88.65 -fi
   88.66 -exit $result
    89.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    89.2 +++ b/test/tools/javap/stackmap/StackmapTest.java	Tue Feb 19 17:53:16 2013 +0000
    89.3 @@ -0,0 +1,97 @@
    89.4 +/*
    89.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    89.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.7 + *
    89.8 + * This code is free software; you can redistribute it and/or modify it
    89.9 + * under the terms of the GNU General Public License version 2 only, as
   89.10 + * published by the Free Software Foundation.
   89.11 + *
   89.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   89.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   89.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   89.15 + * version 2 for more details (a copy is included in the LICENSE file that
   89.16 + * accompanied this code).
   89.17 + *
   89.18 + * You should have received a copy of the GNU General Public License version
   89.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   89.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   89.21 + *
   89.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   89.23 + * or visit www.oracle.com if you need additional information or have any
   89.24 + * questions.
   89.25 + */
   89.26 +
   89.27 +/*
   89.28 + * @test
   89.29 + * @bug 6271292
   89.30 + * @summary Verify that javap prints StackMapTable attribute contents
   89.31 + * @library /tools/javac/lib
   89.32 + * @build ToolBox
   89.33 + * @run main StackmapTest
   89.34 + */
   89.35 +
   89.36 +import java.util.Arrays;
   89.37 +import java.util.List;
   89.38 +
   89.39 +//original test: test/tools/javap/stackmap/T6271292.sh
   89.40 +public class StackmapTest {
   89.41 +
   89.42 +    private static final String TestSrc =
   89.43 +        "public class Test extends SuperClass {\n" +
   89.44 +        "    public static void main(String[] args) {\n" +
   89.45 +        "        new SuperClass((args[0].equals(\"0\")) ? 0 : 1)\n" +
   89.46 +        "            .test();\n" +
   89.47 +        "    }\n" +
   89.48 +        "    Test(boolean b) {\n" +
   89.49 +        "        super(b ? 1 : 2);\n" +
   89.50 +        "    }\n" +
   89.51 +        "}\n" +
   89.52 +        "class SuperClass {\n" +
   89.53 +        "    double d;\n" +
   89.54 +        "    SuperClass(double dd) { d = dd; }\n" +
   89.55 +        "    double test() {\n" +
   89.56 +        "        if (d == 0)\n" +
   89.57 +        "            return d;\n" +
   89.58 +        "        else\n" +
   89.59 +        "            return d > 0 ? d++ : d--;\n" +
   89.60 +        "    }\n" +
   89.61 +        "}\n";
   89.62 +
   89.63 +    private static final String goldenOut =
   89.64 +        "frame_type = 255 /* full_frame */\n" +
   89.65 +        "frame_type = 255 /* full_frame */\n" +
   89.66 +        "frame_type = 73 /* same_locals_1_stack_item */\n" +
   89.67 +        "frame_type = 255 /* full_frame */\n" +
   89.68 +        "offset_delta = 19\n" +
   89.69 +        "offset_delta = 0\n" +
   89.70 +        "offset_delta = 2\n" +
   89.71 +        "stack = [ uninitialized 0, uninitialized 0 ]\n" +
   89.72 +        "stack = [ uninitialized 0, uninitialized 0, double ]\n" +
   89.73 +        "stack = [ this ]\n" +
   89.74 +        "stack = [ this, double ]\n" +
   89.75 +        "locals = [ class \"[Ljava/lang/String;\" ]\n" +
   89.76 +        "locals = [ class \"[Ljava/lang/String;\" ]\n" +
   89.77 +        "locals = [ this, int ]\n";
   89.78 +
   89.79 +    public static void main(String[] args) throws Exception {
   89.80 +        //        @compile T6271292.java
   89.81 +        ToolBox.JavaToolArgs javacParams =
   89.82 +                new ToolBox.JavaToolArgs().setSources(TestSrc);
   89.83 +        ToolBox.javac(javacParams);
   89.84 +
   89.85 +//        "${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" -verbose T6271292 > "${JAVAPFILE}"
   89.86 +        ToolBox.JavaToolArgs javapParams =
   89.87 +                new ToolBox.JavaToolArgs()
   89.88 +                .setAllArgs("-v", "Test.class");
   89.89 +        String out = ToolBox.javap(javapParams);
   89.90 +        List<String> grepResult = ToolBox.grep("frame_type", out);
   89.91 +        grepResult.addAll(ToolBox.grep("offset_delta", out));
   89.92 +        grepResult.addAll(ToolBox.grep("stack = ", out));
   89.93 +        grepResult.addAll(ToolBox.grep("locals = ", out));
   89.94 +        List<String> goldenList = Arrays.asList(goldenOut.split("\n"));
   89.95 +
   89.96 +//        diff -w "${OUTFILE}" "${TESTSRC}${FS}T6271292.out"
   89.97 +        ToolBox.compareLines(goldenList, grepResult, true);
   89.98 +    }
   89.99 +
  89.100 +}
    90.1 --- a/test/tools/javap/stackmap/T6271292.java	Tue Feb 19 00:31:45 2013 -0800
    90.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    90.3 @@ -1,49 +0,0 @@
    90.4 -/*
    90.5 - * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
    90.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    90.7 - *
    90.8 - * This code is free software; you can redistribute it and/or modify it
    90.9 - * under the terms of the GNU General Public License version 2 only, as
   90.10 - * published by the Free Software Foundation.
   90.11 - *
   90.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   90.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   90.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   90.15 - * version 2 for more details (a copy is included in the LICENSE file that
   90.16 - * accompanied this code).
   90.17 - *
   90.18 - * You should have received a copy of the GNU General Public License version
   90.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   90.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   90.21 - *
   90.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   90.23 - * or visit www.oracle.com if you need additional information or have any
   90.24 - * questions.
   90.25 - */
   90.26 -
   90.27 -
   90.28 -public class T6271292 extends SuperClass {
   90.29 -
   90.30 -    public static void main(String[] args) {
   90.31 -        SuperClass s = new SuperClass((args[0].equals("0")) ? 0 : 1);
   90.32 -        s.test();
   90.33 -    }
   90.34 -    T6271292(boolean b) {
   90.35 -        super(b ? 1 : 2);
   90.36 -    }
   90.37 -}
   90.38 -
   90.39 -class SuperClass {
   90.40 -    double d;
   90.41 -    SuperClass(double dd) { d = dd; }
   90.42 -
   90.43 -    double test() {
   90.44 -        if (d == 0) {
   90.45 -            return d;
   90.46 -        } else if (d > 0) {
   90.47 -            return d++;
   90.48 -        } else {
   90.49 -            return d--;
   90.50 -        }
   90.51 -    }
   90.52 -}
    91.1 --- a/test/tools/javap/stackmap/T6271292.out	Tue Feb 19 00:31:45 2013 -0800
    91.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    91.3 @@ -1,14 +0,0 @@
    91.4 -   frame_type = 255 /* full_frame */
    91.5 -   frame_type = 255 /* full_frame */
    91.6 -   frame_type = 73 /* same_locals_1_stack_item */
    91.7 -   frame_type = 255 /* full_frame */
    91.8 -     offset_delta = 19
    91.9 -     offset_delta = 0
   91.10 -     offset_delta = 2
   91.11 -     stack = [ uninitialized 0, uninitialized 0 ]
   91.12 -     stack = [ uninitialized 0, uninitialized 0, double ]
   91.13 -     stack = [ this ]
   91.14 -     stack = [ this, double ]
   91.15 -     locals = [ class "[Ljava/lang/String;" ]
   91.16 -     locals = [ class "[Ljava/lang/String;" ]
   91.17 -     locals = [ this, int ]
    92.1 --- a/test/tools/javap/stackmap/T6271292.sh	Tue Feb 19 00:31:45 2013 -0800
    92.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    92.3 @@ -1,88 +0,0 @@
    92.4 -#!/bin/sh
    92.5 -
    92.6 -#
    92.7 -# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
    92.8 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    92.9 -#
   92.10 -# This code is free software; you can redistribute it and/or modify it
   92.11 -# under the terms of the GNU General Public License version 2 only, as
   92.12 -# published by the Free Software Foundation.
   92.13 -#
   92.14 -# This code is distributed in the hope that it will be useful, but WITHOUT
   92.15 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   92.16 -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   92.17 -# version 2 for more details (a copy is included in the LICENSE file that
   92.18 -# accompanied this code).
   92.19 -#
   92.20 -# You should have received a copy of the GNU General Public License version
   92.21 -# 2 along with this work; if not, write to the Free Software Foundation,
   92.22 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   92.23 -#
   92.24 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   92.25 -# or visit www.oracle.com if you need additional information or have any
   92.26 -# questions.
   92.27 -#
   92.28 -
   92.29 -# @test
   92.30 -# @bug 6271292
   92.31 -# @compile T6271292.java
   92.32 -# @run shell T6271292.sh
   92.33 -# @summary Verify that javap prints StackMapTable attribute contents
   92.34 -# @author Wei Tao
   92.35 -    
   92.36 -if [ "${TESTSRC}" = "" ]
   92.37 -then
   92.38 -  echo "TESTSRC not set.  Test cannot execute.  Failed."
   92.39 -  exit 1
   92.40 -fi
   92.41 -printf 'TESTSRC="%s"' "${TESTSRC}" >&2 ; echo >&2
   92.42 -if [ "${TESTJAVA}" = "" ]
   92.43 -then
   92.44 -  echo "TESTJAVA not set.  Test cannot execute.  Failed."
   92.45 -  exit 1
   92.46 -fi
   92.47 -printf 'TESTJAVA="%s"' "${TESTJAVA}" >&2 ; echo >&2
   92.48 -if [ "${TESTCLASSES}" = "" ]
   92.49 -then
   92.50 -  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
   92.51 -  exit 1
   92.52 -fi
   92.53 -printf 'TESTCLASSES="%s"' "${TESTCLASSES}" >&2 ; echo >&2
   92.54 -printf 'CLASSPATH="%s"' "${CLASSPATH}" >&2 ; echo >&2
   92.55 -
   92.56 -# set platform-dependent variables
   92.57 -OS=`uname -s`
   92.58 -case "$OS" in
   92.59 -  Windows* )
   92.60 -    FS="\\"
   92.61 -    ;;
   92.62 -  * )
   92.63 -    FS="/"
   92.64 -    ;;
   92.65 -esac
   92.66 -
   92.67 -JAVAPFILE=T6271292.javap
   92.68 -OUTFILE=outfile
   92.69 -
   92.70 -"${TESTJAVA}${FS}bin${FS}javap" ${TESTTOOLVMOPTS} -classpath "${TESTCLASSES}" -verbose T6271292 > "${JAVAPFILE}"
   92.71 -result="$?"
   92.72 -if [ "$result" -ne 0 ] 
   92.73 -then
   92.74 -  exit "$result"
   92.75 -fi
   92.76 -
   92.77 -grep "frame_type" "${JAVAPFILE}" > "${OUTFILE}"
   92.78 -grep "offset_delta" "${JAVAPFILE}" >> "${OUTFILE}"
   92.79 -grep "stack = " "${JAVAPFILE}" >> "${OUTFILE}"
   92.80 -grep "locals = " "${JAVAPFILE}" >> "${OUTFILE}"
   92.81 -diff -w "${OUTFILE}" "${TESTSRC}${FS}T6271292.out"
   92.82 -result="$?"
   92.83 -if [ "$result" -eq 0 ]
   92.84 -then
   92.85 -  echo "Passed"
   92.86 -else
   92.87 -  echo "Failed"
   92.88 -fi
   92.89 -exit "$result"
   92.90 -
   92.91 -

mercurial