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

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


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

commit d4a3db1a4ad43d1ba5620bcf84d675ffe42701a0
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 9906248fd1..8d84f818a9 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -631,7 +631,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(\"");
@@ -643,7 +645,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 9057ad335e..0d671a80ea 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -130,6 +130,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