Merge
authormockner
Wed, 23 Mar 2016 03:33:22 +0100
changeset 37174 52450946e39e
parent 37172 ff4d69314a4c (current diff)
parent 37173 d8aea1500483 (diff)
child 37175 ac6850d71f72
Merge
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Mar 22 13:32:18 2016 -0400
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Mar 23 03:33:22 2016 +0100
@@ -417,6 +417,22 @@
   { NULL,                        LogLevel::Off,   false, LOG_TAGS(_NO_TAG) }
 };
 
+#ifndef PRODUCT
+// These options are removed in jdk9. Remove this code for jdk10.
+static AliasedFlag const removed_develop_logging_flags[] = {
+  { "TraceClassInitialization",   "-Xlog:classinit" },
+  { "TraceClassLoaderData",       "-Xlog:classloaderdata" },
+  { "TraceDefaultMethods",        "-Xlog:defaultmethods=debug" },
+  { "TraceItables",               "-Xlog:itables=debug" },
+  { "TraceSafepoint",             "-Xlog:safepoint=debug" },
+  { "TraceStartupTime",           "-Xlog:startuptime" },
+  { "TraceVMOperation",           "-Xlog:vmoperation=debug" },
+  { "PrintVtables",               "-Xlog:vtables=debug" },
+  { "VerboseVerification",        "-Xlog:verboseverification" },
+  { NULL, NULL }
+};
+#endif //PRODUCT
+
 // Return true if "v" is less than "other", where "other" may be "undefined".
 static bool version_less_than(JDK_Version v, JDK_Version other) {
   assert(!v.is_undefined(), "must be defined");
@@ -468,6 +484,18 @@
   return 0;
 }
 
+#ifndef PRODUCT
+const char* Arguments::removed_develop_logging_flag_name(const char* name){
+  for (size_t i = 0; removed_develop_logging_flags[i].alias_name != NULL; i++) {
+    const AliasedFlag& flag = removed_develop_logging_flags[i];
+    if (strcmp(flag.alias_name, name) == 0) {
+      return flag.real_name;
+    }
+  }
+  return NULL;
+}
+#endif // PRODUCT
+
 const char* Arguments::real_flag_name(const char *flag_name) {
   for (size_t i = 0; aliased_jvm_flags[i].alias_name != NULL; i++) {
     const AliasedFlag& flag_status = aliased_jvm_flags[i];
@@ -1187,13 +1215,22 @@
     char stripped_argname[BUFLEN+1];
     strncpy(stripped_argname, argname, arg_len);
     stripped_argname[arg_len] = '\0';  // strncpy may not null terminate.
-
     if (is_obsolete_flag(stripped_argname, &since)) {
       char version[256];
       since.to_string(version, sizeof(version));
       warning("Ignoring option %s; support was removed in %s", stripped_argname, version);
       return true;
     }
+#ifndef PRODUCT
+    else {
+      const char* replacement;
+      if ((replacement = removed_develop_logging_flag_name(stripped_argname)) != NULL){
+        jio_fprintf(defaultStream::error_stream(),
+                  "%s has been removed. Please use %s instead.\n", stripped_argname, replacement);
+        return false;
+      }
+    }
+#endif //PRODUCT
   }
 
   // For locked flags, report a custom error message if available.
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Tue Mar 22 13:32:18 2016 -0400
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Wed Mar 23 03:33:22 2016 +0100
@@ -453,6 +453,10 @@
   // the version number when the flag became obsolete.
   static bool is_obsolete_flag(const char* flag_name, JDK_Version* version);
 
+#ifndef PRODUCT
+  static const char* removed_develop_logging_flag_name(const char* name);
+#endif // PRODUCT
+
   // Returns 1 if the flag is deprecated (and not yet obsolete or expired).
   //     In this case the 'version' buffer is filled in with the version number when
   //     the flag became deprecated.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java	Wed Mar 23 03:33:22 2016 +0100
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 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
+ * 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 RemovedDevelopFlagsTest
+ * @bug 8146632
+ * @library /testlibrary
+ * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
+ * @run driver RemovedDevelopFlagsTest
+ */
+import jdk.test.lib.*;
+
+public class RemovedDevelopFlagsTest {
+    public static ProcessBuilder pb;
+
+    public static class RemovedDevelopFlagsTestMain {
+        public static void main(String... args) {
+            System.out.print("Hello!");
+        }
+    }
+
+    public static void exec(String flag, String value) throws Exception {
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+"+flag, RemovedDevelopFlagsTestMain.class.getName());
+        OutputAnalyzer o = new OutputAnalyzer(pb.start());
+        o.shouldContain(flag+" has been removed. Please use "+value+" instead.");
+        o.shouldHaveExitValue(1);
+    }
+
+    public static void main(String... args) throws Exception {
+        if (Platform.isDebugBuild()){
+            exec("TraceClassInitialization", "-Xlog:classinit");
+            exec("TraceClassLoaderData", "-Xlog:classloaderdata");
+            exec("TraceDefaultMethods", "-Xlog:defaultmethods=debug");
+            exec("TraceItables", "-Xlog:itables=debug");
+            exec("TraceSafepoint", "-Xlog:safepoint=debug");
+            exec("TraceStartupTime", "-Xlog:startuptime");
+            exec("TraceVMOperation", "-Xlog:vmoperation=debug");
+            exec("PrintVtables", "-Xlog:vtables=debug");
+            exec("VerboseVerification", "-Xlog:verboseverification");
+        }
+    };
+}