--- old/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java 2016-12-15 09:19:15.928333562 +0000 +++ new/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java 2016-12-15 09:19:15.797324600 +0000 @@ -272,6 +272,16 @@ static final int INDY = 18; /** + * The type of CONSTANT_Module constant pool items. + */ + static final int MODULE = 19; + + /** + * The type of CONSTANT_Package constant pool items. + */ + static final int PACKAGE = 20; + + /** * The base value for all CONSTANT_MethodHandle constant pool items. * Internally, ASM store the 9 variations of CONSTANT_MethodHandle into 9 * different items. @@ -1161,6 +1171,50 @@ } /** + * Adds a module name to the constant pool. + * + * Does nothing if the constant pool already contains a similar item. + * This method is intended for {@link Attribute} sub classes, and is + * normally not needed by class generators or adapters. + * + * @param value + * the module name + * @return the index of a new or already existing module reference item. + */ + public int newModule(String value) { + key2.set(MODULE, value, null, null); + Item result = get(key2); + if (result == null) { + pool.put12(MODULE, newUTF8(value)); + result = new Item(index++, key2); + put(result); + } + return result.index; + } + + /** + * Adds a package name to the constant pool. + * + * Does nothing if the constant pool already contains a similar item. + * This method is intended for {@link Attribute} sub classes, and is + * normally not needed by class generators or adapters. + * + * @param value + * the internal name of the package. + * @return the index of a new or already existing package reference item. + */ + public int newPackage(String value) { + key2.set(PACKAGE, value, null, null); + Item result = get(key2); + if (result == null) { + pool.put12(PACKAGE, newUTF8(value)); + result = new Item(index++, key2); + put(result); + } + return result.index; + } + + /** * Adds a method type reference to the constant pool of the class being * build. Does nothing if the constant pool already contains a similar item. * This method is intended for {@link Attribute} sub classes, and is