jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java Wed Jul 05 21:25:35 2017 +0200
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/ApplyTemplates.java Wed Mar 09 16:09:55 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,9 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: ApplyTemplates.java,v 1.2.4.1 2005/09/12 09:59:21 pvedula Exp $
- */
package com.sun.org.apache.xalan.internal.xsltc.compiler;
@@ -122,12 +119,10 @@
final int current = methodGen.getLocalIndex("current");
// check if sorting nodes is required
- final Vector sortObjects = new Vector();
- final Iterator<SyntaxTreeNode> children = elements();
- while (children.hasNext()) {
- final SyntaxTreeNode child = children.next();
+ final Vector<Sort> sortObjects = new Vector<>();
+ for (final SyntaxTreeNode child : getContents()) {
if (child instanceof Sort) {
- sortObjects.addElement(child);
+ sortObjects.addElement((Sort)child);
}
}
@@ -193,6 +188,13 @@
applyTemplatesSig);
il.append(new INVOKEVIRTUAL(applyTemplates));
+ // unmap parameters to release temporary result trees
+ for (final SyntaxTreeNode child : getContents()) {
+ if (child instanceof WithParam) {
+ ((WithParam)child).releaseResultTree(classGen, methodGen);
+ }
+ }
+
// Pop parameter frame
if (stylesheet.hasLocalParams() || hasContents()) {
il.append(classGen.loadTranslet());