mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8046824: class SJavacTestUtil and *Wrapper are redundant and should be removed
Reviewed-by: ksrini
This commit is contained in:
parent
1e87b47b2a
commit
6ec02aa50b
12 changed files with 64 additions and 205 deletions
|
@ -23,6 +23,16 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8037085
|
||||||
|
* @summary Ensures that sjavac can handle various exclusion patterns.
|
||||||
|
*
|
||||||
|
* @build Wrapper
|
||||||
|
* @run main Wrapper ExclPattern
|
||||||
|
*/
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @test
|
|
||||||
* @bug 8037085
|
|
||||||
* @summary Ensures that sjavac can handle various exclusion patterns.
|
|
||||||
* @run main ExclPatternWrapper
|
|
||||||
*/
|
|
||||||
public class ExclPatternWrapper {
|
|
||||||
public static void main(String... args) throws Exception {
|
|
||||||
SJavacTestUtil.runSjavacTest("ExclPattern", args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -27,6 +27,9 @@
|
||||||
* @test
|
* @test
|
||||||
* @bug 8047183
|
* @bug 8047183
|
||||||
* @summary JDK build fails with sjavac enabled
|
* @summary JDK build fails with sjavac enabled
|
||||||
|
*
|
||||||
|
* @build Wrapper
|
||||||
|
* @run main Wrapper IgnoreSymbolFile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -38,12 +41,8 @@ import java.util.Arrays;
|
||||||
|
|
||||||
public class IgnoreSymbolFile {
|
public class IgnoreSymbolFile {
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
if (sjavacAvailable()) {
|
|
||||||
IgnoreSymbolFile test = new IgnoreSymbolFile();
|
IgnoreSymbolFile test = new IgnoreSymbolFile();
|
||||||
test.run();
|
test.run();
|
||||||
} else {
|
|
||||||
System.err.println("sjavac not available; test skipped");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
|
@ -96,13 +95,4 @@ public class IgnoreSymbolFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
int errors;
|
int errors;
|
||||||
|
|
||||||
static boolean sjavacAvailable() {
|
|
||||||
try {
|
|
||||||
Class.forName("com.sun.tools.sjavac.Main");
|
|
||||||
return true;
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,15 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8035063
|
||||||
|
* @summary Tests the preparation of javac-arguments.
|
||||||
|
*
|
||||||
|
* @build Wrapper
|
||||||
|
* @run main Wrapper JavacOptionPrep
|
||||||
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @test
|
|
||||||
* @bug 8035063
|
|
||||||
* @summary Tests the preparation of javac-arguments.
|
|
||||||
* @run main JavacOptionPrepWrapper
|
|
||||||
*/
|
|
||||||
public class JavacOptionPrepWrapper {
|
|
||||||
public static void main(String... args) throws Exception {
|
|
||||||
SJavacTestUtil.runSjavacTest("JavacOptionPrep", args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,6 +23,15 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8035063
|
||||||
|
* @summary Tests decoding of String[] into Options.
|
||||||
|
*
|
||||||
|
* @build Wrapper
|
||||||
|
* @run main Wrapper OptionDecoding
|
||||||
|
*/
|
||||||
|
|
||||||
import static util.OptionTestUtil.assertEquals;
|
import static util.OptionTestUtil.assertEquals;
|
||||||
import static util.OptionTestUtil.checkFilesFound;
|
import static util.OptionTestUtil.checkFilesFound;
|
||||||
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @test
|
|
||||||
* @bug 8035063
|
|
||||||
* @summary Tests decoding of String[] into Options.
|
|
||||||
* @run main OptionDecodingWrapper
|
|
||||||
*/
|
|
||||||
public class OptionDecodingWrapper {
|
|
||||||
public static void main(String... args) throws Exception {
|
|
||||||
SJavacTestUtil.runSjavacTest("OptionDecoding", args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,6 +21,16 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @summary Test all aspects of sjavac.
|
||||||
|
* @bug 8004658 8042441 8042699
|
||||||
|
*
|
||||||
|
* @build Wrapper
|
||||||
|
* @run main Wrapper SJavac
|
||||||
|
*/
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
|
@ -29,8 +39,7 @@ import java.nio.charset.*;
|
||||||
|
|
||||||
import com.sun.tools.sjavac.Main;
|
import com.sun.tools.sjavac.Main;
|
||||||
|
|
||||||
public
|
public class SJavac {
|
||||||
class SJavac {
|
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @test
|
|
||||||
* @summary Test all aspects of sjavac.
|
|
||||||
*
|
|
||||||
* @bug 8004658
|
|
||||||
* @bug 8042441
|
|
||||||
* @bug 8042699
|
|
||||||
* @summary Add internal smart javac wrapper to solve JEP 139
|
|
||||||
*
|
|
||||||
* @run main SJavacWrapper
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class SJavacWrapper {
|
|
||||||
public static void main(String... args) throws Exception {
|
|
||||||
SJavacTestUtil.runSjavacTest("SJavac", args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -21,6 +21,18 @@
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 8035063
|
||||||
|
*
|
||||||
|
* @summary Tests serialization of options. The options needs to be serialized
|
||||||
|
* and saved in the state file since the files need to be recompiled
|
||||||
|
* if new options are provided.
|
||||||
|
*
|
||||||
|
* @build Wrapper
|
||||||
|
* @run main Wrapper Serialization
|
||||||
|
*/
|
||||||
|
|
||||||
import static util.OptionTestUtil.assertEquals;
|
import static util.OptionTestUtil.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
||||||
*
|
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License version 2 only, as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
* version 2 for more details (a copy is included in the LICENSE file that
|
|
||||||
* accompanied this code).
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License version
|
|
||||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
|
||||||
* questions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @test
|
|
||||||
* @bug 8035063
|
|
||||||
*
|
|
||||||
* @summary Tests serialization of options. The options needs to be serialized
|
|
||||||
* and saved in the state file since the files need to be recompiled
|
|
||||||
* if new options are provided.
|
|
||||||
*
|
|
||||||
* @run main SerializationWrapper
|
|
||||||
*/
|
|
||||||
public class SerializationWrapper {
|
|
||||||
public static void main(String... args) throws Exception {
|
|
||||||
SJavacTestUtil.runSjavacTest("Serialization", args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -25,18 +25,19 @@
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
|
||||||
public class SJavacTestUtil {
|
public class Wrapper {
|
||||||
|
public static void main(String... args) throws Exception {
|
||||||
public static void runSjavacTest(String testClassName, String[] args)
|
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
if (!isSJavacOnClassPath()) {
|
if (!isSJavacOnClassPath()) {
|
||||||
System.out.println("sjavac not available: pass by default");
|
System.out.println("sjavac not available: pass by default");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String testClassName = args[0];
|
||||||
|
String[] testArgs = Arrays.copyOfRange(args, 1, args.length);
|
||||||
|
|
||||||
File srcDir = new File(System.getProperty("test.src"));
|
File srcDir = new File(System.getProperty("test.src"));
|
||||||
File clsDir = new File(System.getProperty("test.classes"));
|
File clsDir = new File(System.getProperty("test.classes"));
|
||||||
|
|
||||||
|
@ -53,12 +54,11 @@ public class SJavacTestUtil {
|
||||||
|
|
||||||
Class<?> sjavac = Class.forName(testClassName);
|
Class<?> sjavac = Class.forName(testClassName);
|
||||||
Method main = sjavac.getMethod("main", String[].class);
|
Method main = sjavac.getMethod("main", String[].class);
|
||||||
main.invoke(null, new Object[] { args });
|
main.invoke(null, new Object[] { testArgs });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isSJavacOnClassPath() {
|
private static boolean isSJavacOnClassPath() {
|
||||||
String cls = "com/sun/tools/sjavac/Main.class";
|
String cls = "com/sun/tools/sjavac/Main.class";
|
||||||
return SJavacTestUtil.class.getClassLoader().getResource(cls) != null;
|
return Wrapper.class.getClassLoader().getResource(cls) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue