< prev index next >

src/java.base/share/classes/jdk/internal/jimage/ImageStrings.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2014, 2025, 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.  Oracle designates this

@@ -31,10 +31,27 @@
   * It is used internally in the JDK to implement jimage/jrtfs access,
   * but also compiled and delivered as part of the jrtfs.jar to support access
   * to the jimage file provided by the shipped JDK by tools running on JDK 8.
   */
  public interface ImageStrings {
+     // String offset constants are useful for efficient classification
+     // of location entries without string comparison.
+     // They are validated during initialization of ImageStringsWriter.
+     //
+     // Adding new strings (with larger offsets) is possible without changing
+     // the jimage version number, but any change to existing strings must be
+     // accompanied by a jimage version number change.
+ 
+     /** Fixed offset for the empty string in the strings table. */
+     int EMPTY_STRING_OFFSET = 0;
+     /** Fixed offset for the string "class" in the strings table. */
+     int CLASS_STRING_OFFSET = 1;
+     /** Fixed offset for the string "modules" in the strings table. */
+     int MODULES_STRING_OFFSET = 7;
+     /** Fixed offset for the string "packages" in the strings table. */
+     int PACKAGES_STRING_OFFSET = 15;
+ 
      String get(int offset);
  
      int add(final String string);
  
      /**
< prev index next >