This is an automated email from the ASF dual-hosted git repository.
benweidig pushed a commit to branch javax
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/javax by this push:
new 0987a7ded TAP5-2830: Automate ASM vendoring
0987a7ded is described below
commit 0987a7dedbe52053d0b05b591605c8d9dec8fd06
Author: Ben Weidig <[email protected]>
AuthorDate: Tue May 26 07:33:15 2026 +0200
TAP5-2830: Automate ASM vendoring
---
justfile | 4 +
.../{LICENSE-ASM-9_2.txt => LICENSE-ASM_9_9.txt} | 0
plastic/NOTICE.txt | 4 +-
.../tapestry5/internal/plastic/asm/Constants.java | 6 +-
.../internal/plastic/asm/commons/package.html | 2 +-
.../tapestry5/internal/plastic/asm/package.html | 28 ++---
.../internal/plastic/asm/signature/package.html | 2 +-
.../plastic/asm/tree/analysis/package.html | 2 +-
.../internal/plastic/asm/tree/package.html | 2 +-
.../internal/plastic/asm/util/package.html | 2 +-
.../apache/tapestry5/plastic/PlasticConstants.java | 2 +-
plastic/vendor-asm.sh | 130 +++++++++++++++++++++
12 files changed, 159 insertions(+), 25 deletions(-)
diff --git a/justfile b/justfile
index bee48c574..5eec21126 100644
--- a/justfile
+++ b/justfile
@@ -55,3 +55,7 @@ clean-build:
# Compiles and generates all JavaScript files from CoffeeScript
generate-javascript:
./gradlew tapestry-core:compileCoffeeScript
tapestry-core:compileProcessedCoffeeScript tapestry-core:compileTestCoffeeScript
+
+# Vendors ASM based on Git tag, no tag lists the available ones
+vendor-asm tag="":
+ ./plastic/vendor-asm.sh {{tag}}
diff --git a/plastic/LICENSE-ASM-9_2.txt b/plastic/LICENSE-ASM_9_9.txt
old mode 100755
new mode 100644
similarity index 100%
rename from plastic/LICENSE-ASM-9_2.txt
rename to plastic/LICENSE-ASM_9_9.txt
diff --git a/plastic/NOTICE.txt b/plastic/NOTICE.txt
index beec8e08f..9718bb6e2 100644
--- a/plastic/NOTICE.txt
+++ b/plastic/NOTICE.txt
@@ -1,6 +1,6 @@
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
-This product imports and repackages ASM 5.0.1 code which is
+This product imports and repackages ASM 9.9.1 code which is
released under a BSD style License
-http://asm.ow2.org/license.html
+https://asm.ow2.io/license.html
diff --git
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Constants.java
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Constants.java
index ee9ed838d..bf9361d5b 100644
---
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Constants.java
+++
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/Constants.java
@@ -191,15 +191,15 @@ final class Constants {
}
static boolean isWhitelisted(final String internalName) {
- if (!internalName.startsWith("org/objectweb/asm/")) {
+ if
(!internalName.startsWith("org/apache/tapestry5/internal/plastic/asm/")) {
return false;
}
String member =
"(Annotation|Class|Field|Method|Module|RecordComponent|Signature)";
return internalName.contains("Test$")
|| Pattern.matches(
- "org/objectweb/asm/util/Trace" + member + "Visitor(\\$.*)?",
internalName)
+ "org/apache/tapestry5/internal/plastic/asm/util/Trace" + member +
"Visitor(\\$.*)?", internalName)
|| Pattern.matches(
- "org/objectweb/asm/util/Check" + member + "Adapter(\\$.*)?",
internalName);
+ "org/apache/tapestry5/internal/plastic/asm/util/Check" + member +
"Adapter(\\$.*)?", internalName);
}
static void checkIsPreview(final InputStream classInputStream) {
diff --git
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/package.html
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/package.html
index f24ae4faa..de52b68f4 100644
---
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/package.html
+++
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/commons/package.html
@@ -30,7 +30,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
-->
<head>
- <title>Package org.objectweb.asm.commons</title>
+ <title>Package org.apache.tapestry5.internal.plastic.asm.commons</title>
</head>
<body>
Provides some useful class and method adapters. <em>The preferred way of using
diff --git
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/package.html
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/package.html
index db0d8a2e4..ba396bf78 100644
---
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/package.html
+++
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/package.html
@@ -30,46 +30,46 @@
* THE POSSIBILITY OF SUCH DAMAGE.
-->
<head>
- <title>Package org.objectweb.asm</title>
+ <title>Package org.apache.tapestry5.internal.plastic.asm</title>
</head>
<body>
Provides a small and fast bytecode manipulation framework.
<p>
The <a href="http://asm.ow2.org/">ASM</a> framework is organized
-around the {@link org.objectweb.asm.ClassVisitor ClassVisitor},
-{@link org.objectweb.asm.FieldVisitor FieldVisitor},
-{@link org.objectweb.asm.MethodVisitor MethodVisitor} and
-{@link org.objectweb.asm.AnnotationVisitor AnnotationVisitor} abstract classes,
+around the {@link org.apache.tapestry5.internal.plastic.asm.ClassVisitor
ClassVisitor},
+{@link org.apache.tapestry5.internal.plastic.asm.FieldVisitor FieldVisitor},
+{@link org.apache.tapestry5.internal.plastic.asm.MethodVisitor MethodVisitor}
and
+{@link org.apache.tapestry5.internal.plastic.asm.AnnotationVisitor
AnnotationVisitor} abstract classes,
which allow one to visit the fields, methods and annotations of a class,
including the bytecode instructions of each method.
<p>
In addition to these main abstract classes, ASM provides a {@link
-org.objectweb.asm.ClassReader ClassReader} class, that can parse an
+org.apache.tapestry5.internal.plastic.asm.ClassReader ClassReader} class, that
can parse an
existing class and make a given visitor visit it. ASM also provides
-a {@link org.objectweb.asm.ClassWriter ClassWriter} class, which is
+a {@link org.apache.tapestry5.internal.plastic.asm.ClassWriter ClassWriter}
class, which is
a visitor that generates Java class files.
<p>
In order to generate a class from scratch, only the {@link
-org.objectweb.asm.ClassWriter ClassWriter} class is necessary. Indeed,
+org.apache.tapestry5.internal.plastic.asm.ClassWriter ClassWriter} class is
necessary. Indeed,
in order to generate a class, one must just call its visit<em>Xxx</em>
methods with the appropriate arguments to generate the desired fields
and methods.
<p>
In order to modify existing classes, one must use a {@link
-org.objectweb.asm.ClassReader ClassReader} class to analyze
-the original class, a class modifier, and a {@link
org.objectweb.asm.ClassWriter
+org.apache.tapestry5.internal.plastic.asm.ClassReader ClassReader} class to
analyze
+the original class, a class modifier, and a {@link
org.apache.tapestry5.internal.plastic.asm.ClassWriter
ClassWriter} to construct the modified class. The class modifier
-is just a {@link org.objectweb.asm.ClassVisitor ClassVisitor}
-that delegates most of the work to another {@link
org.objectweb.asm.ClassVisitor
+is just a {@link org.apache.tapestry5.internal.plastic.asm.ClassVisitor
ClassVisitor}
+that delegates most of the work to another {@link
org.apache.tapestry5.internal.plastic.asm.ClassVisitor
ClassVisitor}, but that sometimes changes some parameter values,
or call additional methods, in order to implement the desired
modification process. In order to make it easier to implement such
-class modifiers, the {@link org.objectweb.asm.ClassVisitor
-ClassVisitor} and {@link org.objectweb.asm.MethodVisitor MethodVisitor}
+class modifiers, the {@link
org.apache.tapestry5.internal.plastic.asm.ClassVisitor
+ClassVisitor} and {@link
org.apache.tapestry5.internal.plastic.asm.MethodVisitor MethodVisitor}
classes delegate by default all the method calls they receive to an
optional visitor.
diff --git
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/signature/package.html
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/signature/package.html
index d1657d41a..4cd88ef7a 100644
---
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/signature/package.html
+++
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/signature/package.html
@@ -30,7 +30,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
-->
<head>
- <title>Package org.objectweb.asm.signature</title>
+ <title>Package org.apache.tapestry5.internal.plastic.asm.signature</title>
</head>
<body>
Provides support for type signatures.
diff --git
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html
index 05624f6a1..621f8c0b6 100644
---
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html
+++
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/package.html
@@ -30,7 +30,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
-->
<head>
- <title>Package org.objectweb.asm.tree.analysis</title>
+ <title>Package
org.apache.tapestry5.internal.plastic.asm.tree.analysis</title>
</head>
<body>
diff --git
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html
index 9e7cd7a9a..1221b6398 100644
---
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html
+++
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/package.html
@@ -30,7 +30,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
-->
<head>
- <title>Package org.objectweb.asm.tree</title>
+ <title>Package org.apache.tapestry5.internal.plastic.asm.tree</title>
</head>
<body>
diff --git
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
index d2fed34c1..9c9f48cb7 100644
---
a/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
+++
b/plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/util/package.html
@@ -30,7 +30,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
-->
<head>
- <title>Package org.objectweb.asm.util</title>
+ <title>Package org.apache.tapestry5.internal.plastic.asm.util</title>
</head>
<body>
Provides ASM visitors that can be useful for programming and
diff --git
a/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticConstants.java
b/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticConstants.java
index 192c0a522..6652e05b9 100644
--- a/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticConstants.java
+++ b/plastic/src/main/java/org/apache/tapestry5/plastic/PlasticConstants.java
@@ -20,7 +20,7 @@ public final class PlasticConstants
/**
* The minimum Java version we support
*/
- public static final int DEFAULT_VERSION_OPCODE = Opcodes.V1_6;
+ public static final int DEFAULT_VERSION_OPCODE = Opcodes.V1_8;
private PlasticConstants()
{
diff --git a/plastic/vendor-asm.sh b/plastic/vendor-asm.sh
new file mode 100755
index 000000000..401ed0142
--- /dev/null
+++ b/plastic/vendor-asm.sh
@@ -0,0 +1,130 @@
+#!/usr/bin/env bash
+
+#
##############################################################################
+#
+# Vendors ASM source from gitlab.ow2.org into Apache Tapestry's internal
plastic package.
+# Combines asm, asm-commons, asm-tree, and asm-util into a single source tree
+# and rewrites the package from: org.objectweb.asm ->
org.apache.tapestry5.internal.plastic.asm
+#
+# Usage: ./vendor-asm.sh <TAG>
+# TAG : ASM git tag, e.g. ASM_9_10
+#
+# Run without arguments to list available tags.
+#
+#
##############################################################################
+
+set -euo pipefail
+
+ASM_REPO="https://gitlab.ow2.org/asm/asm.git"
+SRC_PKG="org.objectweb.asm"
+DST_PKG="org.apache.tapestry5.internal.plastic.asm"
+SRC_PATH="org/objectweb/asm"
+
+DST_PATH="./src/external/java/org/apache/tapestry5/internal/plastic/asm"
+
+MODULES=(
+ asm
+ asm-analysis
+ asm-commons
+ asm-tree
+ asm-util
+)
+
+TAG="${1:-}"
+
+if [[ -z "$TAG" ]]; then
+ echo "Usage: $0 <TAG>"
+ echo " Example: $0 ASM_9_10"
+ echo ""
+ echo "Available tags (fetched from remote):"
+ git ls-remote --tags "$ASM_REPO" | grep -o 'ASM_[0-9_]*$' | sort -V
+ exit 0
+fi
+
+#
##############################################################################
+
+echo "=> Cleaning '${DST_PATH}' and preparing clone desitnation"
+
+# Make sure we are in the correct directory
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+# Wipe the destination so removed or renamed files from a previous run don't
linger and break things
+rm -rf -- "${DST_PATH}"
+mkdir -p -- "${DST_PATH}"
+
+# Using temp directory so we never touch the working tree
+# and trap a cleanup step if the script fails partway through.
+WORK_DIR="$(mktemp -d)"
+trap 'rm -rf -- "${WORK_DIR}"' EXIT
+
+#
##############################################################################
+
+echo "=> Cloning ASM '${TAG}' ..."
+
+git clone --depth 1 --branch "${TAG}" "${ASM_REPO}" "${WORK_DIR}/asm-src"
--quiet
+
+#
##############################################################################
+
+echo "=> Copying sources from modules: ${MODULES[*]} ..."
+
+for MODULE in "${MODULES[@]}"; do
+ SRC_ROOT="${WORK_DIR}/asm-src/${MODULE}/src/main/java/${SRC_PATH}"
+
+ if [[ ! -d "${SRC_ROOT}" ]]; then
+ echo " WARNING: ${MODULE} has no sources at expected path,
skipping."
+ continue
+ fi
+
+ # SRC_ROOT ends at org/objectweb/asm, so the path stripped from each file
+ # naturally includes any subpackage directory (commons/, tree/, util/).
+ # This means all modules land under the same $DST_PATH without extra
nesting.
+ # Both .java and .html (package.html Javadoc) files are included.
+ find "${SRC_ROOT}" \( -name "*.java" -o -name "*.html" \) | while read -r
FILE; do
+ REL="${FILE#"${SRC_ROOT}"/}"
+ DEST_FILE="${DST_PATH}/${REL}"
+ mkdir -p "$(dirname "${DEST_FILE}")"
+ cp "${FILE}" "${DEST_FILE}"
+ done
+
+ COUNT=$(find "${SRC_ROOT}" -name "*.java" | wc -l | tr -d ' ')
+ echo " ${MODULE}: ${COUNT} files -> ${DST_PATH}"
+done
+
+#
##############################################################################
+
+echo "=> Rewriting package references ..."
+
+# Rewrite all occurrences of the old package to the new one
+#
+# Two forms must be handled:
+#
+# Dot Used in package/import declarations and Javadoc.
The
+# (org.objectweb.asm) dots in the sed pattern are escaped so they match
+# literally, not as regex wildcards, which would
+# otherwise also match org/objectweb/asm.
+#
+# Slash Used in runtime class-name strings, like ASM's
+# (org/objectweb/asm) Constants#checkAsmExperimental converts class names
+# via getName().replace('.','/') and then checks them
+# against the original location. Since the vendored
+# classes live in the new package at runtime, the
+# slash-form strings must match it too.
+
+SRC_PKG_ESCAPED="${SRC_PKG//./\\.}" # org\.objectweb\.asm (literal
dots for sed)
+SRC_PATH_SLASHED="${SRC_PKG//./\/}" # org/objectweb/asm
(slash-form to find)
+DST_PATH_SLASHED="${DST_PKG//./\/}" # org/apache/tapestry5/...
(slash-form replacement)
+
+find "${DST_PATH}" \( -name "*.java" -o -name "*.html" \) | while read -r
FILE; do
+ sed -i '' "s|${SRC_PKG_ESCAPED}|${DST_PKG}|g" "${FILE}"
+ sed -i '' "s|${SRC_PATH_SLASHED}|${DST_PATH_SLASHED}|g" "${FILE}"
+done
+
+#
##############################################################################
+
+echo "=> Copying LICENSE.txt as LICENSE-${TAG}.txt ..."
+
+cp -- "${WORK_DIR}/asm-src/LICENSE.txt" "./LICENSE-${TAG}.txt"
+
+#
##############################################################################
+
+echo "=> DONE! Please update the NOTICE.txt to mention '${TAG}'"