< prev index next >

src/hotspot/share/classfile/classLoader.hpp

Print this page

        

@@ -24,19 +24,25 @@
 
 #ifndef SHARE_CLASSFILE_CLASSLOADER_HPP
 #define SHARE_CLASSFILE_CLASSLOADER_HPP
 
 #include "jimage.hpp"
+#include "runtime/arguments.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/perfData.hpp"
 #include "utilities/exceptions.hpp"
 #include "utilities/macros.hpp"
 
 // The VM class loader.
 #include <sys/stat.h>
 
-// Name of boot "modules" image
+// Name of boot "modules" image. This macro may be used with caution.
+//
+// For most of use cases, ClassLoader::modules_image_name(), which gives the
+// canonical name should be used. When dealing with the system boot path string
+// that's set up by os::set_boot_path(), then the canonical name cannot be
+// used and MODULES_IMAGE_NAME should be used directly.
 #define  MODULES_IMAGE_NAME "modules"
 
 // Class path entry (directory or zip file)
 
 class JImageFile;

@@ -215,10 +221,13 @@
   //    Note: boot loader append path does not support named modules.
   static ClassPathEntry* _first_append_entry;
   // Last entry in linked list of appended ClassPathEntry instances
   static ClassPathEntry* _last_append_entry;
 
+  // The modules image name obtained from the canonical path.
+  static const char* _modules_image_name;
+
   // Info used by CDS
   CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;)
 
   CDS_ONLY(static ClassPathEntry* _app_classpath_entries;)
   CDS_ONLY(static ClassPathEntry* _last_app_classpath_entry;)

@@ -246,10 +255,13 @@
   static void create_javabase();
 
   static void load_zip_library();
   static void load_jimage_library();
 
+  static const char* skip_directories(const char* path);
+  static void init_modules_image_name(const char* modules_path);
+
  public:
   static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
                                                  bool throw_exception,
                                                  bool is_boot_append, TRAPS);
 

@@ -437,11 +449,18 @@
   // obtain package name from a fully qualified class name
   // *bad_class_name is set to true if there's a problem with parsing class_name, to
   // distinguish from a class_name with no package name, as both cases have a NULL return value
   static const char* package_from_name(const char* const class_name, bool* bad_class_name = NULL);
 
-  static bool is_modules_image(const char* name) { return string_ends_with(name, MODULES_IMAGE_NAME); }
+  static const char* modules_image_name() { return _modules_image_name; }
+  static bool is_modules_image(const char* name) {
+    if (Arguments::has_jimage()) {
+      assert(_modules_image_name != NULL, "must be set");
+      return string_ends_with(name, _modules_image_name);
+    }
+    return false;
+  }
 
   // Debugging
   static void verify()              PRODUCT_RETURN;
 };
 
< prev index next >