changeset 346:e8dec4cc827e

Regression: CommandLineOptions should be serializable.
author shade
date Tue, 14 Jan 2014 14:38:02 +0400
parents 52ba6df72cb3
children 2e5bf03c85a8
files jmh-core/src/main/java/org/openjdk/jmh/runner/options/CommandLineOptions.java jmh-core/src/test/java/org/openjdk/jmh/runner/options/TestOptions.java
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-core/src/main/java/org/openjdk/jmh/runner/options/CommandLineOptions.java	Tue Jan 14 14:27:56 2014 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/runner/options/CommandLineOptions.java	Tue Jan 14 14:38:02 2014 +0400
@@ -86,7 +86,7 @@
     private final boolean help;
     private final boolean listProfilers;
 
-    private final OptionParser parser;
+    private final transient OptionParser parser;
 
     public CommandLineOptions(String... argv) throws CommandLineOptionException {
         parser = new OptionParser();
--- a/jmh-core/src/test/java/org/openjdk/jmh/runner/options/TestOptions.java	Tue Jan 14 14:27:56 2014 +0400
+++ b/jmh-core/src/test/java/org/openjdk/jmh/runner/options/TestOptions.java	Tue Jan 14 14:38:02 2014 +0400
@@ -33,6 +33,9 @@
 import org.openjdk.jmh.profile.ProfilerType;
 import org.openjdk.jmh.runner.parameters.TimeValue;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -51,6 +54,20 @@
     }
 
     @Test
+    public void testSerializable_Cmdline() throws IOException {
+        ObjectOutputStream oos = new ObjectOutputStream(new ByteArrayOutputStream());
+        oos.writeObject(EMPTY_CMDLINE);
+        oos.flush();
+    }
+
+    @Test
+    public void testSerializable_Builder() throws IOException {
+        ObjectOutputStream oos = new ObjectOutputStream(new ByteArrayOutputStream());
+        oos.writeObject(EMPTY_BUILDER);
+        oos.flush();
+    }
+
+    @Test
     public void testIncludes() throws Exception {
         CommandLineOptions cmdLine = new CommandLineOptions(".*", ".*test.*", "test");
         Options builder = new OptionsBuilder().include(".*").include(".*test.*").include("test").build();