mbien commented on code in PR #8976:
URL: https://github.com/apache/netbeans/pull/8976#discussion_r2500556193
##########
enterprise/web.jspparser/extsrc/org/apache/jasper/compiler/GetParseData.java:
##########
@@ -315,11 +329,162 @@ private static
org.netbeans.modules.web.jsps.parserapi.PageInfo convertPageInfo(
nbPageInfo.setXMLView(xmlView);
nbPageInfo.setTagFile(ctxt.isTagFile());
- nbPageInfo.setTagInfo(ctxt.getTagInfo());
-
+ nbPageInfo.setTagInfo(convert(convertedObjects, ctxt.getTagInfo()));
+
return nbPageInfo;
}
+ private static org.netbeans.modules.web.jsps.parserapi.TagInfo
convert(IdentityHashMap<Object,Object> convertedObjects, TagInfo source) {
+ if(source == null) {
+ return null;
+ }
+
+ if(convertedObjects.containsKey(source)) {
+ return (org.netbeans.modules.web.jsps.parserapi.TagInfo)
convertedObjects.get(source);
+ }
+
+ org.netbeans.modules.web.jsps.parserapi.TagInfo result = new
org.netbeans.modules.web.jsps.parserapi.TagInfo();
+ convertedObjects.put(source, result);
+
+ TagData td = new TagData(new Object[][]{});
+ result.setDisplayName(source.getDisplayName());
+ result.setTagClassName(source.getTagClassName());
+ result.setTagName(source.getTagName());
+ result.setBodyContent(source.getBodyContent());
+ result.setInfoString(source.getInfoString());
+ result.setTagLibrary(convert(convertedObjects,
source.getTagLibrary()));
+ result.getAttributes().addAll(stream(source.getAttributes()).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
+
result.getVariables().addAll(stream(source.getTagVariableInfos()).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
+
result.getRuntimeVariables().addAll(stream(source.getVariableInfo(td)).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
+
+ return result;
+ }
+
+ private static org.netbeans.modules.web.jsps.parserapi.TagLibraryInfo
convert(IdentityHashMap<Object,Object> convertedObjects, TagLibraryInfo source)
{
+ if(source == null) {
+ return null;
+ }
+
+ if(convertedObjects.containsKey(source)) {
+ return (org.netbeans.modules.web.jsps.parserapi.TagLibraryInfo)
convertedObjects.get(source);
+ }
+
+ org.netbeans.modules.web.jsps.parserapi.TagLibraryInfo result = new
org.netbeans.modules.web.jsps.parserapi.TagLibraryInfo();
+ convertedObjects.put(source, result);
+
+ result.setShortName(source.getShortName());
+ result.setReliableURN(source.getReliableURN());
+ result.setInfoString(source.getInfoString());
+ result.setURI(source.getURI());
+ result.setPrefixString(source.getPrefixString());
+ result.setRequiredVersion(source.getRequiredVersion());
+ result.setTlibversion(getFieldByReflection("tlibversion", source));
+ result.getTags().addAll(stream(source.getTags()).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
+ result.getTagFiles().addAll(stream(source.getTagFiles()).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
Review Comment:
could use `stream.toList()`
##########
enterprise/web.jspparser/src/org/netbeans/modules/web/jsps/parserapi/TagAttributeInfo.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.web.jsps.parserapi;
+
+public class TagAttributeInfo {
+ private String name;
+ private String typeName;
+ private boolean required;
+ private boolean fragment;
+ private boolean canBeRequestTime;
+
+ public TagAttributeInfo() {
+ }
Review Comment:
question: aren't those new `Tag*` objects in this package immutable once
created?
Since its API, it might be better to remove the no-arg constructor and the
setters - or even make it a record?
##########
enterprise/web.jspparser/extsrc/org/apache/jasper/compiler/NodeConverterVisitor.java:
##########
@@ -279,26 +299,34 @@ public void visit(Node.CustomTag n) throws
JasperException {
n.getAttributes(),
convertMark(n.getStart()),
parentNode,
-
n.getTagInfo(),
n.getTagHandlerClass()
);
}
else {
// we do have a tag file
+ Set<String> fragmentAttributes = new HashSet<>();
+ for(TagAttributeInfo tai:
n.getTagFileInfo().getTagInfo().getAttributes()) {
+ if (tai.isFragment()) {
+ fragmentAttributes.add(tai.getName());
+ }
+ }
Review Comment:
some tabs made it into this section
##########
enterprise/web.jspparser/src/org/netbeans/modules/web/jsps/parserapi/Node.java:
##########
@@ -1381,17 +1429,25 @@ public boolean hasScriptingVars() {
/**
* Represents a custom tag
*/
+ @SuppressWarnings("UseOfObsoleteCollectionType")
public static class CustomTag extends Node {
+ private static final Set<String> ITERATION_TAGS = new
HashSet<>(asList("jakarta.servlet.jsp.tagext.IterationTag",
"javax.servlet.jsp.tagext.IterationTag"));
+ private static final Set<String> BODY_TAGS = new
HashSet<>(asList("jakarta.servlet.jsp.tagext.BodyTag",
"javax.servlet.jsp.tagext.BodyTag"));
+ private static final Set<String> TRY_CATCH_FINALLY_TAGS = new
HashSet<>(asList("jakarta.servlet.jsp.tagext.TryCatchFinally",
"javax.servlet.jsp.tagext.TryCatchFinally"));
+ private static final Set<String> SIMPLE_TAGS = new
HashSet<>(asList("jakarta.servlet.jsp.tagext.SimpleTag",
"javax.servlet.jsp.tagext.SimpleTag"));
+ private static final Set<String> DYNAMIC_ATTRIBUTES = new
HashSet<>(asList("jakarta.servlet.jsp.tagext.DynamicAttributes",
"javax.servlet.jsp.tagext.DynamicAttributes"));
Review Comment:
`Set.of()` ?
##########
enterprise/web.jspparser/extsrc/org/apache/jasper/compiler/GetParseData.java:
##########
@@ -315,11 +329,162 @@ private static
org.netbeans.modules.web.jsps.parserapi.PageInfo convertPageInfo(
nbPageInfo.setXMLView(xmlView);
nbPageInfo.setTagFile(ctxt.isTagFile());
- nbPageInfo.setTagInfo(ctxt.getTagInfo());
-
+ nbPageInfo.setTagInfo(convert(convertedObjects, ctxt.getTagInfo()));
+
return nbPageInfo;
}
+ private static org.netbeans.modules.web.jsps.parserapi.TagInfo
convert(IdentityHashMap<Object,Object> convertedObjects, TagInfo source) {
+ if(source == null) {
+ return null;
+ }
+
+ if(convertedObjects.containsKey(source)) {
+ return (org.netbeans.modules.web.jsps.parserapi.TagInfo)
convertedObjects.get(source);
+ }
+
+ org.netbeans.modules.web.jsps.parserapi.TagInfo result = new
org.netbeans.modules.web.jsps.parserapi.TagInfo();
+ convertedObjects.put(source, result);
+
+ TagData td = new TagData(new Object[][]{});
+ result.setDisplayName(source.getDisplayName());
+ result.setTagClassName(source.getTagClassName());
+ result.setTagName(source.getTagName());
+ result.setBodyContent(source.getBodyContent());
+ result.setInfoString(source.getInfoString());
+ result.setTagLibrary(convert(convertedObjects,
source.getTagLibrary()));
+ result.getAttributes().addAll(stream(source.getAttributes()).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
+
result.getVariables().addAll(stream(source.getTagVariableInfos()).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
+
result.getRuntimeVariables().addAll(stream(source.getVariableInfo(td)).map(s ->
convert(convertedObjects, s)).collect(Collectors.toList()));
Review Comment:
could use `stream.toList()`
##########
enterprise/libs.elimpl/nbproject/project.xml:
##########
@@ -29,9 +29,9 @@
<code-name-base>org.netbeans.modules.servletjspapi</code-name-base>
<build-prerequisite/>
<compile-dependency/>
- <run-dependency>
- <release-version>1</release-version>
- <specification-version>1.1</specification-version>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.62.0</specification-version>
</run-dependency>
Review Comment:
this has now a mix of tabs and spaces.
NB uses 8 space per tab by default, gh uses 4.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists