You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2018/11/29 00:34:22 UTC
[35/46] tapestry-5 git commit: TAP5-2588: upgrading from ASM 6 to 7
for Java 9+ support
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleVisitor.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleVisitor.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleVisitor.java
old mode 100644
new mode 100755
index c3a2aac..1967491
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleVisitor.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleVisitor.java
@@ -1,190 +1,174 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm;
/**
- * A visitor to visit a Java module. The methods of this class must be called in
- * the following order: <tt>visitMainClass</tt> | ( <tt>visitPackage</tt> |
- * <tt>visitRequire</tt> | <tt>visitExport</tt> | <tt>visitOpen</tt> |
- * <tt>visitUse</tt> | <tt>visitProvide</tt> )* <tt>visitEnd</tt>.
- *
- * The methods {@link #visitRequire(String, int, String)}, {@link #visitExport(String, int, String...)},
- * {@link #visitOpen(String, int, String...)} and {@link #visitPackage(String)}
- * take as parameter a package name or a module name. Unlike the other names which are internal names
- * (names separated by slash), module and package names are qualified names (names separated by dot).
- *
+ * A visitor to visit a Java module. The methods of this class must be called in the following
+ * order: ( {@code visitMainClass} | ( {@code visitPackage} | {@code visitRequire} | {@code
+ * visitExport} | {@code visitOpen} | {@code visitUse} | {@code visitProvide} )* ) {@code visitEnd}.
+ *
* @author Remi Forax
+ * @author Eric Bruneton
*/
public abstract class ModuleVisitor {
- /**
- * The ASM API version implemented by this visitor. The value of this field
- * must be {@link Opcodes#ASM6}.
- */
- protected final int api;
-
- /**
- * The module visitor to which this visitor must delegate method calls. May
- * be null.
- */
- protected ModuleVisitor mv;
-
- /**
- * Constructs a new {@link ModuleVisitor}.
- *
- * @param api
- * the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM6}.
- */
- public ModuleVisitor(final int api) {
- this(api, null);
- }
+ /**
+ * The ASM API version implemented by this visitor. The value of this field must be one of {@link
+ * Opcodes#ASM6} or {@link Opcodes#ASM7}.
+ */
+ protected final int api;
+
+ /** The module visitor to which this visitor must delegate method calls. May be null. */
+ protected ModuleVisitor mv;
- /**
- * Constructs a new {@link ModuleVisitor}.
- *
- * @param api
- * the ASM API version implemented by this visitor. Must be {@link Opcodes#ASM6}.
- * @param mv
- * the module visitor to which this visitor must delegate method
- * calls. May be null.
- */
- public ModuleVisitor(final int api, final ModuleVisitor mv) {
- if (api != Opcodes.ASM6) {
- throw new IllegalArgumentException();
- }
- this.api = api;
- this.mv = mv;
+ /**
+ * Constructs a new {@link ModuleVisitor}.
+ *
+ * @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM6}
+ * or {@link Opcodes#ASM7}.
+ */
+ public ModuleVisitor(final int api) {
+ this(api, null);
+ }
+
+ /**
+ * Constructs a new {@link ModuleVisitor}.
+ *
+ * @param api the ASM API version implemented by this visitor. Must be one of {@link Opcodes#ASM6}
+ * or {@link Opcodes#ASM7}.
+ * @param moduleVisitor the module visitor to which this visitor must delegate method calls. May
+ * be null.
+ */
+ public ModuleVisitor(final int api, final ModuleVisitor moduleVisitor) {
+ if (api != Opcodes.ASM6 && api != Opcodes.ASM7) {
+ throw new IllegalArgumentException();
}
-
- /**
- * Visit the main class of the current module.
- *
- * @param mainClass the internal name of the main class of the current module.
- */
- public void visitMainClass(String mainClass) {
- if (mv != null) {
- mv.visitMainClass(mainClass);
- }
+ this.api = api;
+ this.mv = moduleVisitor;
+ }
+
+ /**
+ * Visit the main class of the current module.
+ *
+ * @param mainClass the internal name of the main class of the current module.
+ */
+ public void visitMainClass(final String mainClass) {
+ if (mv != null) {
+ mv.visitMainClass(mainClass);
}
-
- /**
- * Visit a package of the current module.
- *
- * @param packaze the qualified name of a package.
- */
- public void visitPackage(String packaze) {
- if (mv != null) {
- mv.visitPackage(packaze);
- }
+ }
+
+ /**
+ * Visit a package of the current module.
+ *
+ * @param packaze the internal name of a package.
+ */
+ public void visitPackage(final String packaze) {
+ if (mv != null) {
+ mv.visitPackage(packaze);
}
-
- /**
- * Visits a dependence of the current module.
- *
- * @param module the qualified name of the dependence.
- * @param access the access flag of the dependence among
- * ACC_TRANSITIVE, ACC_STATIC_PHASE, ACC_SYNTHETIC
- * and ACC_MANDATED.
- * @param version the module version at compile time or null.
- */
- public void visitRequire(String module, int access, String version) {
- if (mv != null) {
- mv.visitRequire(module, access, version);
- }
+ }
+
+ /**
+ * Visits a dependence of the current module.
+ *
+ * @param module the fully qualified name (using dots) of the dependence.
+ * @param access the access flag of the dependence among {@code ACC_TRANSITIVE}, {@code
+ * ACC_STATIC_PHASE}, {@code ACC_SYNTHETIC} and {@code ACC_MANDATED}.
+ * @param version the module version at compile time, or {@literal null}.
+ */
+ public void visitRequire(final String module, final int access, final String version) {
+ if (mv != null) {
+ mv.visitRequire(module, access, version);
}
-
- /**
- * Visit an exported package of the current module.
- *
- * @param packaze the qualified name of the exported package.
- * @param access the access flag of the exported package,
- * valid values are among {@code ACC_SYNTHETIC} and
- * {@code ACC_MANDATED}.
- * @param modules the qualified names of the modules that can access to
- * the public classes of the exported package or
- * <tt>null</tt>.
- */
- public void visitExport(String packaze, int access, String... modules) {
- if (mv != null) {
- mv.visitExport(packaze, access, modules);
- }
+ }
+
+ /**
+ * Visit an exported package of the current module.
+ *
+ * @param packaze the internal name of the exported package.
+ * @param access the access flag of the exported package, valid values are among {@code
+ * ACC_SYNTHETIC} and {@code ACC_MANDATED}.
+ * @param modules the fully qualified names (using dots) of the modules that can access the public
+ * classes of the exported package, or {@literal null}.
+ */
+ public void visitExport(final String packaze, final int access, final String... modules) {
+ if (mv != null) {
+ mv.visitExport(packaze, access, modules);
}
-
- /**
- * Visit an open package of the current module.
- *
- * @param packaze the qualified name of the opened package.
- * @param access the access flag of the opened package,
- * valid values are among {@code ACC_SYNTHETIC} and
- * {@code ACC_MANDATED}.
- * @param modules the qualified names of the modules that can use deep
- * reflection to the classes of the open package or
- * <tt>null</tt>.
- */
- public void visitOpen(String packaze, int access, String... modules) {
- if (mv != null) {
- mv.visitOpen(packaze, access, modules);
- }
+ }
+
+ /**
+ * Visit an open package of the current module.
+ *
+ * @param packaze the internal name of the opened package.
+ * @param access the access flag of the opened package, valid values are among {@code
+ * ACC_SYNTHETIC} and {@code ACC_MANDATED}.
+ * @param modules the fully qualified names (using dots) of the modules that can use deep
+ * reflection to the classes of the open package, or {@literal null}.
+ */
+ public void visitOpen(final String packaze, final int access, final String... modules) {
+ if (mv != null) {
+ mv.visitOpen(packaze, access, modules);
}
-
- /**
- * Visit a service used by the current module.
- * The name must be the internal name of an interface or a class.
- *
- * @param service the internal name of the service.
- */
- public void visitUse(String service) {
- if (mv != null) {
- mv.visitUse(service);
- }
+ }
+
+ /**
+ * Visit a service used by the current module. The name must be the internal name of an interface
+ * or a class.
+ *
+ * @param service the internal name of the service.
+ */
+ public void visitUse(final String service) {
+ if (mv != null) {
+ mv.visitUse(service);
}
-
- /**
- * Visit an implementation of a service.
- *
- * @param service the internal name of the service
- * @param providers the internal names of the implementations
- * of the service (there is at least one provider).
- */
- public void visitProvide(String service, String... providers) {
- if (mv != null) {
- mv.visitProvide(service, providers);
- }
+ }
+
+ /**
+ * Visit an implementation of a service.
+ *
+ * @param service the internal name of the service.
+ * @param providers the internal names of the implementations of the service (there is at least
+ * one provider).
+ */
+ public void visitProvide(final String service, final String... providers) {
+ if (mv != null) {
+ mv.visitProvide(service, providers);
}
-
- /**
- * Visits the end of the module. This method, which is the last one to be
- * called, is used to inform the visitor that everything have been visited.
- */
- public void visitEnd() {
- if (mv != null) {
- mv.visitEnd();
- }
+ }
+
+ /**
+ * Visits the end of the module. This method, which is the last one to be called, is used to
+ * inform the visitor that everything have been visited.
+ */
+ public void visitEnd() {
+ if (mv != null) {
+ mv.visitEnd();
}
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleWriter.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleWriter.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleWriter.java
old mode 100644
new mode 100755
index 5ab0b3c..1a8f355
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleWriter.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/ModuleWriter.java
@@ -1,293 +1,253 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm;
/**
+ * A {@link ModuleVisitor} that generates the corresponding Module, ModulePackages and
+ * ModuleMainClass attributes, as defined in the Java Virtual Machine Specification (JVMS).
+ *
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.25">JVMS
+ * 4.7.25</a>
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.26">JVMS
+ * 4.7.26</a>
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.27">JVMS
+ * 4.7.27</a>
* @author Remi Forax
+ * @author Eric Bruneton
*/
final class ModuleWriter extends ModuleVisitor {
- /**
- * The class writer to which this Module attribute must be added.
- */
- private final ClassWriter cw;
-
- /**
- * size in byte of the Module attribute.
- */
- int size;
-
- /**
- * Number of attributes associated with the current module
- * (Version, ConcealPackages, etc)
- */
- int attributeCount;
-
- /**
- * Size in bytes of the attributes associated with the current module
- */
- int attributesSize;
-
- /**
- * module name index in the constant pool
- */
- private final int name;
-
- /**
- * module access flags
- */
- private final int access;
-
- /**
- * module version index in the constant pool or 0
- */
- private final int version;
-
- /**
- * module main class index in the constant pool or 0
- */
- private int mainClass;
-
- /**
- * number of packages
- */
- private int packageCount;
-
- /**
- * The packages in bytecode form. This byte vector only contains
- * the items themselves, the number of items is store in packageCount
- */
- private ByteVector packages;
-
- /**
- * number of requires items
- */
- private int requireCount;
-
- /**
- * The requires items in bytecode form. This byte vector only contains
- * the items themselves, the number of items is store in requireCount
- */
- private ByteVector requires;
-
- /**
- * number of exports items
- */
- private int exportCount;
-
- /**
- * The exports items in bytecode form. This byte vector only contains
- * the items themselves, the number of items is store in exportCount
- */
- private ByteVector exports;
-
- /**
- * number of opens items
- */
- private int openCount;
-
- /**
- * The opens items in bytecode form. This byte vector only contains
- * the items themselves, the number of items is store in openCount
- */
- private ByteVector opens;
-
- /**
- * number of uses items
- */
- private int useCount;
-
- /**
- * The uses items in bytecode form. This byte vector only contains
- * the items themselves, the number of items is store in useCount
- */
- private ByteVector uses;
-
- /**
- * number of provides items
- */
- private int provideCount;
-
- /**
- * The uses provides in bytecode form. This byte vector only contains
- * the items themselves, the number of items is store in provideCount
- */
- private ByteVector provides;
-
- ModuleWriter(final ClassWriter cw, final int name,
- final int access, final int version) {
- super(Opcodes.ASM6);
- this.cw = cw;
- this.size = 16; // name + access + version + 5 counts
- this.name = name;
- this.access = access;
- this.version = version;
- }
-
- @Override
- public void visitMainClass(String mainClass) {
- if (this.mainClass == 0) { // protect against several calls to visitMainClass
- cw.newUTF8("ModuleMainClass");
- attributeCount++;
- attributesSize += 8;
- }
- this.mainClass = cw.newClass(mainClass);
- }
-
- @Override
- public void visitPackage(String packaze) {
- if (packages == null) {
- // protect against several calls to visitPackage
- cw.newUTF8("ModulePackages");
- packages = new ByteVector();
- attributeCount++;
- attributesSize += 8;
- }
- packages.putShort(cw.newPackage(packaze));
- packageCount++;
- attributesSize += 2;
- }
-
- @Override
- public void visitRequire(String module, int access, String version) {
- if (requires == null) {
- requires = new ByteVector();
- }
- requires.putShort(cw.newModule(module))
- .putShort(access)
- .putShort(version == null? 0: cw.newUTF8(version));
- requireCount++;
- size += 6;
- }
-
- @Override
- public void visitExport(String packaze, int access, String... modules) {
- if (exports == null) {
- exports = new ByteVector();
- }
- exports.putShort(cw.newPackage(packaze)).putShort(access);
- if (modules == null) {
- exports.putShort(0);
- size += 6;
- } else {
- exports.putShort(modules.length);
- for(String module: modules) {
- exports.putShort(cw.newModule(module));
- }
- size += 6 + 2 * modules.length;
- }
- exportCount++;
+
+ /** Where the constants used in this AnnotationWriter must be stored. */
+ private final SymbolTable symbolTable;
+
+ /** The module_name_index field of the JVMS Module attribute. */
+ private final int moduleNameIndex;
+
+ /** The module_flags field of the JVMS Module attribute. */
+ private final int moduleFlags;
+
+ /** The module_version_index field of the JVMS Module attribute. */
+ private final int moduleVersionIndex;
+
+ /** The requires_count field of the JVMS Module attribute. */
+ private int requiresCount;
+
+ /** The binary content of the 'requires' array of the JVMS Module attribute. */
+ private final ByteVector requires;
+
+ /** The exports_count field of the JVMS Module attribute. */
+ private int exportsCount;
+
+ /** The binary content of the 'exports' array of the JVMS Module attribute. */
+ private final ByteVector exports;
+
+ /** The opens_count field of the JVMS Module attribute. */
+ private int opensCount;
+
+ /** The binary content of the 'opens' array of the JVMS Module attribute. */
+ private final ByteVector opens;
+
+ /** The uses_count field of the JVMS Module attribute. */
+ private int usesCount;
+
+ /** The binary content of the 'uses_index' array of the JVMS Module attribute. */
+ private final ByteVector usesIndex;
+
+ /** The provides_count field of the JVMS Module attribute. */
+ private int providesCount;
+
+ /** The binary content of the 'provides' array of the JVMS Module attribute. */
+ private final ByteVector provides;
+
+ /** The provides_count field of the JVMS ModulePackages attribute. */
+ private int packageCount;
+
+ /** The binary content of the 'package_index' array of the JVMS ModulePackages attribute. */
+ private final ByteVector packageIndex;
+
+ /** The main_class_index field of the JVMS ModuleMainClass attribute, or 0. */
+ private int mainClassIndex;
+
+ ModuleWriter(final SymbolTable symbolTable, final int name, final int access, final int version) {
+ super(Opcodes.ASM7);
+ this.symbolTable = symbolTable;
+ this.moduleNameIndex = name;
+ this.moduleFlags = access;
+ this.moduleVersionIndex = version;
+ this.requires = new ByteVector();
+ this.exports = new ByteVector();
+ this.opens = new ByteVector();
+ this.usesIndex = new ByteVector();
+ this.provides = new ByteVector();
+ this.packageIndex = new ByteVector();
+ }
+
+ @Override
+ public void visitMainClass(final String mainClass) {
+ this.mainClassIndex = symbolTable.addConstantClass(mainClass).index;
+ }
+
+ @Override
+ public void visitPackage(final String packaze) {
+ packageIndex.putShort(symbolTable.addConstantPackage(packaze).index);
+ packageCount++;
+ }
+
+ @Override
+ public void visitRequire(final String module, final int access, final String version) {
+ requires
+ .putShort(symbolTable.addConstantModule(module).index)
+ .putShort(access)
+ .putShort(version == null ? 0 : symbolTable.addConstantUtf8(version));
+ requiresCount++;
+ }
+
+ @Override
+ public void visitExport(final String packaze, final int access, final String... modules) {
+ exports.putShort(symbolTable.addConstantPackage(packaze).index).putShort(access);
+ if (modules == null) {
+ exports.putShort(0);
+ } else {
+ exports.putShort(modules.length);
+ for (String module : modules) {
+ exports.putShort(symbolTable.addConstantModule(module).index);
+ }
}
-
- @Override
- public void visitOpen(String packaze, int access, String... modules) {
- if (opens == null) {
- opens = new ByteVector();
- }
- opens.putShort(cw.newPackage(packaze)).putShort(access);
- if (modules == null) {
- opens.putShort(0);
- size += 6;
- } else {
- opens.putShort(modules.length);
- for(String module: modules) {
- opens.putShort(cw.newModule(module));
- }
- size += 6 + 2 * modules.length;
- }
- openCount++;
+ exportsCount++;
+ }
+
+ @Override
+ public void visitOpen(final String packaze, final int access, final String... modules) {
+ opens.putShort(symbolTable.addConstantPackage(packaze).index).putShort(access);
+ if (modules == null) {
+ opens.putShort(0);
+ } else {
+ opens.putShort(modules.length);
+ for (String module : modules) {
+ opens.putShort(symbolTable.addConstantModule(module).index);
+ }
}
-
- @Override
- public void visitUse(String service) {
- if (uses == null) {
- uses = new ByteVector();
- }
- uses.putShort(cw.newClass(service));
- useCount++;
- size += 2;
+ opensCount++;
+ }
+
+ @Override
+ public void visitUse(final String service) {
+ usesIndex.putShort(symbolTable.addConstantClass(service).index);
+ usesCount++;
+ }
+
+ @Override
+ public void visitProvide(final String service, final String... providers) {
+ provides.putShort(symbolTable.addConstantClass(service).index);
+ provides.putShort(providers.length);
+ for (String provider : providers) {
+ provides.putShort(symbolTable.addConstantClass(provider).index);
}
-
- @Override
- public void visitProvide(String service, String... providers) {
- if (provides == null) {
- provides = new ByteVector();
- }
- provides.putShort(cw.newClass(service));
- provides.putShort(providers.length);
- for(String provider: providers) {
- provides.putShort(cw.newClass(provider));
- }
- provideCount++;
- size += 4 + 2 * providers.length;
+ providesCount++;
+ }
+
+ @Override
+ public void visitEnd() {
+ // Nothing to do.
+ }
+
+ /**
+ * Returns the number of Module, ModulePackages and ModuleMainClass attributes generated by this
+ * ModuleWriter.
+ *
+ * @return the number of Module, ModulePackages and ModuleMainClass attributes (between 1 and 3).
+ */
+ int getAttributeCount() {
+ return 1 + (packageCount > 0 ? 1 : 0) + (mainClassIndex > 0 ? 1 : 0);
+ }
+
+ /**
+ * Returns the size of the Module, ModulePackages and ModuleMainClass attributes generated by this
+ * ModuleWriter. Also add the names of these attributes in the constant pool.
+ *
+ * @return the size in bytes of the Module, ModulePackages and ModuleMainClass attributes.
+ */
+ int computeAttributesSize() {
+ symbolTable.addConstantUtf8(Constants.MODULE);
+ // 6 attribute header bytes, 6 bytes for name, flags and version, and 5 * 2 bytes for counts.
+ int size =
+ 22 + requires.length + exports.length + opens.length + usesIndex.length + provides.length;
+ if (packageCount > 0) {
+ symbolTable.addConstantUtf8(Constants.MODULE_PACKAGES);
+ // 6 attribute header bytes, and 2 bytes for package_count.
+ size += 8 + packageIndex.length;
}
-
- @Override
- public void visitEnd() {
- // empty
+ if (mainClassIndex > 0) {
+ symbolTable.addConstantUtf8(Constants.MODULE_MAIN_CLASS);
+ // 6 attribute header bytes, and 2 bytes for main_class_index.
+ size += 8;
}
+ return size;
+ }
- void putAttributes(ByteVector out) {
- if (mainClass != 0) {
- out.putShort(cw.newUTF8("ModuleMainClass")).putInt(2).putShort(mainClass);
- }
- if (packages != null) {
- out.putShort(cw.newUTF8("ModulePackages"))
- .putInt(2 + 2 * packageCount)
- .putShort(packageCount)
- .putByteArray(packages.data, 0, packages.length);
- }
+ /**
+ * Puts the Module, ModulePackages and ModuleMainClass attributes generated by this ModuleWriter
+ * in the given ByteVector.
+ *
+ * @param output where the attributes must be put.
+ */
+ void putAttributes(final ByteVector output) {
+ // 6 bytes for name, flags and version, and 5 * 2 bytes for counts.
+ int moduleAttributeLength =
+ 16 + requires.length + exports.length + opens.length + usesIndex.length + provides.length;
+ output
+ .putShort(symbolTable.addConstantUtf8(Constants.MODULE))
+ .putInt(moduleAttributeLength)
+ .putShort(moduleNameIndex)
+ .putShort(moduleFlags)
+ .putShort(moduleVersionIndex)
+ .putShort(requiresCount)
+ .putByteArray(requires.data, 0, requires.length)
+ .putShort(exportsCount)
+ .putByteArray(exports.data, 0, exports.length)
+ .putShort(opensCount)
+ .putByteArray(opens.data, 0, opens.length)
+ .putShort(usesCount)
+ .putByteArray(usesIndex.data, 0, usesIndex.length)
+ .putShort(providesCount)
+ .putByteArray(provides.data, 0, provides.length);
+ if (packageCount > 0) {
+ output
+ .putShort(symbolTable.addConstantUtf8(Constants.MODULE_PACKAGES))
+ .putInt(2 + packageIndex.length)
+ .putShort(packageCount)
+ .putByteArray(packageIndex.data, 0, packageIndex.length);
}
-
- void put(ByteVector out) {
- out.putInt(size);
- out.putShort(name).putShort(access).putShort(version);
- out.putShort(requireCount);
- if (requires != null) {
- out.putByteArray(requires.data, 0, requires.length);
- }
- out.putShort(exportCount);
- if (exports != null) {
- out.putByteArray(exports.data, 0, exports.length);
- }
- out.putShort(openCount);
- if (opens != null) {
- out.putByteArray(opens.data, 0, opens.length);
- }
- out.putShort(useCount);
- if (uses != null) {
- out.putByteArray(uses.data, 0, uses.length);
- }
- out.putShort(provideCount);
- if (provides != null) {
- out.putByteArray(provides.data, 0, provides.length);
- }
- }
+ if (mainClassIndex > 0) {
+ output
+ .putShort(symbolTable.addConstantUtf8(Constants.MODULE_MAIN_CLASS))
+ .putInt(2)
+ .putShort(mainClassIndex);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Opcodes.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Opcodes.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Opcodes.java
old mode 100644
new mode 100755
index c710ad8..94b98f9
--- a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Opcodes.java
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Opcodes.java
@@ -1,372 +1,340 @@
-/***
- * ASM: a very small and fast Java bytecode manipulation framework
- * Copyright (c) 2000-2011 INRIA, France Telecom
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
package org.apache.tapestry5.internal.plastic.asm;
/**
- * Defines the JVM opcodes, access flags and array type codes. This interface
- * does not define all the JVM opcodes because some opcodes are automatically
- * handled. For example, the xLOAD and xSTORE opcodes are automatically replaced
- * by xLOAD_n and xSTORE_n opcodes when possible. The xLOAD_n and xSTORE_n
- * opcodes are therefore not defined in this interface. Likewise for LDC,
- * automatically replaced by LDC_W or LDC2_W when necessary, WIDE, GOTO_W and
- * JSR_W.
- *
+ * The JVM opcodes, access flags and array type codes. This interface does not define all the JVM
+ * opcodes because some opcodes are automatically handled. For example, the xLOAD and xSTORE opcodes
+ * are automatically replaced by xLOAD_n and xSTORE_n opcodes when possible. The xLOAD_n and
+ * xSTORE_n opcodes are therefore not defined in this interface. Likewise for LDC, automatically
+ * replaced by LDC_W or LDC2_W when necessary, WIDE, GOTO_W and JSR_W.
+ *
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se11/html/jvms-6.html">JVMS 6</a>
* @author Eric Bruneton
* @author Eugene Kuleshov
*/
+// DontCheck(InterfaceIsType): can't be fixed (for backward binary compatibility).
public interface Opcodes {
- // ASM API versions
+ // ASM API versions.
+
+ int ASM4 = 4 << 16 | 0 << 8;
+ int ASM5 = 5 << 16 | 0 << 8;
+ int ASM6 = 6 << 16 | 0 << 8;
+ int ASM7 = 7 << 16 | 0 << 8;
+
+ // Java ClassFile versions (the minor version is stored in the 16 most
+ // significant bits, and the
+ // major version in the 16 least significant bits).
- int ASM4 = 4 << 16 | 0 << 8 | 0;
- int ASM5 = 5 << 16 | 0 << 8 | 0;
- int ASM6 = 6 << 16 | 0 << 8 | 0;
+ int V1_1 = 3 << 16 | 45;
+ int V1_2 = 0 << 16 | 46;
+ int V1_3 = 0 << 16 | 47;
+ int V1_4 = 0 << 16 | 48;
+ int V1_5 = 0 << 16 | 49;
+ int V1_6 = 0 << 16 | 50;
+ int V1_7 = 0 << 16 | 51;
+ int V1_8 = 0 << 16 | 52;
+ int V9 = 0 << 16 | 53;
+ int V10 = 0 << 16 | 54;
+ int V11 = 0 << 16 | 55;
+ int V12 = 0 << 16 | 56;
- // versions
+ /**
+ * Version flag indicating that the class is using 'preview' features.
+ *
+ * <p>{@code version & V_PREVIEW == V_PREVIEW} tests if a version is flagged with {@code
+ * V_PREVIEW}.
+ */
+ int V_PREVIEW = 0xFFFF0000;
- int V1_1 = 3 << 16 | 45;
- int V1_2 = 0 << 16 | 46;
- int V1_3 = 0 << 16 | 47;
- int V1_4 = 0 << 16 | 48;
- int V1_5 = 0 << 16 | 49;
- int V1_6 = 0 << 16 | 50;
- int V1_7 = 0 << 16 | 51;
- int V1_8 = 0 << 16 | 52;
- int V9 = 0 << 16 | 53;
+ // Access flags values, defined in
+ // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1
+ // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.5-200-A.1
+ // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.6-200-A.1
+ // - https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.25
- // access flags
+ int ACC_PUBLIC = 0x0001; // class, field, method
+ int ACC_PRIVATE = 0x0002; // class, field, method
+ int ACC_PROTECTED = 0x0004; // class, field, method
+ int ACC_STATIC = 0x0008; // field, method
+ int ACC_FINAL = 0x0010; // class, field, method, parameter
+ int ACC_SUPER = 0x0020; // class
+ int ACC_SYNCHRONIZED = 0x0020; // method
+ int ACC_OPEN = 0x0020; // module
+ int ACC_TRANSITIVE = 0x0020; // module requires
+ int ACC_VOLATILE = 0x0040; // field
+ int ACC_BRIDGE = 0x0040; // method
+ int ACC_STATIC_PHASE = 0x0040; // module requires
+ int ACC_VARARGS = 0x0080; // method
+ int ACC_TRANSIENT = 0x0080; // field
+ int ACC_NATIVE = 0x0100; // method
+ int ACC_INTERFACE = 0x0200; // class
+ int ACC_ABSTRACT = 0x0400; // class, method
+ int ACC_STRICT = 0x0800; // method
+ int ACC_SYNTHETIC = 0x1000; // class, field, method, parameter, module *
+ int ACC_ANNOTATION = 0x2000; // class
+ int ACC_ENUM = 0x4000; // class(?) field inner
+ int ACC_MANDATED = 0x8000; // parameter, module, module *
+ int ACC_MODULE = 0x8000; // class
- int ACC_PUBLIC = 0x0001; // class, field, method
- int ACC_PRIVATE = 0x0002; // class, field, method
- int ACC_PROTECTED = 0x0004; // class, field, method
- int ACC_STATIC = 0x0008; // field, method
- int ACC_FINAL = 0x0010; // class, field, method, parameter
- int ACC_SUPER = 0x0020; // class
- int ACC_SYNCHRONIZED = 0x0020; // method
- int ACC_OPEN = 0x0020; // module
- int ACC_TRANSITIVE = 0x0020; // module requires
- int ACC_VOLATILE = 0x0040; // field
- int ACC_BRIDGE = 0x0040; // method
- int ACC_STATIC_PHASE = 0x0040; // module requires
- int ACC_VARARGS = 0x0080; // method
- int ACC_TRANSIENT = 0x0080; // field
- int ACC_NATIVE = 0x0100; // method
- int ACC_INTERFACE = 0x0200; // class
- int ACC_ABSTRACT = 0x0400; // class, method
- int ACC_STRICT = 0x0800; // method
- int ACC_SYNTHETIC = 0x1000; // class, field, method, parameter, module *
- int ACC_ANNOTATION = 0x2000; // class
- int ACC_ENUM = 0x4000; // class(?) field inner
- int ACC_MANDATED = 0x8000; // parameter, module, module *
- int ACC_MODULE = 0x8000; // class
-
+ // ASM specific access flags.
+ // WARNING: the 16 least significant bits must NOT be used, to avoid conflicts with standard
+ // access flags, and also to make sure that these flags are automatically filtered out when
+ // written in class files (because access flags are stored using 16 bits only).
- // ASM specific pseudo access flags
+ int ACC_DEPRECATED = 0x20000; // class, field, method
- int ACC_DEPRECATED = 0x20000; // class, field, method
+ // Possible values for the type operand of the NEWARRAY instruction.
+ // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-6.html#jvms-6.5.newarray.
- // types for NEWARRAY
+ int T_BOOLEAN = 4;
+ int T_CHAR = 5;
+ int T_FLOAT = 6;
+ int T_DOUBLE = 7;
+ int T_BYTE = 8;
+ int T_SHORT = 9;
+ int T_INT = 10;
+ int T_LONG = 11;
- int T_BOOLEAN = 4;
- int T_CHAR = 5;
- int T_FLOAT = 6;
- int T_DOUBLE = 7;
- int T_BYTE = 8;
- int T_SHORT = 9;
- int T_INT = 10;
- int T_LONG = 11;
+ // Possible values for the reference_kind field of CONSTANT_MethodHandle_info structures.
+ // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4.8.
- // tags for Handle
+ int H_GETFIELD = 1;
+ int H_GETSTATIC = 2;
+ int H_PUTFIELD = 3;
+ int H_PUTSTATIC = 4;
+ int H_INVOKEVIRTUAL = 5;
+ int H_INVOKESTATIC = 6;
+ int H_INVOKESPECIAL = 7;
+ int H_NEWINVOKESPECIAL = 8;
+ int H_INVOKEINTERFACE = 9;
- int H_GETFIELD = 1;
- int H_GETSTATIC = 2;
- int H_PUTFIELD = 3;
- int H_PUTSTATIC = 4;
- int H_INVOKEVIRTUAL = 5;
- int H_INVOKESTATIC = 6;
- int H_INVOKESPECIAL = 7;
- int H_NEWINVOKESPECIAL = 8;
- int H_INVOKEINTERFACE = 9;
+ // ASM specific stack map frame types, used in {@link ClassVisitor#visitFrame}.
- // stack map frame types
+ /** An expanded frame. See {@link ClassReader#EXPAND_FRAMES}. */
+ int F_NEW = -1;
- /**
- * Represents an expanded frame. See {@link ClassReader#EXPAND_FRAMES}.
- */
- int F_NEW = -1;
+ /** A compressed frame with complete frame data. */
+ int F_FULL = 0;
- /**
- * Represents a compressed frame with complete frame data.
- */
- int F_FULL = 0;
+ /**
+ * A compressed frame where locals are the same as the locals in the previous frame, except that
+ * additional 1-3 locals are defined, and with an empty stack.
+ */
+ int F_APPEND = 1;
- /**
- * Represents a compressed frame where locals are the same as the locals in
- * the previous frame, except that additional 1-3 locals are defined, and
- * with an empty stack.
- */
- int F_APPEND = 1;
+ /**
+ * A compressed frame where locals are the same as the locals in the previous frame, except that
+ * the last 1-3 locals are absent and with an empty stack.
+ */
+ int F_CHOP = 2;
- /**
- * Represents a compressed frame where locals are the same as the locals in
- * the previous frame, except that the last 1-3 locals are absent and with
- * an empty stack.
- */
- int F_CHOP = 2;
+ /**
+ * A compressed frame with exactly the same locals as the previous frame and with an empty stack.
+ */
+ int F_SAME = 3;
- /**
- * Represents a compressed frame with exactly the same locals as the
- * previous frame and with an empty stack.
- */
- int F_SAME = 3;
+ /**
+ * A compressed frame with exactly the same locals as the previous frame and with a single value
+ * on the stack.
+ */
+ int F_SAME1 = 4;
- /**
- * Represents a compressed frame with exactly the same locals as the
- * previous frame and with a single value on the stack.
- */
- int F_SAME1 = 4;
+ // Standard stack map frame element types, used in {@link ClassVisitor#visitFrame}.
- // Do not try to change the following code to use auto-boxing,
- // these values are compared by reference and not by value
- // The constructor of Integer was deprecated in 9
- // but we are stuck with it by backward compatibility
- @SuppressWarnings("deprecation") Integer TOP = new Integer(0);
- @SuppressWarnings("deprecation") Integer INTEGER = new Integer(1);
- @SuppressWarnings("deprecation") Integer FLOAT = new Integer(2);
- @SuppressWarnings("deprecation") Integer DOUBLE = new Integer(3);
- @SuppressWarnings("deprecation") Integer LONG = new Integer(4);
- @SuppressWarnings("deprecation") Integer NULL = new Integer(5);
- @SuppressWarnings("deprecation") Integer UNINITIALIZED_THIS = new Integer(6);
+ Integer TOP = Frame.ITEM_TOP;
+ Integer INTEGER = Frame.ITEM_INTEGER;
+ Integer FLOAT = Frame.ITEM_FLOAT;
+ Integer DOUBLE = Frame.ITEM_DOUBLE;
+ Integer LONG = Frame.ITEM_LONG;
+ Integer NULL = Frame.ITEM_NULL;
+ Integer UNINITIALIZED_THIS = Frame.ITEM_UNINITIALIZED_THIS;
- // opcodes // visit method (- = idem)
+ // The JVM opcode values (with the MethodVisitor method name used to visit them in comment, and
+ // where '-' means 'same method name as on the previous line').
+ // See https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-6.html.
- int NOP = 0; // visitInsn
- int ACONST_NULL = 1; // -
- int ICONST_M1 = 2; // -
- int ICONST_0 = 3; // -
- int ICONST_1 = 4; // -
- int ICONST_2 = 5; // -
- int ICONST_3 = 6; // -
- int ICONST_4 = 7; // -
- int ICONST_5 = 8; // -
- int LCONST_0 = 9; // -
- int LCONST_1 = 10; // -
- int FCONST_0 = 11; // -
- int FCONST_1 = 12; // -
- int FCONST_2 = 13; // -
- int DCONST_0 = 14; // -
- int DCONST_1 = 15; // -
- int BIPUSH = 16; // visitIntInsn
- int SIPUSH = 17; // -
- int LDC = 18; // visitLdcInsn
- // int LDC_W = 19; // -
- // int LDC2_W = 20; // -
- int ILOAD = 21; // visitVarInsn
- int LLOAD = 22; // -
- int FLOAD = 23; // -
- int DLOAD = 24; // -
- int ALOAD = 25; // -
- // int ILOAD_0 = 26; // -
- // int ILOAD_1 = 27; // -
- // int ILOAD_2 = 28; // -
- // int ILOAD_3 = 29; // -
- // int LLOAD_0 = 30; // -
- // int LLOAD_1 = 31; // -
- // int LLOAD_2 = 32; // -
- // int LLOAD_3 = 33; // -
- // int FLOAD_0 = 34; // -
- // int FLOAD_1 = 35; // -
- // int FLOAD_2 = 36; // -
- // int FLOAD_3 = 37; // -
- // int DLOAD_0 = 38; // -
- // int DLOAD_1 = 39; // -
- // int DLOAD_2 = 40; // -
- // int DLOAD_3 = 41; // -
- // int ALOAD_0 = 42; // -
- // int ALOAD_1 = 43; // -
- // int ALOAD_2 = 44; // -
- // int ALOAD_3 = 45; // -
- int IALOAD = 46; // visitInsn
- int LALOAD = 47; // -
- int FALOAD = 48; // -
- int DALOAD = 49; // -
- int AALOAD = 50; // -
- int BALOAD = 51; // -
- int CALOAD = 52; // -
- int SALOAD = 53; // -
- int ISTORE = 54; // visitVarInsn
- int LSTORE = 55; // -
- int FSTORE = 56; // -
- int DSTORE = 57; // -
- int ASTORE = 58; // -
- // int ISTORE_0 = 59; // -
- // int ISTORE_1 = 60; // -
- // int ISTORE_2 = 61; // -
- // int ISTORE_3 = 62; // -
- // int LSTORE_0 = 63; // -
- // int LSTORE_1 = 64; // -
- // int LSTORE_2 = 65; // -
- // int LSTORE_3 = 66; // -
- // int FSTORE_0 = 67; // -
- // int FSTORE_1 = 68; // -
- // int FSTORE_2 = 69; // -
- // int FSTORE_3 = 70; // -
- // int DSTORE_0 = 71; // -
- // int DSTORE_1 = 72; // -
- // int DSTORE_2 = 73; // -
- // int DSTORE_3 = 74; // -
- // int ASTORE_0 = 75; // -
- // int ASTORE_1 = 76; // -
- // int ASTORE_2 = 77; // -
- // int ASTORE_3 = 78; // -
- int IASTORE = 79; // visitInsn
- int LASTORE = 80; // -
- int FASTORE = 81; // -
- int DASTORE = 82; // -
- int AASTORE = 83; // -
- int BASTORE = 84; // -
- int CASTORE = 85; // -
- int SASTORE = 86; // -
- int POP = 87; // -
- int POP2 = 88; // -
- int DUP = 89; // -
- int DUP_X1 = 90; // -
- int DUP_X2 = 91; // -
- int DUP2 = 92; // -
- int DUP2_X1 = 93; // -
- int DUP2_X2 = 94; // -
- int SWAP = 95; // -
- int IADD = 96; // -
- int LADD = 97; // -
- int FADD = 98; // -
- int DADD = 99; // -
- int ISUB = 100; // -
- int LSUB = 101; // -
- int FSUB = 102; // -
- int DSUB = 103; // -
- int IMUL = 104; // -
- int LMUL = 105; // -
- int FMUL = 106; // -
- int DMUL = 107; // -
- int IDIV = 108; // -
- int LDIV = 109; // -
- int FDIV = 110; // -
- int DDIV = 111; // -
- int IREM = 112; // -
- int LREM = 113; // -
- int FREM = 114; // -
- int DREM = 115; // -
- int INEG = 116; // -
- int LNEG = 117; // -
- int FNEG = 118; // -
- int DNEG = 119; // -
- int ISHL = 120; // -
- int LSHL = 121; // -
- int ISHR = 122; // -
- int LSHR = 123; // -
- int IUSHR = 124; // -
- int LUSHR = 125; // -
- int IAND = 126; // -
- int LAND = 127; // -
- int IOR = 128; // -
- int LOR = 129; // -
- int IXOR = 130; // -
- int LXOR = 131; // -
- int IINC = 132; // visitIincInsn
- int I2L = 133; // visitInsn
- int I2F = 134; // -
- int I2D = 135; // -
- int L2I = 136; // -
- int L2F = 137; // -
- int L2D = 138; // -
- int F2I = 139; // -
- int F2L = 140; // -
- int F2D = 141; // -
- int D2I = 142; // -
- int D2L = 143; // -
- int D2F = 144; // -
- int I2B = 145; // -
- int I2C = 146; // -
- int I2S = 147; // -
- int LCMP = 148; // -
- int FCMPL = 149; // -
- int FCMPG = 150; // -
- int DCMPL = 151; // -
- int DCMPG = 152; // -
- int IFEQ = 153; // visitJumpInsn
- int IFNE = 154; // -
- int IFLT = 155; // -
- int IFGE = 156; // -
- int IFGT = 157; // -
- int IFLE = 158; // -
- int IF_ICMPEQ = 159; // -
- int IF_ICMPNE = 160; // -
- int IF_ICMPLT = 161; // -
- int IF_ICMPGE = 162; // -
- int IF_ICMPGT = 163; // -
- int IF_ICMPLE = 164; // -
- int IF_ACMPEQ = 165; // -
- int IF_ACMPNE = 166; // -
- int GOTO = 167; // -
- int JSR = 168; // -
- int RET = 169; // visitVarInsn
- int TABLESWITCH = 170; // visiTableSwitchInsn
- int LOOKUPSWITCH = 171; // visitLookupSwitch
- int IRETURN = 172; // visitInsn
- int LRETURN = 173; // -
- int FRETURN = 174; // -
- int DRETURN = 175; // -
- int ARETURN = 176; // -
- int RETURN = 177; // -
- int GETSTATIC = 178; // visitFieldInsn
- int PUTSTATIC = 179; // -
- int GETFIELD = 180; // -
- int PUTFIELD = 181; // -
- int INVOKEVIRTUAL = 182; // visitMethodInsn
- int INVOKESPECIAL = 183; // -
- int INVOKESTATIC = 184; // -
- int INVOKEINTERFACE = 185; // -
- int INVOKEDYNAMIC = 186; // visitInvokeDynamicInsn
- int NEW = 187; // visitTypeInsn
- int NEWARRAY = 188; // visitIntInsn
- int ANEWARRAY = 189; // visitTypeInsn
- int ARRAYLENGTH = 190; // visitInsn
- int ATHROW = 191; // -
- int CHECKCAST = 192; // visitTypeInsn
- int INSTANCEOF = 193; // -
- int MONITORENTER = 194; // visitInsn
- int MONITOREXIT = 195; // -
- // int WIDE = 196; // NOT VISITED
- int MULTIANEWARRAY = 197; // visitMultiANewArrayInsn
- int IFNULL = 198; // visitJumpInsn
- int IFNONNULL = 199; // -
- // int GOTO_W = 200; // -
- // int JSR_W = 201; // -
+ int NOP = 0; // visitInsn
+ int ACONST_NULL = 1; // -
+ int ICONST_M1 = 2; // -
+ int ICONST_0 = 3; // -
+ int ICONST_1 = 4; // -
+ int ICONST_2 = 5; // -
+ int ICONST_3 = 6; // -
+ int ICONST_4 = 7; // -
+ int ICONST_5 = 8; // -
+ int LCONST_0 = 9; // -
+ int LCONST_1 = 10; // -
+ int FCONST_0 = 11; // -
+ int FCONST_1 = 12; // -
+ int FCONST_2 = 13; // -
+ int DCONST_0 = 14; // -
+ int DCONST_1 = 15; // -
+ int BIPUSH = 16; // visitIntInsn
+ int SIPUSH = 17; // -
+ int LDC = 18; // visitLdcInsn
+ int ILOAD = 21; // visitVarInsn
+ int LLOAD = 22; // -
+ int FLOAD = 23; // -
+ int DLOAD = 24; // -
+ int ALOAD = 25; // -
+ int IALOAD = 46; // visitInsn
+ int LALOAD = 47; // -
+ int FALOAD = 48; // -
+ int DALOAD = 49; // -
+ int AALOAD = 50; // -
+ int BALOAD = 51; // -
+ int CALOAD = 52; // -
+ int SALOAD = 53; // -
+ int ISTORE = 54; // visitVarInsn
+ int LSTORE = 55; // -
+ int FSTORE = 56; // -
+ int DSTORE = 57; // -
+ int ASTORE = 58; // -
+ int IASTORE = 79; // visitInsn
+ int LASTORE = 80; // -
+ int FASTORE = 81; // -
+ int DASTORE = 82; // -
+ int AASTORE = 83; // -
+ int BASTORE = 84; // -
+ int CASTORE = 85; // -
+ int SASTORE = 86; // -
+ int POP = 87; // -
+ int POP2 = 88; // -
+ int DUP = 89; // -
+ int DUP_X1 = 90; // -
+ int DUP_X2 = 91; // -
+ int DUP2 = 92; // -
+ int DUP2_X1 = 93; // -
+ int DUP2_X2 = 94; // -
+ int SWAP = 95; // -
+ int IADD = 96; // -
+ int LADD = 97; // -
+ int FADD = 98; // -
+ int DADD = 99; // -
+ int ISUB = 100; // -
+ int LSUB = 101; // -
+ int FSUB = 102; // -
+ int DSUB = 103; // -
+ int IMUL = 104; // -
+ int LMUL = 105; // -
+ int FMUL = 106; // -
+ int DMUL = 107; // -
+ int IDIV = 108; // -
+ int LDIV = 109; // -
+ int FDIV = 110; // -
+ int DDIV = 111; // -
+ int IREM = 112; // -
+ int LREM = 113; // -
+ int FREM = 114; // -
+ int DREM = 115; // -
+ int INEG = 116; // -
+ int LNEG = 117; // -
+ int FNEG = 118; // -
+ int DNEG = 119; // -
+ int ISHL = 120; // -
+ int LSHL = 121; // -
+ int ISHR = 122; // -
+ int LSHR = 123; // -
+ int IUSHR = 124; // -
+ int LUSHR = 125; // -
+ int IAND = 126; // -
+ int LAND = 127; // -
+ int IOR = 128; // -
+ int LOR = 129; // -
+ int IXOR = 130; // -
+ int LXOR = 131; // -
+ int IINC = 132; // visitIincInsn
+ int I2L = 133; // visitInsn
+ int I2F = 134; // -
+ int I2D = 135; // -
+ int L2I = 136; // -
+ int L2F = 137; // -
+ int L2D = 138; // -
+ int F2I = 139; // -
+ int F2L = 140; // -
+ int F2D = 141; // -
+ int D2I = 142; // -
+ int D2L = 143; // -
+ int D2F = 144; // -
+ int I2B = 145; // -
+ int I2C = 146; // -
+ int I2S = 147; // -
+ int LCMP = 148; // -
+ int FCMPL = 149; // -
+ int FCMPG = 150; // -
+ int DCMPL = 151; // -
+ int DCMPG = 152; // -
+ int IFEQ = 153; // visitJumpInsn
+ int IFNE = 154; // -
+ int IFLT = 155; // -
+ int IFGE = 156; // -
+ int IFGT = 157; // -
+ int IFLE = 158; // -
+ int IF_ICMPEQ = 159; // -
+ int IF_ICMPNE = 160; // -
+ int IF_ICMPLT = 161; // -
+ int IF_ICMPGE = 162; // -
+ int IF_ICMPGT = 163; // -
+ int IF_ICMPLE = 164; // -
+ int IF_ACMPEQ = 165; // -
+ int IF_ACMPNE = 166; // -
+ int GOTO = 167; // -
+ int JSR = 168; // -
+ int RET = 169; // visitVarInsn
+ int TABLESWITCH = 170; // visiTableSwitchInsn
+ int LOOKUPSWITCH = 171; // visitLookupSwitch
+ int IRETURN = 172; // visitInsn
+ int LRETURN = 173; // -
+ int FRETURN = 174; // -
+ int DRETURN = 175; // -
+ int ARETURN = 176; // -
+ int RETURN = 177; // -
+ int GETSTATIC = 178; // visitFieldInsn
+ int PUTSTATIC = 179; // -
+ int GETFIELD = 180; // -
+ int PUTFIELD = 181; // -
+ int INVOKEVIRTUAL = 182; // visitMethodInsn
+ int INVOKESPECIAL = 183; // -
+ int INVOKESTATIC = 184; // -
+ int INVOKEINTERFACE = 185; // -
+ int INVOKEDYNAMIC = 186; // visitInvokeDynamicInsn
+ int NEW = 187; // visitTypeInsn
+ int NEWARRAY = 188; // visitIntInsn
+ int ANEWARRAY = 189; // visitTypeInsn
+ int ARRAYLENGTH = 190; // visitInsn
+ int ATHROW = 191; // -
+ int CHECKCAST = 192; // visitTypeInsn
+ int INSTANCEOF = 193; // -
+ int MONITORENTER = 194; // visitInsn
+ int MONITOREXIT = 195; // -
+ int MULTIANEWARRAY = 197; // visitMultiANewArrayInsn
+ int IFNULL = 198; // visitJumpInsn
+ int IFNONNULL = 199; // -
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/1c71aec7/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Symbol.java
----------------------------------------------------------------------
diff --git a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Symbol.java b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Symbol.java
new file mode 100755
index 0000000..e1a5aa1
--- /dev/null
+++ b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Symbol.java
@@ -0,0 +1,243 @@
+// ASM: a very small and fast Java bytecode manipulation framework
+// Copyright (c) 2000-2011 INRIA, France Telecom
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 3. Neither the name of the copyright holders nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+// THE POSSIBILITY OF SUCH DAMAGE.
+package org.apache.tapestry5.internal.plastic.asm;
+
+/**
+ * An entry of the constant pool, of the BootstrapMethods attribute, or of the (ASM specific) type
+ * table of a class.
+ *
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4">JVMS
+ * 4.4</a>
+ * @see <a href="https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.23">JVMS
+ * 4.7.23</a>
+ * @author Eric Bruneton
+ */
+abstract class Symbol {
+
+ // Tag values for the constant pool entries (using the same order as in the JVMS).
+
+ /** The tag value of CONSTANT_Class_info JVMS structures. */
+ static final int CONSTANT_CLASS_TAG = 7;
+
+ /** The tag value of CONSTANT_Fieldref_info JVMS structures. */
+ static final int CONSTANT_FIELDREF_TAG = 9;
+
+ /** The tag value of CONSTANT_Methodref_info JVMS structures. */
+ static final int CONSTANT_METHODREF_TAG = 10;
+
+ /** The tag value of CONSTANT_InterfaceMethodref_info JVMS structures. */
+ static final int CONSTANT_INTERFACE_METHODREF_TAG = 11;
+
+ /** The tag value of CONSTANT_String_info JVMS structures. */
+ static final int CONSTANT_STRING_TAG = 8;
+
+ /** The tag value of CONSTANT_Integer_info JVMS structures. */
+ static final int CONSTANT_INTEGER_TAG = 3;
+
+ /** The tag value of CONSTANT_Float_info JVMS structures. */
+ static final int CONSTANT_FLOAT_TAG = 4;
+
+ /** The tag value of CONSTANT_Long_info JVMS structures. */
+ static final int CONSTANT_LONG_TAG = 5;
+
+ /** The tag value of CONSTANT_Double_info JVMS structures. */
+ static final int CONSTANT_DOUBLE_TAG = 6;
+
+ /** The tag value of CONSTANT_NameAndType_info JVMS structures. */
+ static final int CONSTANT_NAME_AND_TYPE_TAG = 12;
+
+ /** The tag value of CONSTANT_Utf8_info JVMS structures. */
+ static final int CONSTANT_UTF8_TAG = 1;
+
+ /** The tag value of CONSTANT_MethodHandle_info JVMS structures. */
+ static final int CONSTANT_METHOD_HANDLE_TAG = 15;
+
+ /** The tag value of CONSTANT_MethodType_info JVMS structures. */
+ static final int CONSTANT_METHOD_TYPE_TAG = 16;
+
+ /** The tag value of CONSTANT_Dynamic_info JVMS structures. */
+ static final int CONSTANT_DYNAMIC_TAG = 17;
+
+ /** The tag value of CONSTANT_InvokeDynamic_info JVMS structures. */
+ static final int CONSTANT_INVOKE_DYNAMIC_TAG = 18;
+
+ /** The tag value of CONSTANT_Module_info JVMS structures. */
+ static final int CONSTANT_MODULE_TAG = 19;
+
+ /** The tag value of CONSTANT_Package_info JVMS structures. */
+ static final int CONSTANT_PACKAGE_TAG = 20;
+
+ // Tag values for the BootstrapMethods attribute entries (ASM specific tag).
+
+ /** The tag value of the BootstrapMethods attribute entries. */
+ static final int BOOTSTRAP_METHOD_TAG = 64;
+
+ // Tag values for the type table entries (ASM specific tags).
+
+ /** The tag value of a normal type entry in the (ASM specific) type table of a class. */
+ static final int TYPE_TAG = 128;
+
+ /**
+ * The tag value of an {@link Frame#ITEM_UNINITIALIZED} type entry in the type table of a class.
+ */
+ static final int UNINITIALIZED_TYPE_TAG = 129;
+
+ /** The tag value of a merged type entry in the (ASM specific) type table of a class. */
+ static final int MERGED_TYPE_TAG = 130;
+
+ // Instance fields.
+
+ /**
+ * The index of this symbol in the constant pool, in the BootstrapMethods attribute, or in the
+ * (ASM specific) type table of a class (depending on the {@link #tag} value).
+ */
+ final int index;
+
+ /**
+ * A tag indicating the type of this symbol. Must be one of the static tag values defined in this
+ * class.
+ */
+ final int tag;
+
+ /**
+ * The internal name of the owner class of this symbol. Only used for {@link
+ * #CONSTANT_FIELDREF_TAG}, {@link #CONSTANT_METHODREF_TAG}, {@link
+ * #CONSTANT_INTERFACE_METHODREF_TAG}, and {@link #CONSTANT_METHOD_HANDLE_TAG} symbols.
+ */
+ final String owner;
+
+ /**
+ * The name of the class field or method corresponding to this symbol. Only used for {@link
+ * #CONSTANT_FIELDREF_TAG}, {@link #CONSTANT_METHODREF_TAG}, {@link
+ * #CONSTANT_INTERFACE_METHODREF_TAG}, {@link #CONSTANT_NAME_AND_TYPE_TAG}, {@link
+ * #CONSTANT_METHOD_HANDLE_TAG}, {@link #CONSTANT_DYNAMIC_TAG} and {@link
+ * #CONSTANT_INVOKE_DYNAMIC_TAG} symbols.
+ */
+ final String name;
+
+ /**
+ * The string value of this symbol. This is:
+ *
+ * <ul>
+ * <li>a field or method descriptor for {@link #CONSTANT_FIELDREF_TAG}, {@link
+ * #CONSTANT_METHODREF_TAG}, {@link #CONSTANT_INTERFACE_METHODREF_TAG}, {@link
+ * #CONSTANT_NAME_AND_TYPE_TAG}, {@link #CONSTANT_METHOD_HANDLE_TAG}, {@link
+ * #CONSTANT_METHOD_TYPE_TAG}, {@link #CONSTANT_DYNAMIC_TAG} and {@link
+ * #CONSTANT_INVOKE_DYNAMIC_TAG} symbols,
+ * <li>an arbitrary string for {@link #CONSTANT_UTF8_TAG} and {@link #CONSTANT_STRING_TAG}
+ * symbols,
+ * <li>an internal class name for {@link #CONSTANT_CLASS_TAG}, {@link #TYPE_TAG} and {@link
+ * #UNINITIALIZED_TYPE_TAG} symbols,
+ * <li>{@literal null} for the other types of symbol.
+ * </ul>
+ */
+ final String value;
+
+ /**
+ * The numeric value of this symbol. This is:
+ *
+ * <ul>
+ * <li>the symbol's value for {@link #CONSTANT_INTEGER_TAG},{@link #CONSTANT_FLOAT_TAG}, {@link
+ * #CONSTANT_LONG_TAG}, {@link #CONSTANT_DOUBLE_TAG},
+ * <li>the CONSTANT_MethodHandle_info reference_kind field value for {@link
+ * #CONSTANT_METHOD_HANDLE_TAG} symbols,
+ * <li>the CONSTANT_InvokeDynamic_info bootstrap_method_attr_index field value for {@link
+ * #CONSTANT_INVOKE_DYNAMIC_TAG} symbols,
+ * <li>the offset of a bootstrap method in the BootstrapMethods boostrap_methods array, for
+ * {@link #CONSTANT_DYNAMIC_TAG} or {@link #BOOTSTRAP_METHOD_TAG} symbols,
+ * <li>the bytecode offset of the NEW instruction that created an {@link
+ * Frame#ITEM_UNINITIALIZED} type for {@link #UNINITIALIZED_TYPE_TAG} symbols,
+ * <li>the indices (in the class' type table) of two {@link #TYPE_TAG} source types for {@link
+ * #MERGED_TYPE_TAG} symbols,
+ * <li>0 for the other types of symbol.
+ * </ul>
+ */
+ final long data;
+
+ /**
+ * Additional information about this symbol, generally computed lazily. <i>Warning: the value of
+ * this field is ignored when comparing Symbol instances</i> (to avoid duplicate entries in a
+ * SymbolTable). Therefore, this field should only contain data that can be computed from the
+ * other fields of this class. It contains:
+ *
+ * <ul>
+ * <li>the {@link Type#getArgumentsAndReturnSizes} of the symbol's method descriptor for {@link
+ * #CONSTANT_METHODREF_TAG}, {@link #CONSTANT_INTERFACE_METHODREF_TAG} and {@link
+ * #CONSTANT_INVOKE_DYNAMIC_TAG} symbols,
+ * <li>the index in the InnerClasses_attribute 'classes' array (plus one) corresponding to this
+ * class, for {@link #CONSTANT_CLASS_TAG} symbols,
+ * <li>the index (in the class' type table) of the merged type of the two source types for
+ * {@link #MERGED_TYPE_TAG} symbols,
+ * <li>0 for the other types of symbol, or if this field has not been computed yet.
+ * </ul>
+ */
+ int info;
+
+ /**
+ * Constructs a new Symbol. This constructor can't be used directly because the Symbol class is
+ * abstract. Instead, use the factory methods of the {@link SymbolTable} class.
+ *
+ * @param index the symbol index in the constant pool, in the BootstrapMethods attribute, or in
+ * the (ASM specific) type table of a class (depending on 'tag').
+ * @param tag the symbol type. Must be one of the static tag values defined in this class.
+ * @param owner The internal name of the symbol's owner class. Maybe {@literal null}.
+ * @param name The name of the symbol's corresponding class field or method. Maybe {@literal
+ * null}.
+ * @param value The string value of this symbol. Maybe {@literal null}.
+ * @param data The numeric value of this symbol.
+ */
+ Symbol(
+ final int index,
+ final int tag,
+ final String owner,
+ final String name,
+ final String value,
+ final long data) {
+ this.index = index;
+ this.tag = tag;
+ this.owner = owner;
+ this.name = name;
+ this.value = value;
+ this.data = data;
+ }
+
+ /**
+ * Returns the result {@link Type#getArgumentsAndReturnSizes} on {@link #value}.
+ *
+ * @return the result {@link Type#getArgumentsAndReturnSizes} on {@link #value} (memoized in
+ * {@link #info} for efficiency). This should only be used for {@link
+ * #CONSTANT_METHODREF_TAG}, {@link #CONSTANT_INTERFACE_METHODREF_TAG} and {@link
+ * #CONSTANT_INVOKE_DYNAMIC_TAG} symbols.
+ */
+ int getArgumentsAndReturnSizes() {
+ if (info == 0) {
+ info = Type.getArgumentsAndReturnSizes(value);
+ }
+ return info;
+ }
+}