--- old/src/share/classes/com/sun/tools/sjavac/Main.java 2014-08-07 20:57:32.601624162 +0200 +++ new/src/share/classes/com/sun/tools/sjavac/Main.java 2014-08-07 20:57:32.473627672 +0200 @@ -375,8 +375,6 @@ err = "Please specify output directory."; } else if (options.isJavaFilesAmongJavacArgs()) { err = "Sjavac does not handle explicit compilation of single .java files."; - } else if (options.isAtFilePresent()) { - err = "Sjavac does not handle @-files."; } else if (options.getServerConf() == null) { err = "No server configuration provided."; } else if (!options.getImplicitPolicy().equals("none")) { --- old/src/share/classes/com/sun/tools/sjavac/options/OptionHelper.java 2014-08-07 20:57:33.025612537 +0200 +++ new/src/share/classes/com/sun/tools/sjavac/options/OptionHelper.java 2014-08-07 20:57:32.881616485 +0200 @@ -25,12 +25,14 @@ package com.sun.tools.sjavac.options; +import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; +import com.sun.tools.javac.main.CommandLine; import com.sun.tools.sjavac.Transformer; /** @@ -112,7 +114,11 @@ * @param args the arguments to traverse. */ void traverse(String[] args) { - + try { + args = CommandLine.parse(args); // Detect @file and load it as a command line. + } catch (java.io.IOException e) { + throw new IllegalArgumentException("Problem reading @"+e.getMessage()); + } ArgumentIterator argIter = new ArgumentIterator(Arrays.asList(args)); nextArg: --- old/src/share/classes/com/sun/tools/sjavac/options/Options.java 2014-08-07 20:57:33.501599486 +0200 +++ new/src/share/classes/com/sun/tools/sjavac/options/Options.java 2014-08-07 20:57:33.337603980 +0200 @@ -176,14 +176,6 @@ return false; } - /** Returns true iff an @-file is among the javac arguments */ - public boolean isAtFilePresent() { - for (String javacArg : javacArgs) - if (javacArg.startsWith("@")) - return true; - return false; - } - /** * Returns a string representation of the options that affect the result of * the compilation. (Used for saving the state of the options used in a --- old/test/tools/sjavac/SJavac.java 2014-08-07 20:57:33.965586762 +0200 +++ new/test/tools/sjavac/SJavac.java 2014-08-07 20:57:33.821590711 +0200 @@ -25,7 +25,7 @@ /* * @test * @summary Test all aspects of sjavac. - * @bug 8004658 8042441 8042699 + * @bug 8004658 8042441 8042699 8054461 * * @build Wrapper * @run main Wrapper SJavac @@ -99,6 +99,7 @@ compileCircularSources(); compileExcludingDependency(); incrementalCompileTestFullyQualifiedRef(); + compileWithAtFile(); delete(gensrc); delete(gensrc2); @@ -463,6 +464,37 @@ "bin/javac_state"); } + /** + * Tests @atfile + * @throws Exception If test fails + */ + void compileWithAtFile() throws Exception { + System.out.println("\nTest @atfile with command line content."); + System.out.println("---------------------------------------"); + + delete(gensrc); + delete(gensrc2); + delete(bin); + + populate(gensrc, + "list.txt", + "-if */alfa/omega/A.java\n-if */beta/B.java\ngensrc\n-d bin\n", + "alfa/omega/A.java", + "package alfa.omega; import beta.B; public class A { B b; }", + "beta/B.java", + "package beta; public class B { }", + "beta/C.java", + "broken"); + previous_bin_state = collectState(bin); + compile("@gensrc/list.txt", "--server:portfile=testserver,background=false"); + + Map new_bin_state = collectState(bin); + verifyThatFilesHaveBeenAdded(previous_bin_state, new_bin_state, + "bin/javac_state", + "bin/alfa/omega/A.class", + "bin/beta/B.class"); + } + void removeFrom(Path dir, String... args) throws IOException { for (String filename : args) { Path p = dir.resolve(filename);