changeset 1084:b99ec1daf32d

7901242: FileUtils.createTempFileWithLines, String prefix is not used
author shade
date Mon, 12 Jan 2015 22:28:37 +0300
parents 6c93505a6763
children 723dc85eb157
files jmh-core/src/main/java/org/openjdk/jmh/runner/CompilerHints.java jmh-core/src/main/java/org/openjdk/jmh/util/FileUtils.java jmh-core/src/test/java/org/openjdk/jmh/runner/RunnerTest.java
diffstat 3 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/CompilerHints.java	Mon Jan 12 22:07:09 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/CompilerHints.java	Mon Jan 12 22:28:37 2015 +0300
@@ -69,7 +69,7 @@
                 hints.add("quiet");
                 hints.add("dontinline,org/openjdk/jmh/infra/Blackhole.*");
                 hints.addAll(defaultHints);
-                hintsFile = FileUtils.createTempFileWithLines("jmh", "compilecommand", hints);
+                hintsFile = FileUtils.createTempFileWithLines("compilecommand", hints);
             } catch (IOException e) {
                 throw new IllegalStateException("Error creating compiler hints file", e);
             }
@@ -231,7 +231,7 @@
             for(String file : compileCommandFiles) {
                 hints.addAll(fromFile(file).get());
             }
-            return FileUtils.createTempFileWithLines("jmh", "compilecommand", hints);
+            return FileUtils.createTempFileWithLines("compilecommand", hints);
         } catch (IOException e) {
             throw new IllegalStateException("Error merging compiler hints files", e);
         }
--- a/jmh-core/src/main/java/org/openjdk/jmh/util/FileUtils.java	Mon Jan 12 22:07:09 2015 +0300
+++ b/jmh-core/src/main/java/org/openjdk/jmh/util/FileUtils.java	Mon Jan 12 22:28:37 2015 +0300
@@ -102,14 +102,13 @@
     /**
      * Create a temporary file (see {@link File#createTempFile(String, String)}) and fill it with the given lines.
      *
-     * @param prefix file prefix as for {@link File#createTempFile(String, String)}
      * @param suffix file suffix {@link File#createTempFile(String, String)}
      * @param lines to be written
      *
      * @return the temporary file absolute path
      * @throws IOException on file creation error
      */
-    public static String createTempFileWithLines(String prefix, String suffix, Iterable<String> lines)
+    public static String createTempFileWithLines(String suffix, Iterable<String> lines)
             throws IOException {
         File file = FileUtils.tempFile(suffix);
         PrintWriter pw = new PrintWriter(file);
--- a/jmh-core/src/test/java/org/openjdk/jmh/runner/RunnerTest.java	Mon Jan 12 22:07:09 2015 +0300
+++ b/jmh-core/src/test/java/org/openjdk/jmh/runner/RunnerTest.java	Mon Jan 12 22:28:37 2015 +0300
@@ -82,7 +82,7 @@
     @Test
     public void testOptsWithCompileCommandFileResultInMergedCompileCommandFile() throws IOException {
         // add a hints file
-        String tempHints = FileUtils.createTempFileWithLines("test", "fileWithLines",
+        String tempHints = FileUtils.createTempFileWithLines("fileWithLines",
                 Arrays.asList("inline,we/like/to/move/it.*"));
         Set<String> extraHints = CompilerHints.fromFile(tempHints).get();
         Runner blade = new Runner(new OptionsBuilder().build());
@@ -112,10 +112,10 @@
     @Test
     public void testOptsWith2CompileCommandFilesResultInMergedCompileCommandFile() throws IOException {
         // add hints files
-        String tempHints1 = FileUtils.createTempFileWithLines("test", "fileWithLines",
+        String tempHints1 = FileUtils.createTempFileWithLines("fileWithLines",
                 Arrays.asList("inline,we/like/to/move/it/move/it.*"));
         Set<String> extraHints1 = CompilerHints.fromFile(tempHints1).get();
-        String tempHints2 = FileUtils.createTempFileWithLines("test", "fileWithLines",
+        String tempHints2 = FileUtils.createTempFileWithLines("fileWithLines",
                 Arrays.asList("inline,we/like/to/move/it.*"));
         Set<String> extraHints2 = CompilerHints.fromFile(tempHints2).get();
         Runner blade = new Runner(new OptionsBuilder().build());