diff -r 025ef287342f -r 3c8ff4204d2d langtools/test/tools/javac/T6358166.java --- a/langtools/test/tools/javac/T6358166.java Thu Apr 28 08:26:42 2016 -0700 +++ b/langtools/test/tools/javac/T6358166.java Tue May 03 09:11:12 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, 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 @@ -42,8 +42,7 @@ import com.sun.tools.javac.api.JavacTool; import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.main.JavaCompiler; -import com.sun.tools.javac.util.*; -import com.sun.tools.javac.util.List; // disambiguate +import com.sun.tools.javac.util.Context; @SupportedAnnotationTypes("*") @@ -56,22 +55,26 @@ JavacFileManager fm = new JavacFileManager(new Context(), false, null); JavaFileObject f = fm.getJavaFileObject(testSrc + File.separatorChar + self + ".java"); - String addExports = "-XaddExports:" - + "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED," - + "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED," - + "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED," - + "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"; + List addExports = Arrays.asList( + "-XaddExports:jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", + "-XaddExports:jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", + "-XaddExports:jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", + "-XaddExports:jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"); test(fm, f, addExports, "-verbose", "-d", "."); test(fm, f, addExports, "-verbose", "-d", ".", "-XprintRounds", "-processorpath", ".", "-processor", self); } - static void test(JavacFileManager fm, JavaFileObject f, String... args) throws Throwable { + static void test(JavacFileManager fm, JavaFileObject f, List addExports, String... args) throws Throwable { + List allArgs = new ArrayList<>(); + allArgs.addAll(addExports); + allArgs.addAll(Arrays.asList(args)); + Context context = new Context(); JavacTool tool = JavacTool.create(); - JavacTaskImpl task = (JavacTaskImpl) tool.getTask(null, fm, null, Arrays.asList(args), null, List.of(f), context); + JavacTaskImpl task = (JavacTaskImpl) tool.getTask(null, fm, null, allArgs, null, List.of(f), context); task.call(); JavaCompiler c = JavaCompiler.instance(context);