[581077] Jakarta EE 10 support, code cleanups

Change-Id: I290afd8bef53630fc2e0045041bf0ddc44de969c
diff --git a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCoreMessages.java b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCoreMessages.java
index e38d6c2..7b54020 100644
--- a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCoreMessages.java
+++ b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCoreMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2022 IBM Corporation and others.
+ * Copyright (c) 2005, 2023 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -36,6 +36,7 @@
 	public static String JSPDirectiveValidator_11;
 	public static String JSPDirectiveValidator_12;
 	public static String JSPDirectiveValidator_13;
+	public static String JSPDirectiveValidator_14;
 	
 	public static String JSPActionValidator_0;
 
diff --git a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePluginResources.properties b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePluginResources.properties
index 95f46bb..e4d261a 100644
--- a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePluginResources.properties
+++ b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePluginResources.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2004, 2022 IBM Corporation and others.
+# Copyright (c) 2004, 2023 IBM Corporation and others.
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License 2.0
 # which accompanies this distribution, and is available at
@@ -32,7 +32,8 @@
 JSPDirectiveValidator_10=Can not find the tag library descriptor for "{0}".  Try using a newer grammar or declared version in the Web Deployment Descriptor.
 JSPDirectiveValidator_11=Can not find the tag directory "{0}"
 JSPDirectiveValidator_12=The attribute name "{0}" is used more than once
-JSPDirectiveValidator_13=The superclass "{0}", determined from the Dynamic Web Module facet version ({1}), was not found on the Java Build Path
+JSPDirectiveValidator_13=The default superclass, "{0}", according to the project's Dynamic Web Module facet version ({1}), was not found on the Java Build Path.
+JSPDirectiveValidator_14=The default superclass, "{0}", according to the project's Web Fragment Module facet version ({1}), was not found on the Java Build Path.
 JSPActionValidator_0=Tag ({0}) must be empty
 JSPActionValidator_1="{0}" does not support runtime expressions
 JSPBatchValidator_0=Gathering files in {0}
diff --git a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/DeploymentDescriptorPropertyCache.java b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/DeploymentDescriptorPropertyCache.java
index f941156..a25c05c 100644
--- a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/DeploymentDescriptorPropertyCache.java
+++ b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/DeploymentDescriptorPropertyCache.java
@@ -602,7 +602,7 @@
 	private static final boolean _debugResolutionCache = false;
 
 	// Java Servlet API version
-	static final float DEFAULT_WEBAPP_VERSION = 5f; // Jakarta EE 9
+	static final float DEFAULT_WEBAPP_VERSION = 6f; // Jakarta EE 10
 
 	static final String EL_IGNORED = "el-ignored"; //$NON-NLS-1$
 	static final String ID = "id"; //$NON-NLS-1$
@@ -795,6 +795,10 @@
 	 */
 	private float convertSpecVersions(float version) {
 		if (version > 0) {
+			if (version == 6.1f)
+				return 4f;
+			if (version == 6f)
+				return 3.1f;
 			if (version == 5f)
 				return 3f;
 			if (version == 4f)
diff --git a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/ServletAPIDescriptor.java b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/ServletAPIDescriptor.java
index bc0ddf6..44f76da 100644
--- a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/ServletAPIDescriptor.java
+++ b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/ServletAPIDescriptor.java
@@ -36,7 +36,7 @@
 		 **/

 		DEFAULT

 	}

-	public static final ServletAPIDescriptor DEFAULT = new ServletAPIDescriptor("jakarta.servlet", 5, ORIGIN.DEFAULT);

+	public static final ServletAPIDescriptor DEFAULT = new ServletAPIDescriptor("jakarta.servlet", 6, ORIGIN.DEFAULT);

 	private ORIGIN fOrigin;

 

 	String fRootPackage;

diff --git a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java
index b54b8a4..cd13e05 100644
--- a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java
+++ b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2022 IBM Corporation and others.
+ * Copyright (c) 2004, 2023 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -130,7 +130,7 @@
 	 * @see #writeRanges(ObjectOutput, HashMap)
 	 * @see #readRanges(ObjectInput)
 	 */
-	private static final long serialVersionUID = 5L;
+	private static final long serialVersionUID = 6L;
 	
 	/** for debugging */
 	private static final boolean DEBUG = Boolean.valueOf(Platform.getDebugOption("org.eclipse.jst.jsp.core/debug/jspjavamapping")).booleanValue(); //$NON-NLS-1$
@@ -743,6 +743,9 @@
 				if (fIsDefaultSuperclass && fServletAPIDescriptor.getOrigin().equals(ServletAPIDescriptor.ORIGIN.FACET)) {
 					problem = createJSPProblem(IJSPProblem.F_PROBLEM_ID_LITERAL, IProblem.UndefinedType, MessageFormat.format(JSPCoreMessages.JSPDirectiveValidator_13, errorTypeNames.get(i).toString(), String.valueOf(fServletAPIDescriptor.getAPIversion())), 0, 1);					
 				}
+				else if (fIsDefaultSuperclass && fServletAPIDescriptor.getOrigin().equals(ServletAPIDescriptor.ORIGIN.FFACET)) {
+					problem = createJSPProblem(IJSPProblem.F_PROBLEM_ID_LITERAL, IProblem.UndefinedType, MessageFormat.format(JSPCoreMessages.JSPDirectiveValidator_14, errorTypeNames.get(i).toString(), String.valueOf(fServletAPIDescriptor.getAPIversion())), 0, 1);
+				}
 				fTranslationProblems.add(problem);
 			}
 		}
diff --git a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java
index f9c64ef..251d2b2 100644
--- a/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java
+++ b/web/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2018 IBM Corporation and others.
+ * Copyright (c) 2004, 2023 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -28,6 +28,7 @@
 import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP;
 import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
 import org.eclipse.jst.jsp.core.internal.util.FileContentCache;
+import org.eclipse.jst.jsp.css.core.internal.parserz.JSPedCSSRegionContexts;
 import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler;
 import org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker;
 import org.eclipse.wst.sse.core.internal.ltk.parser.StructuredDocumentRegionHandler;
@@ -217,7 +218,7 @@
 					processUseBean(sdRegion);
 				}
 			}
-			else if (sdRegion.getFirstRegion().getType() == DOMJSPRegionContexts.JSP_CONTENT || sdRegion.getFirstRegion().getType() == DOMRegionContext.XML_CONTENT) {
+			else if (sdRegion.getFirstRegion().getType() == DOMJSPRegionContexts.JSP_CONTENT || sdRegion.getFirstRegion().getType() == DOMRegionContext.XML_CONTENT || sdRegion.getFirstRegion().getType() == JSPedCSSRegionContexts.CSS_JSP_SCRIPTLET || sdRegion.getFirstRegion().getType() == JSPedCSSRegionContexts.CSS_JSP_EXP || sdRegion.getFirstRegion().getType() == JSPedCSSRegionContexts.CSS_JSP_DECL) {
 				// this section assumes important content (to translate)
 				// is AFTER the opening tag
 				if (fTagname != null) {
@@ -234,14 +235,14 @@
 				}
 				else {
 					final String previousType = sdRegion.getPrevious() != null ? sdRegion.getPrevious().getType() : null;
-					if (previousType != null) {
-						if (DOMJSPRegionContexts.JSP_EXPRESSION_OPEN.equals(previousType)) {
+					if (previousType != null || sdRegion.getPrevious() == null) {
+						if (DOMJSPRegionContexts.JSP_EXPRESSION_OPEN.equals(previousType) || JSPedCSSRegionContexts.CSS_JSP_EXP.equals(sdRegion.getFirstRegion().getType())) {
 							processExpression(sdRegion, true);
 						}
-						else if (DOMJSPRegionContexts.JSP_SCRIPTLET_OPEN.equals(previousType)) {
+						else if (DOMJSPRegionContexts.JSP_SCRIPTLET_OPEN.equals(previousType) || JSPedCSSRegionContexts.CSS_JSP_SCRIPTLET.equals(sdRegion.getFirstRegion().getType())) {
 							processScriptlet(sdRegion, true);
 						}
-						else if (DOMJSPRegionContexts.JSP_DECLARATION_OPEN.equals(previousType)) {
+						else if (DOMJSPRegionContexts.JSP_DECLARATION_OPEN.equals(previousType) || JSPedCSSRegionContexts.CSS_JSP_DECL.equals(sdRegion.getFirstRegion().getType())) {
 							processDeclaration(sdRegion, true);
 						}
 					}