This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 0b24c92115 Generate optimal size and types for JSP imports maps
0b24c92115 is described below

commit 0b24c92115a8c988834d83176ecfbd10f95058b6
Author: remm <r...@apache.org>
AuthorDate: Mon Jan 29 11:36:44 2024 +0100

    Generate optimal size and types for JSP imports maps
    
    BZ 68546, as suggested by John Engebretson.
---
 java/org/apache/jasper/compiler/Generator.java | 8 ++++++--
 webapps/docs/changelog.xml                     | 8 ++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Generator.java 
b/java/org/apache/jasper/compiler/Generator.java
index 77f64a4389..46a7238136 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -638,7 +638,9 @@ class Generator {
         out.pushIndent();
         // Packages is never empty because o.a.j.Constants.STANDARD_IMPORTS
         // contains 3 packages and is always added to the imports.
-        out.printin("_jspx_imports_packages = new java.util.HashSet<>();");
+        out.printin("_jspx_imports_packages = new java.util.LinkedHashSet<>(");
+        out.print(Integer.valueOf(packages.size()));
+        out.print(");");
         out.println();
         for (String packageName : packages) {
             out.printin("_jspx_imports_packages.add(\"");
@@ -650,7 +652,9 @@ class Generator {
             out.printin("_jspx_imports_classes = null;");
             out.println();
         } else {
-            out.printin("_jspx_imports_classes = new java.util.HashSet<>();");
+            out.printin("_jspx_imports_classes = new 
java.util.LinkedHashSet<>(");
+            out.print(Integer.valueOf(classes.size()));
+            out.print(");");
             out.println();
             for (String className : classes) {
                 out.printin("_jspx_imports_classes.add(\"");
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1be6e6d385..8f1b0c6652 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -136,6 +136,14 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <fix>
+        <bug>68546</bug>: Generate optimal size and types for JSP imports maps,
+        as suggested by John Engebretson. (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="WebSocket">
     <changelog>
       <fix>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to