You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/04/07 08:09:55 UTC
[tomcat] 06/06: Remove unnecessary code. There are always at least
3 package imports,
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 27a0d770284ff54881d867c2fd9218030ca77097
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 1 21:23:21 2021 +0100
Remove unnecessary code. There are always at least 3 package imports,
---
java/org/apache/jasper/compiler/Generator.java | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java
index 91d4ddc..07de664 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -620,18 +620,16 @@ class Generator {
out.println();
out.printil("static {");
out.pushIndent();
- if (packages.size() == 0) {
- out.printin("_jspx_imports_packages = null;");
- out.println();
- } else {
- out.printin("_jspx_imports_packages = new java.util.HashSet<>();");
- out.println();
- for (String packageName : packages) {
- out.printin("_jspx_imports_packages.add(\"");
- out.print(packageName);
- out.println("\");");
- }
+ // 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.println();
+ for (String packageName : packages) {
+ out.printin("_jspx_imports_packages.add(\"");
+ out.print(packageName);
+ out.println("\");");
}
+ // classes however, may be empty depending on the import declarations
if (classes.size() == 0) {
out.printin("_jspx_imports_classes = null;");
out.println();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org