8181150: Fix lint warnings in JAXP repo: rawtypes and unchecked
Reviewed-by: lancea, rriggs, mullan
This commit is contained in:
parent
479ec4791b
commit
52d3c4b2e8
@ -27,12 +27,14 @@ import javax.xml.transform.TransformerException;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import com.sun.org.apache.xml.internal.security.utils.I18n;
|
||||
import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
|
||||
import com.sun.org.apache.xml.internal.utils.QName;
|
||||
import com.sun.org.apache.xpath.internal.NodeSetDTM;
|
||||
import com.sun.org.apache.xpath.internal.XPathContext;
|
||||
import com.sun.org.apache.xpath.internal.functions.Function;
|
||||
import com.sun.org.apache.xpath.internal.objects.XNodeSet;
|
||||
import com.sun.org.apache.xpath.internal.objects.XObject;
|
||||
import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
|
||||
import java.util.List;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
@ -145,8 +147,7 @@ public class FuncHere extends Function {
|
||||
* @param vars
|
||||
* @param globalsSize
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void fixupVariables(java.util.Vector vars, int globalsSize) {
|
||||
public void fixupVariables(List<QName> vars, int globalsSize) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -272,7 +272,7 @@ public abstract class lr_parser {
|
||||
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
|
||||
|
||||
/** The parse stack itself. */
|
||||
protected Stack stack = new Stack();
|
||||
protected Stack<Symbol> stack = new Stack<>();
|
||||
|
||||
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
|
||||
|
||||
@ -322,7 +322,7 @@ public abstract class lr_parser {
|
||||
public abstract Symbol do_action(
|
||||
int act_num,
|
||||
lr_parser parser,
|
||||
Stack stack,
|
||||
Stack<Symbol> stack,
|
||||
int top)
|
||||
throws java.lang.Exception;
|
||||
|
||||
@ -571,7 +571,7 @@ public abstract class lr_parser {
|
||||
/* current state is always on the top of the stack */
|
||||
|
||||
/* look up action out of the current state with the current input */
|
||||
act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym);
|
||||
act = get_action((stack.peek()).parse_state, cur_token.sym);
|
||||
|
||||
/* decode the action -- > 0 encodes shift */
|
||||
if (act > 0)
|
||||
@ -603,7 +603,7 @@ public abstract class lr_parser {
|
||||
}
|
||||
|
||||
/* look up the state to go to from the one popped back to */
|
||||
act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num);
|
||||
act = get_reduce((stack.peek()).parse_state, lhs_sym_num);
|
||||
|
||||
/* shift to that state */
|
||||
lhs_sym.parse_state = act;
|
||||
@ -626,7 +626,7 @@ public abstract class lr_parser {
|
||||
/* just in case that wasn't fatal enough, end parse */
|
||||
done_parsing();
|
||||
} else {
|
||||
lhs_sym = (Symbol)stack.peek();
|
||||
lhs_sym = stack.peek();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -661,8 +661,8 @@ public abstract class lr_parser {
|
||||
/* dump the stack */
|
||||
for (int i=0; i<stack.size(); i++)
|
||||
{
|
||||
debug_message("Symbol: " + ((Symbol)stack.elementAt(i)).sym +
|
||||
" State: " + ((Symbol)stack.elementAt(i)).parse_state);
|
||||
debug_message("Symbol: " + (stack.get(i)).sym +
|
||||
" State: " + (stack.get(i)).parse_state);
|
||||
}
|
||||
debug_message("==========================================");
|
||||
}
|
||||
@ -698,13 +698,13 @@ public abstract class lr_parser {
|
||||
/** Do debug output for stack state. [CSA]
|
||||
*/
|
||||
public void debug_stack() {
|
||||
StringBuffer sb=new StringBuffer("## STACK:");
|
||||
StringBuilder sb=new StringBuilder("## STACK:");
|
||||
for (int i=0; i<stack.size(); i++) {
|
||||
Symbol s = (Symbol) stack.elementAt(i);
|
||||
Symbol s = stack.get(i);
|
||||
sb.append(" <state "+s.parse_state+", sym "+s.sym+">");
|
||||
if ((i%3)==2 || (i==(stack.size()-1))) {
|
||||
debug_message(sb.toString());
|
||||
sb = new StringBuffer(" ");
|
||||
sb = new StringBuilder(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -762,7 +762,7 @@ public abstract class lr_parser {
|
||||
//debug_stack();
|
||||
|
||||
/* look up action out of the current state with the current input */
|
||||
act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym);
|
||||
act = get_action((stack.peek()).parse_state, cur_token.sym);
|
||||
|
||||
/* decode the action -- > 0 encodes shift */
|
||||
if (act > 0)
|
||||
@ -798,9 +798,9 @@ public abstract class lr_parser {
|
||||
}
|
||||
|
||||
/* look up the state to go to from the one popped back to */
|
||||
act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num);
|
||||
act = get_reduce((stack.peek()).parse_state, lhs_sym_num);
|
||||
debug_message("# Reduce rule: top state " +
|
||||
((Symbol)stack.peek()).parse_state +
|
||||
(stack.peek()).parse_state +
|
||||
", lhs sym " + lhs_sym_num + " -> state " + act);
|
||||
|
||||
/* shift to that state */
|
||||
@ -826,7 +826,7 @@ public abstract class lr_parser {
|
||||
/* just in case that wasn't fatal enough, end parse */
|
||||
done_parsing();
|
||||
} else {
|
||||
lhs_sym = (Symbol)stack.peek();
|
||||
lhs_sym = stack.peek();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -916,7 +916,7 @@ public abstract class lr_parser {
|
||||
protected boolean shift_under_error()
|
||||
{
|
||||
/* is there a shift under error Symbol */
|
||||
return get_action(((Symbol)stack.peek()).parse_state, error_sym()) > 0;
|
||||
return get_action((stack.peek()).parse_state, error_sym()) > 0;
|
||||
}
|
||||
|
||||
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
|
||||
@ -936,8 +936,8 @@ public abstract class lr_parser {
|
||||
if (debug) debug_message("# Finding recovery state on stack");
|
||||
|
||||
/* Remember the right-position of the top symbol on the stack */
|
||||
int right_pos = ((Symbol)stack.peek()).right;
|
||||
int left_pos = ((Symbol)stack.peek()).left;
|
||||
int right_pos = (stack.peek()).right;
|
||||
int left_pos = (stack.peek()).left;
|
||||
|
||||
/* pop down until we can shift under error Symbol */
|
||||
while (!shift_under_error())
|
||||
@ -945,7 +945,7 @@ public abstract class lr_parser {
|
||||
/* pop the stack */
|
||||
if (debug)
|
||||
debug_message("# Pop stack by one, state was # " +
|
||||
((Symbol)stack.peek()).parse_state);
|
||||
(stack.peek()).parse_state);
|
||||
left_pos = ((Symbol)stack.pop()).left;
|
||||
tos--;
|
||||
|
||||
@ -958,11 +958,11 @@ public abstract class lr_parser {
|
||||
}
|
||||
|
||||
/* state on top of the stack can shift under error, find the shift */
|
||||
act = get_action(((Symbol)stack.peek()).parse_state, error_sym());
|
||||
act = get_action((stack.peek()).parse_state, error_sym());
|
||||
if (debug)
|
||||
{
|
||||
debug_message("# Recover state found (#" +
|
||||
((Symbol)stack.peek()).parse_state + ")");
|
||||
(stack.peek()).parse_state + ")");
|
||||
debug_message("# Shifting on error to state #" + (act-1));
|
||||
}
|
||||
|
||||
@ -1145,7 +1145,7 @@ public abstract class lr_parser {
|
||||
debug_message("# Reparsing saved input with actions");
|
||||
debug_message("# Current Symbol is #" + cur_err_token().sym);
|
||||
debug_message("# Current state is #" +
|
||||
((Symbol)stack.peek()).parse_state);
|
||||
(stack.peek()).parse_state);
|
||||
}
|
||||
|
||||
/* continue until we accept or have read all lookahead input */
|
||||
@ -1155,7 +1155,7 @@ public abstract class lr_parser {
|
||||
|
||||
/* look up action out of the current state with the current input */
|
||||
act =
|
||||
get_action(((Symbol)stack.peek()).parse_state, cur_err_token().sym);
|
||||
get_action((stack.peek()).parse_state, cur_err_token().sym);
|
||||
|
||||
/* decode the action -- > 0 encodes shift */
|
||||
if (act > 0)
|
||||
@ -1205,7 +1205,7 @@ public abstract class lr_parser {
|
||||
}
|
||||
|
||||
/* look up the state to go to from the one popped back to */
|
||||
act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num);
|
||||
act = get_reduce((stack.peek()).parse_state, lhs_sym_num);
|
||||
|
||||
/* shift to that state */
|
||||
lhs_sym.parse_state = act;
|
||||
@ -1234,7 +1234,7 @@ public abstract class lr_parser {
|
||||
protected static short[][] unpackFromStrings(String[] sa)
|
||||
{
|
||||
// Concatanate initialization strings.
|
||||
StringBuffer sb = new StringBuffer(sa[0]);
|
||||
StringBuilder sb = new StringBuilder(sa[0]);
|
||||
for (int i=1; i<sa.length; i++)
|
||||
sb.append(sa[i]);
|
||||
int n=0; // location in initialization string
|
||||
|
@ -49,7 +49,7 @@ public class virtual_parse_stack {
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/** Constructor to build a virtual stack out of a real stack. */
|
||||
public virtual_parse_stack(Stack shadowing_stack) throws java.lang.Exception
|
||||
public virtual_parse_stack(Stack<Symbol> shadowing_stack) throws java.lang.Exception
|
||||
{
|
||||
/* sanity check */
|
||||
if (shadowing_stack == null)
|
||||
@ -58,7 +58,7 @@ public class virtual_parse_stack {
|
||||
|
||||
/* set up our internals */
|
||||
real_stack = shadowing_stack;
|
||||
vstack = new Stack();
|
||||
vstack = new Stack<>();
|
||||
real_next = 0;
|
||||
|
||||
/* get one element onto the virtual portion of the stack */
|
||||
@ -73,7 +73,7 @@ public class virtual_parse_stack {
|
||||
* the bottom of the virtual portion of the stack, but is always left
|
||||
* unmodified.
|
||||
*/
|
||||
protected Stack real_stack;
|
||||
protected Stack<Symbol> real_stack;
|
||||
|
||||
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
|
||||
|
||||
@ -91,7 +91,7 @@ public class virtual_parse_stack {
|
||||
* on the virtual stack). When this portion of the stack becomes empty we
|
||||
* transfer elements from the underlying stack onto this stack.
|
||||
*/
|
||||
protected Stack vstack;
|
||||
protected Stack<Integer> vstack;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/*--- General Methods ---------------------------------------*/
|
||||
@ -108,7 +108,7 @@ public class virtual_parse_stack {
|
||||
if (real_next >= real_stack.size()) return;
|
||||
|
||||
/* get a copy of the first Symbol we have not transfered */
|
||||
stack_sym = (Symbol)real_stack.elementAt(real_stack.size()-1-real_next);
|
||||
stack_sym = real_stack.get(real_stack.size()-1-real_next);
|
||||
|
||||
/* record the transfer */
|
||||
real_next++;
|
||||
@ -136,7 +136,7 @@ public class virtual_parse_stack {
|
||||
throw new Exception(
|
||||
"Internal parser error: top() called on empty virtual stack");
|
||||
|
||||
return ((Integer)vstack.peek()).intValue();
|
||||
return (vstack.peek());
|
||||
}
|
||||
|
||||
/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -73,8 +73,8 @@ public final class ExceptionConst {
|
||||
private static final Class<?>[] EXCS_FIELD_AND_METHOD_RESOLUTION = {
|
||||
NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR, NO_SUCH_METHOD_ERROR
|
||||
}; // Chapter 5.2
|
||||
private static final Class<?>[] EXCS_INTERFACE_METHOD_RESOLUTION = new Class[0]; // Chapter 5.3 (as below)
|
||||
private static final Class<?>[] EXCS_STRING_RESOLUTION = new Class[0];
|
||||
private static final Class<?>[] EXCS_INTERFACE_METHOD_RESOLUTION = new Class<?>[0]; // Chapter 5.3 (as below)
|
||||
private static final Class<?>[] EXCS_STRING_RESOLUTION = new Class<?>[0];
|
||||
// Chapter 5.4 (no errors but the ones that _always_ could happen! How stupid.)
|
||||
private static final Class<?>[] EXCS_ARRAY_EXCEPTION = {
|
||||
NULL_POINTER_EXCEPTION, ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -43,7 +43,7 @@ public class ARRAYLENGTH extends Instruction
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.NULL_POINTER_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -43,7 +43,7 @@ public class ATHROW extends Instruction implements UnconditionalBranch, Exceptio
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.THROWABLE
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -42,7 +42,7 @@ public class IDIV extends ArithmeticInstruction implements ExceptionThrower {
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.ARITHMETIC_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -42,7 +42,7 @@ public class IREM extends ArithmeticInstruction implements ExceptionThrower {
|
||||
*/
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.ARITHMETIC_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -39,7 +39,7 @@ public class LDIV extends ArithmeticInstruction implements ExceptionThrower {
|
||||
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.ARITHMETIC_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -38,7 +38,7 @@ public class LREM extends ArithmeticInstruction implements ExceptionThrower {
|
||||
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.ARITHMETIC_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -38,7 +38,7 @@ public class MONITORENTER extends Instruction implements ExceptionThrower, Stack
|
||||
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.NULL_POINTER_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -38,7 +38,7 @@ public class MONITOREXIT extends Instruction implements ExceptionThrower, StackC
|
||||
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.NULL_POINTER_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -1165,7 +1166,7 @@ public class MethodGen extends FieldGenOrMethodGen {
|
||||
if (attribute instanceof ParameterAnnotations) {
|
||||
// Initialize param_annotations
|
||||
if (!hasParameterAnnotations) {
|
||||
@SuppressWarnings("unchecked") // OK
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
final List<AnnotationEntryGen>[] parmList = new List[arg_types.length];
|
||||
param_annotations = parmList;
|
||||
for (int j = 0; j < arg_types.length; j++) {
|
||||
@ -1213,7 +1214,7 @@ public class MethodGen extends FieldGenOrMethodGen {
|
||||
final AnnotationEntryGen annotation) {
|
||||
ensureExistingParameterAnnotationsUnpacked();
|
||||
if (!hasParameterAnnotations) {
|
||||
@SuppressWarnings("unchecked") // OK
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
final List<AnnotationEntryGen>[] parmList = new List[arg_types.length];
|
||||
param_annotations = parmList;
|
||||
hasParameterAnnotations = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,11 +21,10 @@
|
||||
|
||||
package com.sun.org.apache.bcel.internal.generic;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.ExceptionConst;
|
||||
import com.sun.org.apache.bcel.internal.util.ByteSequence;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* NEWARRAY - Create new array of basic type (int, short, ...)
|
||||
@ -107,7 +106,7 @@ public class NEWARRAY extends Instruction implements AllocationInstruction, Exce
|
||||
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.NEGATIVE_ARRAY_SIZE_EXCEPTION
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -71,7 +71,7 @@ public abstract class ReturnInstruction extends Instruction implements Exception
|
||||
|
||||
@Override
|
||||
public Class<?>[] getExceptions() {
|
||||
return new Class[] {
|
||||
return new Class<?>[] {
|
||||
ExceptionConst.ILLEGAL_MONITOR_STATE
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,30 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* 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 com.sun.org.apache.bcel.internal.util;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.Const;
|
||||
import com.sun.org.apache.bcel.internal.generic.ClassGenException;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -13,11 +34,6 @@ import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.Const;
|
||||
import com.sun.org.apache.bcel.internal.generic.ClassGenException;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
|
||||
/**
|
||||
* InstructionFinder is a tool to search for given instructions patterns, i.e.,
|
||||
* match sequences of instructions in an instruction list via regular
|
||||
|
@ -62,7 +62,7 @@ public abstract class FeaturePropertyBase {
|
||||
* @param state the state of the property
|
||||
* @param value the value of the property
|
||||
*/
|
||||
public void setValue(Enum property, State state, String value) {
|
||||
public void setValue(Enum<?> property, State state, String value) {
|
||||
//only update if it shall override
|
||||
if (state.compareTo(states[property.ordinal()]) >= 0) {
|
||||
values[property.ordinal()] = value;
|
||||
@ -128,7 +128,7 @@ public abstract class FeaturePropertyBase {
|
||||
* @param property the property
|
||||
* @return the value of the property
|
||||
*/
|
||||
public String getValue(Enum property) {
|
||||
public String getValue(Enum<?> property) {
|
||||
return values[property.ordinal()];
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public abstract class FeaturePropertyBase {
|
||||
* @param property the property
|
||||
* @param systemProperty the name of the system property
|
||||
*/
|
||||
void getSystemProperty(Enum property, String systemProperty) {
|
||||
void getSystemProperty(Enum<?> property, String systemProperty) {
|
||||
try {
|
||||
String value = SecuritySupport.getSystemProperty(systemProperty);
|
||||
if (value != null) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Sep 2017
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -124,7 +124,7 @@ public class ObjectFactory {
|
||||
{
|
||||
ClassLoader cl = System.getSecurityManager()!=null ? null : findClassLoader();
|
||||
try{
|
||||
Class providerClass = findProviderClass(className, cl, doFallback);
|
||||
Class<?> providerClass = findProviderClass(className, cl, doFallback);
|
||||
Object instance = providerClass.getConstructor().newInstance();
|
||||
debugPrintln(()->"created new instance of " + providerClass +
|
||||
" using ClassLoader: " + cl);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -43,8 +43,8 @@ public interface Translet {
|
||||
public void buildKeys(DOM document, DTMAxisIterator iterator,
|
||||
SerializationHandler handler, int root)
|
||||
throws TransletException;
|
||||
public void addAuxiliaryClass(Class auxClass);
|
||||
public Class getAuxiliaryClass(String className);
|
||||
public void addAuxiliaryClass(Class<?> auxClass);
|
||||
public Class<?> getAuxiliaryClass(String className);
|
||||
public String[] getNamesArray();
|
||||
public String[] getUrisArray();
|
||||
public int[] getTypesArray();
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -20,9 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
@ -38,7 +36,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.utils.XML11Char;
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -119,10 +118,10 @@ final class ApplyTemplates extends Instruction {
|
||||
final int current = methodGen.getLocalIndex("current");
|
||||
|
||||
// check if sorting nodes is required
|
||||
final Vector<Sort> sortObjects = new Vector<>();
|
||||
final List<Sort> sortObjects = new ArrayList<>();
|
||||
for (final SyntaxTreeNode child : getContents()) {
|
||||
if (child instanceof Sort) {
|
||||
sortObjects.addElement((Sort)child);
|
||||
sortObjects.add((Sort)child);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -34,10 +35,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.utils.XML11Char;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,11 +24,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
@ -41,6 +37,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -86,7 +84,7 @@ final class AttributeValueTemplate extends AttributeValue {
|
||||
*/
|
||||
String t = null;
|
||||
String lookahead = null;
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
int state = OUT_EXPR;
|
||||
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
@ -220,7 +218,7 @@ final class AttributeValueTemplate extends AttributeValue {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final StringBuffer buffer = new StringBuffer("AVT:[");
|
||||
final StringBuilder buffer = new StringBuilder("AVT:[");
|
||||
final int count = elementCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
buffer.append(elementAt(i).toString());
|
||||
@ -252,7 +250,7 @@ final class AttributeValueTemplate extends AttributeValue {
|
||||
il.append(new NEW(cpg.addClass(STRING_BUFFER_CLASS)));
|
||||
il.append(DUP);
|
||||
il.append(new INVOKESPECIAL(initBuffer));
|
||||
// StringBuffer is on the stack
|
||||
// StringBuilder is on the stack
|
||||
final Iterator<SyntaxTreeNode> elements = elements();
|
||||
while (elements.hasNext()) {
|
||||
final Expression exp = (Expression)elements.next();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -83,11 +83,11 @@ final class BinOpExpr extends Expression {
|
||||
new MethodType(Type.Void,
|
||||
tleft, tright));
|
||||
if (ptype != null) {
|
||||
final Type arg1 = (Type) ptype.argsType().elementAt(0);
|
||||
final Type arg1 = (Type) ptype.argsType().get(0);
|
||||
if (!arg1.identicalTo(tleft)) {
|
||||
_left = new CastExpr(_left, arg1);
|
||||
}
|
||||
final Type arg2 = (Type) ptype.argsType().elementAt(1);
|
||||
final Type arg2 = (Type) ptype.argsType().get(1);
|
||||
if (!arg2.identicalTo(tright)) {
|
||||
_right = new CastExpr(_right, arg1);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,12 +21,11 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -36,7 +35,7 @@ final class BooleanCall extends FunctionCall {
|
||||
|
||||
private Expression _arg = null;
|
||||
|
||||
public BooleanCall(QName fname, Vector arguments) {
|
||||
public BooleanCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
_arg = argument(0);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -30,8 +31,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.utils.XML11Char;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -205,11 +205,11 @@ final class CallTemplate extends Instruction {
|
||||
private void buildParameterList() {
|
||||
// Put the parameters from the called template into the array first.
|
||||
// This is to ensure the order of the parameters.
|
||||
Vector<Param> defaultParams = _calleeTemplate.getParameters();
|
||||
List<Param> defaultParams = _calleeTemplate.getParameters();
|
||||
int numParams = defaultParams.size();
|
||||
_parameters = new SyntaxTreeNode[numParams];
|
||||
for (int i = 0; i < numParams; i++) {
|
||||
_parameters[i] = defaultParams.elementAt(i);
|
||||
_parameters[i] = defaultParams.get(i);
|
||||
}
|
||||
|
||||
// Replace a Param with a WithParam if they have the same name.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,17 +21,16 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.CHECKCAST;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ObjectType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Santiago Pericas-Geertsen
|
||||
@ -52,7 +51,7 @@ final class CastCall extends FunctionCall {
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public CastCall(QName fname, Vector arguments) {
|
||||
public CastCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,20 +21,19 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
final class CeilingCall extends FunctionCall {
|
||||
public CeilingCall(QName fname, Vector arguments) {
|
||||
public CeilingCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,9 +24,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
import com.sun.org.apache.bcel.internal.generic.IFEQ;
|
||||
@ -37,7 +35,11 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -61,7 +63,7 @@ final class Choose extends Instruction {
|
||||
* <xsl:when> elements and default to the <xsl:otherwise> if present.
|
||||
*/
|
||||
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
|
||||
final Vector whenElements = new Vector();
|
||||
final List<SyntaxTreeNode> whenElements = new ArrayList<>();
|
||||
Otherwise otherwise = null;
|
||||
Iterator<SyntaxTreeNode> elements = elements();
|
||||
|
||||
@ -74,7 +76,7 @@ final class Choose extends Instruction {
|
||||
SyntaxTreeNode element = elements.next();
|
||||
// Add a When child element
|
||||
if (element instanceof When) {
|
||||
whenElements.addElement(element);
|
||||
whenElements.add(element);
|
||||
}
|
||||
// Add an Otherwise child element
|
||||
else if (element instanceof Otherwise) {
|
||||
@ -108,10 +110,10 @@ final class Choose extends Instruction {
|
||||
// next element will hold a handle to the beginning of next
|
||||
// When/Otherwise if test on current When fails
|
||||
BranchHandle nextElement = null;
|
||||
Vector exitHandles = new Vector();
|
||||
List<InstructionHandle> exitHandles = new ArrayList<>();
|
||||
InstructionHandle exit = null;
|
||||
|
||||
Enumeration whens = whenElements.elements();
|
||||
Enumeration<SyntaxTreeNode> whens = Collections.enumeration(whenElements);
|
||||
while (whens.hasMoreElements()) {
|
||||
final When when = (When)whens.nextElement();
|
||||
final Expression test = when.getTest();
|
||||
@ -142,7 +144,7 @@ final class Choose extends Instruction {
|
||||
if (!when.ignore()) when.translateContents(classGen, methodGen);
|
||||
|
||||
// goto exit after executing the body of when
|
||||
exitHandles.addElement(il.append(new GOTO(null)));
|
||||
exitHandles.add(il.append(new GOTO(null)));
|
||||
if (whens.hasMoreElements() || otherwise != null) {
|
||||
nextElement = il.append(new GOTO(null));
|
||||
test.backPatchFalseList(nextElement);
|
||||
@ -160,7 +162,7 @@ final class Choose extends Instruction {
|
||||
}
|
||||
|
||||
// now that end is known set targets of exit gotos
|
||||
Enumeration exitGotos = exitHandles.elements();
|
||||
Enumeration<InstructionHandle> exitGotos = Collections.enumeration(exitHandles);
|
||||
while (exitGotos.hasMoreElements()) {
|
||||
BranchHandle gotoExit = (BranchHandle)exitGotos.nextElement();
|
||||
gotoExit.setTarget(exit);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
@ -34,13 +32,14 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
final class ConcatCall extends FunctionCall {
|
||||
public ConcatCall(QName fname, Vector arguments) {
|
||||
public ConcatCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.IFLT;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
@ -32,6 +30,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -46,7 +45,7 @@ final class ContainsCall extends FunctionCall {
|
||||
/**
|
||||
* Create a contains() call - two arguments, both strings
|
||||
*/
|
||||
public ContainsCall(QName fname, Vector arguments) {
|
||||
public ContainsCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,11 +21,8 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.GETFIELD;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
@ -34,6 +31,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -48,7 +46,7 @@ final class DocumentCall extends FunctionCall {
|
||||
/**
|
||||
* Default function call constructor
|
||||
*/
|
||||
public DocumentCall(QName fname, Vector arguments) {
|
||||
public DocumentCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
@ -30,6 +28,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -37,7 +36,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
*/
|
||||
final class ElementAvailableCall extends FunctionCall {
|
||||
|
||||
public ElementAvailableCall(QName fname, Vector arguments) {
|
||||
public ElementAvailableCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO_W;
|
||||
@ -37,6 +35,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NodeSetType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -193,12 +192,12 @@ abstract class Expression extends SyntaxTreeNode {
|
||||
public MethodType lookupPrimop(SymbolTable stable, String op,
|
||||
MethodType ctype) {
|
||||
MethodType result = null;
|
||||
final Vector primop = stable.lookupPrimop(op);
|
||||
final List<MethodType> primop = stable.lookupPrimop(op);
|
||||
if (primop != null) {
|
||||
final int n = primop.size();
|
||||
int minDistance = Integer.MAX_VALUE;
|
||||
for (int i = 0; i < n; i++) {
|
||||
final MethodType ptype = (MethodType) primop.elementAt(i);
|
||||
final MethodType ptype = primop.get(i);
|
||||
// Skip if different arity
|
||||
if (ptype.argsCount() != ctype.argsCount()) {
|
||||
continue;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,17 +21,13 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.ILOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.ISTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
@ -41,6 +37,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -57,9 +54,9 @@ class FilterExpr extends Expression {
|
||||
/**
|
||||
* Array of predicates in '(e)[p1]...[pn]'.
|
||||
*/
|
||||
private final Vector _predicates;
|
||||
private final List<Expression> _predicates;
|
||||
|
||||
public FilterExpr(Expression primary, Vector predicates) {
|
||||
public FilterExpr(Expression primary, List<Expression> predicates) {
|
||||
_primary = primary;
|
||||
_predicates = predicates;
|
||||
primary.setParent(this);
|
||||
@ -78,7 +75,7 @@ class FilterExpr extends Expression {
|
||||
if (_predicates != null) {
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Expression exp = (Expression)_predicates.elementAt(i);
|
||||
final Expression exp = (Expression)_predicates.get(i);
|
||||
exp.setParser(parser);
|
||||
exp.setParent(this);
|
||||
}
|
||||
@ -112,7 +109,7 @@ class FilterExpr extends Expression {
|
||||
// Type check predicates and turn all optimizations off if appropriate
|
||||
int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Predicate pred = (Predicate) _predicates.elementAt(i);
|
||||
Predicate pred = (Predicate) _predicates.get(i);
|
||||
|
||||
if (!canOptimize) {
|
||||
pred.dontOptimize();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,18 +21,17 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
final class FloorCall extends FunctionCall {
|
||||
public FloorCall(QName fname, Vector arguments) {
|
||||
public FloorCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,27 +21,27 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
public final class FlowList {
|
||||
private Vector _elements;
|
||||
private List<InstructionHandle> _elements;
|
||||
|
||||
public FlowList() {
|
||||
_elements = null;
|
||||
}
|
||||
|
||||
public FlowList(InstructionHandle bh) {
|
||||
_elements = new Vector();
|
||||
_elements.addElement(bh);
|
||||
_elements = new ArrayList<>();
|
||||
_elements.add(bh);
|
||||
}
|
||||
|
||||
public FlowList(FlowList list) {
|
||||
@ -50,9 +50,9 @@ public final class FlowList {
|
||||
|
||||
public FlowList add(InstructionHandle bh) {
|
||||
if (_elements == null) {
|
||||
_elements = new Vector();
|
||||
_elements = new ArrayList<>();
|
||||
}
|
||||
_elements.addElement(bh);
|
||||
_elements.add(bh);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -61,11 +61,11 @@ public final class FlowList {
|
||||
_elements = right._elements;
|
||||
}
|
||||
else {
|
||||
final Vector temp = right._elements;
|
||||
final List<InstructionHandle> temp = right._elements;
|
||||
if (temp != null) {
|
||||
final int n = temp.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
_elements.addElement(temp.elementAt(i));
|
||||
_elements.add(temp.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ public final class FlowList {
|
||||
if (_elements != null) {
|
||||
final int n = _elements.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
BranchHandle bh = (BranchHandle)_elements.elementAt(i);
|
||||
BranchHandle bh = (BranchHandle)_elements.get(i);
|
||||
bh.setTarget(target);
|
||||
}
|
||||
_elements.clear(); // avoid backpatching more than once
|
||||
@ -99,15 +99,15 @@ public final class FlowList {
|
||||
}
|
||||
|
||||
final int n = _elements.size();
|
||||
final Iterator oldIter = oldList.iterator();
|
||||
final Iterator newIter = newList.iterator();
|
||||
final Iterator<InstructionHandle> oldIter = oldList.iterator();
|
||||
final Iterator<InstructionHandle> newIter = newList.iterator();
|
||||
|
||||
while (oldIter.hasNext()) {
|
||||
final InstructionHandle oldIh = (InstructionHandle) oldIter.next();
|
||||
final InstructionHandle newIh = (InstructionHandle) newIter.next();
|
||||
final InstructionHandle oldIh = oldIter.next();
|
||||
final InstructionHandle newIh = newIter.next();
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
if (_elements.elementAt(i) == oldIh) {
|
||||
if (_elements.get(i) == oldIh) {
|
||||
result.add(newIh);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,9 +24,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
@ -42,7 +40,9 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -97,12 +97,12 @@ final class ForEach extends Instruction {
|
||||
il.append(methodGen.loadIterator());
|
||||
|
||||
// Collect sort objects associated with this instruction
|
||||
final Vector sortObjects = new Vector();
|
||||
final List<Sort> sortObjects = new ArrayList<>();
|
||||
Iterator<SyntaxTreeNode> children = elements();
|
||||
while (children.hasNext()) {
|
||||
final Object child = children.next();
|
||||
final SyntaxTreeNode child = children.next();
|
||||
if (child instanceof Sort) {
|
||||
sortObjects.addElement(child);
|
||||
sortObjects.add((Sort)child);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
@ -34,6 +32,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.RealType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -46,7 +45,7 @@ final class FormatNumberCall extends FunctionCall {
|
||||
private Expression _name;
|
||||
private QName _resolvedQName = null;
|
||||
|
||||
public FormatNumberCall(QName fname, Vector arguments) {
|
||||
public FormatNumberCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
_value = argument(0);
|
||||
_format = argument(1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,19 +21,18 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author G. Todd Miller
|
||||
@ -52,9 +51,9 @@ final class FunctionAvailableCall extends FunctionCall {
|
||||
* a list of arguments where the arguments must be instances of
|
||||
* LiteralExpression.
|
||||
*/
|
||||
public FunctionAvailableCall(QName fname, Vector arguments) {
|
||||
public FunctionAvailableCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
_arg = (Expression)arguments.elementAt(0);
|
||||
_arg = (Expression)arguments.get(0);
|
||||
_type = null;
|
||||
|
||||
if (_arg instanceof LiteralExpr) {
|
||||
@ -131,7 +130,7 @@ final class FunctionAvailableCall extends FunctionCall {
|
||||
methodName = replaceDash(methodName);
|
||||
|
||||
try {
|
||||
final Class clazz = ObjectFactory.findProviderClass(className, true);
|
||||
final Class<?> clazz = ObjectFactory.findProviderClass(className, true);
|
||||
|
||||
if (clazz == null) {
|
||||
return false;
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -48,12 +49,12 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Vector;
|
||||
import jdk.xml.internal.JdkXmlFeatures;
|
||||
|
||||
/**
|
||||
@ -68,9 +69,9 @@ class FunctionCall extends Expression {
|
||||
// Name of this function call
|
||||
private QName _fname;
|
||||
// Arguments to this function call (might not be any)
|
||||
private final Vector _arguments;
|
||||
private final List<Expression> _arguments;
|
||||
// Empty argument list, used for certain functions
|
||||
private final static Vector EMPTY_ARG_LIST = new Vector(0);
|
||||
private final static List<Expression> EMPTY_ARG_LIST = new ArrayList<>(0);
|
||||
|
||||
// Valid namespaces for Java function-call extension
|
||||
protected final static String EXT_XSLTC =
|
||||
@ -122,9 +123,9 @@ class FunctionCall extends Expression {
|
||||
|
||||
// External Java function's class/method/signature
|
||||
private String _className;
|
||||
private Class _clazz;
|
||||
private Class<?> _clazz;
|
||||
private Method _chosenMethod;
|
||||
private Constructor _chosenConstructor;
|
||||
private Constructor<?> _chosenConstructor;
|
||||
private MethodType _chosenMethodType;
|
||||
|
||||
// Encapsulates all unsupported external function calls
|
||||
@ -156,7 +157,7 @@ class FunctionCall extends Expression {
|
||||
public Class<?> type;
|
||||
public int distance;
|
||||
|
||||
public JavaType(Class type, int distance){
|
||||
public JavaType(Class<?> type, int distance){
|
||||
this.type = type;
|
||||
this.distance = distance;
|
||||
}
|
||||
@ -294,7 +295,7 @@ class FunctionCall extends Expression {
|
||||
|
||||
}
|
||||
|
||||
public FunctionCall(QName fname, Vector arguments) {
|
||||
public FunctionCall(QName fname, List<Expression> arguments) {
|
||||
_fname = fname;
|
||||
_arguments = arguments;
|
||||
_type = null;
|
||||
@ -314,7 +315,7 @@ class FunctionCall extends Expression {
|
||||
if (_arguments != null) {
|
||||
final int n = _arguments.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Expression exp = (Expression)_arguments.elementAt(i);
|
||||
final Expression exp = _arguments.get(i);
|
||||
exp.setParser(parser);
|
||||
exp.setParent(this);
|
||||
}
|
||||
@ -435,18 +436,18 @@ class FunctionCall extends Expression {
|
||||
_fname.clearNamespace(); // HACK!!!
|
||||
|
||||
final int n = _arguments.size();
|
||||
final Vector argsType = typeCheckArgs(stable);
|
||||
final List<Type> argsType = typeCheckArgs(stable);
|
||||
final MethodType args = new MethodType(Type.Void, argsType);
|
||||
final MethodType ptype =
|
||||
lookupPrimop(stable, _fname.getLocalPart(), args);
|
||||
|
||||
if (ptype != null) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Type argType = (Type) ptype.argsType().elementAt(i);
|
||||
final Expression exp = (Expression)_arguments.elementAt(i);
|
||||
final Type argType = (Type) ptype.argsType().get(i);
|
||||
final Expression exp = _arguments.get(i);
|
||||
if (!argType.identicalTo(exp.getType())) {
|
||||
try {
|
||||
_arguments.setElementAt(new CastExpr(exp, argType), i);
|
||||
_arguments.set(i, new CastExpr(exp, argType));
|
||||
}
|
||||
catch (TypeCheckError e) {
|
||||
throw new TypeCheckError(this); // invalid conversion
|
||||
@ -462,7 +463,7 @@ class FunctionCall extends Expression {
|
||||
|
||||
|
||||
public Type typeCheckConstructor(SymbolTable stable) throws TypeCheckError{
|
||||
final Vector constructors = findConstructors();
|
||||
final List<Constructor<?>> constructors = findConstructors();
|
||||
if (constructors == null) {
|
||||
// Constructor not found in this class
|
||||
throw new TypeCheckError(ErrorMsg.CONSTRUCTOR_NOT_FOUND,
|
||||
@ -472,23 +473,22 @@ class FunctionCall extends Expression {
|
||||
|
||||
final int nConstructors = constructors.size();
|
||||
final int nArgs = _arguments.size();
|
||||
final Vector argsType = typeCheckArgs(stable);
|
||||
final List<Type> argsType = typeCheckArgs(stable);
|
||||
|
||||
// Try all constructors
|
||||
int bestConstrDistance = Integer.MAX_VALUE;
|
||||
_type = null; // reset
|
||||
for (int j, i = 0; i < nConstructors; i++) {
|
||||
// Check if all parameters to this constructor can be converted
|
||||
final Constructor constructor =
|
||||
(Constructor)constructors.elementAt(i);
|
||||
final Class[] paramTypes = constructor.getParameterTypes();
|
||||
final Constructor<?> constructor = constructors.get(i);
|
||||
final Class<?>[] paramTypes = constructor.getParameterTypes();
|
||||
|
||||
Class<?> extType;
|
||||
int currConstrDistance = 0;
|
||||
for (j = 0; j < nArgs; j++) {
|
||||
// Convert from internal (translet) type to external (Java) type
|
||||
extType = paramTypes[j];
|
||||
final Type intType = (Type)argsType.elementAt(j);
|
||||
final Type intType = argsType.get(j);
|
||||
JavaType match = _internal2Java.maps(intType, new JavaType(extType, 0));
|
||||
if (match != null) {
|
||||
currConstrDistance += match.distance;
|
||||
@ -556,7 +556,7 @@ class FunctionCall extends Expression {
|
||||
|| _namespace_format == NAMESPACE_FORMAT_PACKAGE)
|
||||
hasThisArgument = true;
|
||||
|
||||
Expression firstArg = (Expression)_arguments.elementAt(0);
|
||||
Expression firstArg = _arguments.get(0);
|
||||
Type firstArgType = (Type)firstArg.typeCheck(stable);
|
||||
|
||||
if (_namespace_format == NAMESPACE_FORMAT_CLASS
|
||||
@ -566,7 +566,7 @@ class FunctionCall extends Expression {
|
||||
hasThisArgument = true;
|
||||
|
||||
if (hasThisArgument) {
|
||||
_thisArgument = (Expression) _arguments.elementAt(0);
|
||||
_thisArgument = _arguments.get(0);
|
||||
_arguments.remove(0); nArgs--;
|
||||
if (firstArgType instanceof ObjectType) {
|
||||
_className = ((ObjectType) firstArgType).getJavaClassName();
|
||||
@ -592,30 +592,30 @@ class FunctionCall extends Expression {
|
||||
}
|
||||
}
|
||||
|
||||
final Vector methods = findMethods();
|
||||
final List<Method> methods = findMethods();
|
||||
|
||||
if (methods == null) {
|
||||
// Method not found in this class
|
||||
throw new TypeCheckError(ErrorMsg.METHOD_NOT_FOUND_ERR, _className + "." + name);
|
||||
}
|
||||
|
||||
Class extType = null;
|
||||
Class<?> extType = null;
|
||||
final int nMethods = methods.size();
|
||||
final Vector argsType = typeCheckArgs(stable);
|
||||
final List<Type> argsType = typeCheckArgs(stable);
|
||||
|
||||
// Try all methods to identify the best fit
|
||||
int bestMethodDistance = Integer.MAX_VALUE;
|
||||
_type = null; // reset internal type
|
||||
for (int j, i = 0; i < nMethods; i++) {
|
||||
// Check if all paramteters to this method can be converted
|
||||
final Method method = (Method)methods.elementAt(i);
|
||||
final Class[] paramTypes = method.getParameterTypes();
|
||||
final Method method = (Method)methods.get(i);
|
||||
final Class<?>[] paramTypes = method.getParameterTypes();
|
||||
|
||||
int currMethodDistance = 0;
|
||||
for (j = 0; j < nArgs; j++) {
|
||||
// Convert from internal (translet) type to external (Java) type
|
||||
extType = paramTypes[j];
|
||||
final Type intType = (Type)argsType.elementAt(j);
|
||||
final Type intType = argsType.get(j);
|
||||
JavaType match = _internal2Java.maps(intType, new JavaType(extType, 0));
|
||||
if (match != null) {
|
||||
currMethodDistance += match.distance;
|
||||
@ -683,18 +683,16 @@ class FunctionCall extends Expression {
|
||||
/**
|
||||
* Type check the actual arguments of this function call.
|
||||
*/
|
||||
public Vector typeCheckArgs(SymbolTable stable) throws TypeCheckError {
|
||||
final Vector result = new Vector();
|
||||
final Enumeration e = _arguments.elements();
|
||||
while (e.hasMoreElements()) {
|
||||
final Expression exp = (Expression)e.nextElement();
|
||||
result.addElement(exp.typeCheck(stable));
|
||||
public List<Type> typeCheckArgs(SymbolTable stable) throws TypeCheckError {
|
||||
final List<Type> result = new ArrayList<>();
|
||||
for (Expression exp : _arguments) {
|
||||
result.add(exp.typeCheck(stable));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected final Expression argument(int i) {
|
||||
return (Expression)_arguments.elementAt(i);
|
||||
return _arguments.get(i);
|
||||
}
|
||||
|
||||
protected final Expression argument() {
|
||||
@ -706,7 +704,7 @@ class FunctionCall extends Expression {
|
||||
}
|
||||
|
||||
protected final void setArgument(int i, Expression exp) {
|
||||
_arguments.setElementAt(exp, i);
|
||||
_arguments.set(i, exp);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -795,7 +793,7 @@ class FunctionCall extends Expression {
|
||||
// <TransletClass>.class.getModule().addReads(
|
||||
generateAddReads(classGen, methodGen, clazz);
|
||||
|
||||
Class[] paramTypes = _chosenConstructor.getParameterTypes();
|
||||
Class<?>[] paramTypes = _chosenConstructor.getParameterTypes();
|
||||
LocalVariableGen[] paramTemp = new LocalVariableGen[n];
|
||||
|
||||
// Backwards branches are prohibited if an uninitialized object is
|
||||
@ -856,7 +854,7 @@ class FunctionCall extends Expression {
|
||||
translateUnallowedExtension(cpg, il);
|
||||
|
||||
final String clazz = _chosenMethod.getDeclaringClass().getName();
|
||||
Class[] paramTypes = _chosenMethod.getParameterTypes();
|
||||
Class<?>[] paramTypes = _chosenMethod.getParameterTypes();
|
||||
|
||||
|
||||
// Generate call to Module.addReads:
|
||||
@ -960,9 +958,9 @@ class FunctionCall extends Expression {
|
||||
* after stripping its namespace or <code>null</code>
|
||||
* if no such methods exist.
|
||||
*/
|
||||
private Vector findMethods() {
|
||||
private List<Method> findMethods() {
|
||||
|
||||
Vector result = null;
|
||||
List<Method> result = null;
|
||||
final String namespace = _fname.getNamespace();
|
||||
|
||||
if (_className != null && _className.length() > 0) {
|
||||
@ -1003,9 +1001,9 @@ class FunctionCall extends Expression {
|
||||
&& methods[i].getParameterTypes().length == nArgs)
|
||||
{
|
||||
if (result == null) {
|
||||
result = new Vector();
|
||||
result = new ArrayList<>();
|
||||
}
|
||||
result.addElement(methods[i]);
|
||||
result.add(methods[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1022,9 +1020,8 @@ class FunctionCall extends Expression {
|
||||
* after stripping its namespace or <code>null</code>
|
||||
* if no such methods exist.
|
||||
*/
|
||||
private Vector findConstructors() {
|
||||
Vector result = null;
|
||||
final String namespace = _fname.getNamespace();
|
||||
private List<Constructor<?>> findConstructors() {
|
||||
List<Constructor<?>> result = null;
|
||||
|
||||
final int nArgs = _arguments.size();
|
||||
try {
|
||||
@ -1037,20 +1034,17 @@ class FunctionCall extends Expression {
|
||||
}
|
||||
}
|
||||
|
||||
final Constructor[] constructors = _clazz.getConstructors();
|
||||
final Constructor<?>[] constructors = _clazz.getConstructors();
|
||||
|
||||
for (int i = 0; i < constructors.length; i++) {
|
||||
final int mods = constructors[i].getModifiers();
|
||||
// Is it public, static and same number of args ?
|
||||
if (Modifier.isPublic(mods) &&
|
||||
constructors[i].getParameterTypes().length == nArgs)
|
||||
{
|
||||
if (result == null) {
|
||||
result = new Vector();
|
||||
for (Constructor<?> constructor : constructors) {
|
||||
final int mods = constructor.getModifiers();
|
||||
// Is it public, static and same number of args ?
|
||||
if (Modifier.isPublic(mods) && constructor.getParameterTypes().length == nArgs) {
|
||||
if (result == null) {
|
||||
result = new ArrayList<>();
|
||||
} result.add(constructor);
|
||||
}
|
||||
result.addElement(constructors[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
final ErrorMsg msg = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, _className);
|
||||
@ -1064,10 +1058,10 @@ class FunctionCall extends Expression {
|
||||
/**
|
||||
* Compute the JVM signature for the class.
|
||||
*/
|
||||
static final String getSignature(Class clazz) {
|
||||
static final String getSignature(Class<?> clazz) {
|
||||
if (clazz.isArray()) {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
Class cl = clazz;
|
||||
Class<?> cl = clazz;
|
||||
while (cl.isArray()) {
|
||||
sb.append("[");
|
||||
cl = cl.getComponentType();
|
||||
@ -1120,7 +1114,7 @@ class FunctionCall extends Expression {
|
||||
static final String getSignature(Method meth) {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
sb.append('(');
|
||||
final Class[] params = meth.getParameterTypes(); // avoid clone
|
||||
final Class<?>[] params = meth.getParameterTypes(); // avoid clone
|
||||
for (int j = 0; j < params.length; j++) {
|
||||
sb.append(getSignature(params[j]));
|
||||
}
|
||||
@ -1131,10 +1125,10 @@ class FunctionCall extends Expression {
|
||||
/**
|
||||
* Compute the JVM constructor descriptor for the constructor.
|
||||
*/
|
||||
static final String getSignature(Constructor cons) {
|
||||
static final String getSignature(Constructor<?> cons) {
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
sb.append('(');
|
||||
final Class[] params = cons.getParameterTypes(); // avoid clone
|
||||
final Class<?>[] params = cons.getParameterTypes(); // avoid clone
|
||||
for (int j = 0; j < params.length; j++) {
|
||||
sb.append(getSignature(params[j]));
|
||||
}
|
||||
@ -1144,13 +1138,13 @@ class FunctionCall extends Expression {
|
||||
/**
|
||||
* Return the signature of the current method
|
||||
*/
|
||||
private String getMethodSignature(Vector argsType) {
|
||||
private String getMethodSignature(List<Type> argsType) {
|
||||
final StringBuffer buf = new StringBuffer(_className);
|
||||
buf.append('.').append(_fname.getLocalPart()).append('(');
|
||||
|
||||
int nArgs = argsType.size();
|
||||
for (int i = 0; i < nArgs; i++) {
|
||||
final Type intType = (Type)argsType.elementAt(i);
|
||||
final Type intType = argsType.get(i);
|
||||
buf.append(intType.toString());
|
||||
if (i < nArgs - 1) buf.append(", ");
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,20 +21,19 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
final class GenerateIdCall extends FunctionCall {
|
||||
public GenerateIdCall(QName fname, Vector arguments) {
|
||||
public GenerateIdCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,8 +24,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,28 +21,16 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
import com.sun.org.apache.bcel.internal.generic.IFGT;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Morten Jorgensen
|
||||
@ -82,7 +70,7 @@ final class KeyCall extends FunctionCall {
|
||||
* @param fname The function name (should be 'key' or 'id')
|
||||
* @param arguments A vector containing the arguments the the function
|
||||
*/
|
||||
public KeyCall(QName fname, Vector arguments) {
|
||||
public KeyCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
switch(argumentCount()) {
|
||||
case 1:
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.ILOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
@ -33,6 +31,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Morten Jorgensen
|
||||
@ -45,7 +44,7 @@ final class LangCall extends FunctionCall {
|
||||
* Get the parameters passed to function:
|
||||
* lang(string)
|
||||
*/
|
||||
public LangCall(QName fname, Vector arguments) {
|
||||
public LangCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
_lang = argument(0);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -102,6 +103,7 @@ final class LiteralElement extends Instruction {
|
||||
|
||||
// Check if we have any declared namespaces
|
||||
if (_accessedPrefixes == null) {
|
||||
// use Hashtable for behavior compatibility
|
||||
_accessedPrefixes = new Hashtable<>();
|
||||
}
|
||||
else {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,14 +21,13 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Morten Jorgensen
|
||||
@ -45,7 +44,7 @@ final class LocalNameCall extends NameBase {
|
||||
/**
|
||||
* Handles calls with one parameter (either node or node-set).
|
||||
*/
|
||||
public LocalNameCall(QName fname, Vector arguments) {
|
||||
public LocalNameCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -137,11 +137,11 @@ final class LogicalExpr extends Expression {
|
||||
// Yes, the operation is supported
|
||||
if (haveType != null) {
|
||||
// Check if left-hand side operand must be type casted
|
||||
Type arg1 = (Type)haveType.argsType().elementAt(0);
|
||||
Type arg1 = (Type)haveType.argsType().get(0);
|
||||
if (!arg1.identicalTo(tleft))
|
||||
_left = new CastExpr(_left, arg1);
|
||||
// Check if right-hand side operand must be type casted
|
||||
Type arg2 = (Type) haveType.argsType().elementAt(1);
|
||||
Type arg2 = (Type) haveType.argsType().get(1);
|
||||
if (!arg2.identicalTo(tright))
|
||||
_right = new CastExpr(_right, arg1);
|
||||
// Return the result type for the operator we will use
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -46,12 +47,12 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerato
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.dtm.Axis;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import java.util.Enumeration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Mode gathers all the templates belonging to a given mode;
|
||||
@ -83,12 +84,12 @@ final class Mode implements Constants {
|
||||
/**
|
||||
* A vector of all the templates in this mode.
|
||||
*/
|
||||
private Vector _templates;
|
||||
private List<Template> _templates;
|
||||
|
||||
/**
|
||||
* Group for patterns with node()-type kernel and child axis.
|
||||
*/
|
||||
private Vector _childNodeGroup = null;
|
||||
private List<LocationPathPattern> _childNodeGroup = null;
|
||||
|
||||
/**
|
||||
* Test sequence for patterns with node()-type kernel and child axis.
|
||||
@ -98,7 +99,7 @@ final class Mode implements Constants {
|
||||
/**
|
||||
* Group for patterns with node()-type kernel and attribute axis.
|
||||
*/
|
||||
private Vector _attribNodeGroup = null;
|
||||
private List<LocationPathPattern> _attribNodeGroup = null;
|
||||
|
||||
/**
|
||||
* Test sequence for patterns with node()-type kernel and attribute axis.
|
||||
@ -108,7 +109,7 @@ final class Mode implements Constants {
|
||||
/**
|
||||
* Group for patterns with id() or key()-type kernel.
|
||||
*/
|
||||
private Vector _idxGroup = null;
|
||||
private List<LocationPathPattern> _idxGroup = null;
|
||||
|
||||
/**
|
||||
* Test sequence for patterns with id() or key()-type kernel.
|
||||
@ -118,7 +119,7 @@ final class Mode implements Constants {
|
||||
/**
|
||||
* Group for patterns with any other kernel type.
|
||||
*/
|
||||
private Vector[] _patternGroups;
|
||||
private List<LocationPathPattern>[] _patternGroups;
|
||||
|
||||
/**
|
||||
* Test sequence for patterns with any other kernel type.
|
||||
@ -175,12 +176,13 @@ final class Mode implements Constants {
|
||||
* @param suffix A suffix to append to the method name for this mode
|
||||
* (normally a sequence number - still in a String).
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public Mode(QName name, Stylesheet stylesheet, String suffix) {
|
||||
_name = name;
|
||||
_stylesheet = stylesheet;
|
||||
_methodName = APPLY_TEMPLATES + suffix;
|
||||
_templates = new Vector();
|
||||
_patternGroups = new Vector[32];
|
||||
_templates = new ArrayList<>();
|
||||
_patternGroups = (List<LocationPathPattern>[])new ArrayList[32];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,10 +216,10 @@ final class Mode implements Constants {
|
||||
}
|
||||
|
||||
public void addTemplate(Template template) {
|
||||
_templates.addElement(template);
|
||||
_templates.add(template);
|
||||
}
|
||||
|
||||
private Vector quicksort(Vector templates, int p, int r) {
|
||||
private List<Template> quicksort(List<Template> templates, int p, int r) {
|
||||
if (p < r) {
|
||||
final int q = partition(templates, p, r);
|
||||
quicksort(templates, p, q);
|
||||
@ -226,15 +228,15 @@ final class Mode implements Constants {
|
||||
return templates;
|
||||
}
|
||||
|
||||
private int partition(Vector templates, int p, int r) {
|
||||
final Template x = (Template)templates.elementAt(p);
|
||||
private int partition(List<Template> templates, int p, int r) {
|
||||
final Template x = (Template)templates.get(p);
|
||||
int i = p - 1;
|
||||
int j = r + 1;
|
||||
while (true) {
|
||||
while (x.compareTo((Template)templates.elementAt(--j)) > 0);
|
||||
while (x.compareTo((Template)templates.elementAt(++i)) < 0);
|
||||
while (x.compareTo((Template)templates.get(--j)) > 0);
|
||||
while (x.compareTo((Template)templates.get(++i)) < 0);
|
||||
if (i < j) {
|
||||
templates.set(j, templates.set(i, templates.elementAt(j)));
|
||||
templates.set(j, templates.set(i, templates.get(j)));
|
||||
}
|
||||
else {
|
||||
return j;
|
||||
@ -247,35 +249,10 @@ final class Mode implements Constants {
|
||||
*/
|
||||
public void processPatterns(Map<String, Key> keys) {
|
||||
_keys = keys;
|
||||
|
||||
/*
|
||||
System.out.println("Before Sort " + _name);
|
||||
for (int i = 0; i < _templates.size(); i++) {
|
||||
System.out.println("name = " + ((Template)_templates.elementAt(i)).getName());
|
||||
System.out.println("pattern = " + ((Template)_templates.elementAt(i)).getPattern());
|
||||
System.out.println("priority = " + ((Template)_templates.elementAt(i)).getPriority());
|
||||
System.out.println("position = " + ((Template)_templates.elementAt(i)).getPosition());
|
||||
}
|
||||
*/
|
||||
|
||||
_templates = quicksort(_templates, 0, _templates.size() - 1);
|
||||
|
||||
/*
|
||||
System.out.println("\n After Sort " + _name);
|
||||
for (int i = 0; i < _templates.size(); i++) {
|
||||
System.out.println("name = " + ((Template)_templates.elementAt(i)).getName());
|
||||
System.out.println("pattern = " + ((Template)_templates.elementAt(i)).getPattern());
|
||||
System.out.println("priority = " + ((Template)_templates.elementAt(i)).getPriority());
|
||||
System.out.println("position = " + ((Template)_templates.elementAt(i)).getPosition());
|
||||
}
|
||||
*/
|
||||
|
||||
// Traverse all templates
|
||||
final Enumeration templates = _templates.elements();
|
||||
while (templates.hasMoreElements()) {
|
||||
// Get the next template
|
||||
final Template template = (Template)templates.nextElement();
|
||||
|
||||
for (Template template : _templates) {
|
||||
/*
|
||||
* Add this template to a table of named templates if it has a name.
|
||||
* If there are multiple templates with the same name, all but one
|
||||
@ -308,8 +285,8 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
if (pattern instanceof IdKeyPattern) {
|
||||
final IdKeyPattern idkey = (IdKeyPattern)pattern;
|
||||
idkey.setTemplate(template);
|
||||
if (_idxGroup == null) _idxGroup = new Vector();
|
||||
_idxGroup.add(pattern);
|
||||
if (_idxGroup == null) _idxGroup = new ArrayList<>();
|
||||
_idxGroup.add((IdKeyPattern)pattern);
|
||||
}
|
||||
// Alternative patterns are broken up and re-processed recursively
|
||||
else if (pattern instanceof AlternativePattern) {
|
||||
@ -355,47 +332,50 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
// Make sure the array of pattern groups is long enough
|
||||
final int oldLength = _patternGroups.length;
|
||||
if (kernelType >= oldLength) {
|
||||
Vector[] newGroups = new Vector[kernelType * 2];
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
List<LocationPathPattern>[] newGroups =
|
||||
(List<LocationPathPattern>[])new ArrayList[kernelType * 2];
|
||||
|
||||
System.arraycopy(_patternGroups, 0, newGroups, 0, oldLength);
|
||||
_patternGroups = newGroups;
|
||||
}
|
||||
|
||||
// Find the vector to put this pattern into
|
||||
Vector patterns;
|
||||
List<LocationPathPattern> patterns;
|
||||
|
||||
if (kernelType == DOM.NO_TYPE) {
|
||||
if (pattern.getAxis() == Axis.ATTRIBUTE) {
|
||||
patterns = (_attribNodeGroup == null) ?
|
||||
(_attribNodeGroup = new Vector(2)) : _attribNodeGroup;
|
||||
(_attribNodeGroup = new ArrayList<>(2)) : _attribNodeGroup;
|
||||
}
|
||||
else {
|
||||
patterns = (_childNodeGroup == null) ?
|
||||
(_childNodeGroup = new Vector(2)) : _childNodeGroup;
|
||||
(_childNodeGroup = new ArrayList<>(2)) : _childNodeGroup;
|
||||
}
|
||||
}
|
||||
else {
|
||||
patterns = (_patternGroups[kernelType] == null) ?
|
||||
(_patternGroups[kernelType] = new Vector(2)) :
|
||||
(_patternGroups[kernelType] = new ArrayList<>(2)) :
|
||||
_patternGroups[kernelType];
|
||||
}
|
||||
|
||||
if (patterns.size() == 0) {
|
||||
patterns.addElement(pattern);
|
||||
patterns.add(pattern);
|
||||
}
|
||||
else {
|
||||
boolean inserted = false;
|
||||
for (int i = 0; i < patterns.size(); i++) {
|
||||
final LocationPathPattern lppToCompare =
|
||||
(LocationPathPattern)patterns.elementAt(i);
|
||||
(LocationPathPattern)patterns.get(i);
|
||||
|
||||
if (pattern.noSmallerThan(lppToCompare)) {
|
||||
inserted = true;
|
||||
patterns.insertElementAt(pattern, i);
|
||||
patterns.add(i, pattern);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (inserted == false) {
|
||||
patterns.addElement(pattern);
|
||||
patterns.add(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -404,7 +384,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
* Complete test sequences of a given type by adding all patterns
|
||||
* from a given group.
|
||||
*/
|
||||
private void completeTestSequences(int nodeType, Vector patterns) {
|
||||
private void completeTestSequences(int nodeType, List<LocationPathPattern> patterns) {
|
||||
if (patterns != null) {
|
||||
if (_patternGroups[nodeType] == null) {
|
||||
_patternGroups[nodeType] = patterns;
|
||||
@ -412,8 +392,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
else {
|
||||
final int m = patterns.size();
|
||||
for (int j = 0; j < m; j++) {
|
||||
addPattern(nodeType,
|
||||
(LocationPathPattern) patterns.elementAt(j));
|
||||
addPattern(nodeType, patterns.get(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -425,8 +404,8 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
* sequences, and of "@*" to all attribute test sequences.
|
||||
*/
|
||||
private void prepareTestSequences() {
|
||||
final Vector starGroup = _patternGroups[DTM.ELEMENT_NODE];
|
||||
final Vector atStarGroup = _patternGroups[DTM.ATTRIBUTE_NODE];
|
||||
final List<LocationPathPattern> starGroup = _patternGroups[DTM.ELEMENT_NODE];
|
||||
final List<LocationPathPattern> atStarGroup = _patternGroups[DTM.ATTRIBUTE_NODE];
|
||||
|
||||
// Complete test sequence for "text()" with "child::node()"
|
||||
completeTestSequences(DTM.TEXT_NODE, _childNodeGroup);
|
||||
@ -443,7 +422,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
// Complete test sequence for "@*" with "attribute::node()"
|
||||
completeTestSequences(DTM.ATTRIBUTE_NODE, _attribNodeGroup);
|
||||
|
||||
final Vector names = _stylesheet.getXSLTC().getNamesIndex();
|
||||
final List<String> names = _stylesheet.getXSLTC().getNamesIndex();
|
||||
if (starGroup != null || atStarGroup != null ||
|
||||
_childNodeGroup != null || _attribNodeGroup != null)
|
||||
{
|
||||
@ -453,7 +432,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
for (int i = DTM.NTYPES; i < n; i++) {
|
||||
if (_patternGroups[i] == null) continue;
|
||||
|
||||
final String name = (String) names.elementAt(i - DTM.NTYPES);
|
||||
final String name = names.get(i - DTM.NTYPES);
|
||||
|
||||
if (isAttributeName(name)) {
|
||||
// If an attribute then copy "@*" to its test sequence
|
||||
@ -476,7 +455,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
|
||||
final int n = _patternGroups.length;
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Vector patterns = _patternGroups[i];
|
||||
final List<LocationPathPattern> patterns = _patternGroups[i];
|
||||
if (patterns != null) {
|
||||
final TestSeq testSeq = new TestSeq(patterns, i, this);
|
||||
// System.out.println("testSeq[" + i + "] = " + testSeq);
|
||||
@ -520,7 +499,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
|
||||
int numParams = 0;
|
||||
if (template.isSimpleNamedTemplate()) {
|
||||
Vector parameters = template.getParameters();
|
||||
List<Param> parameters = template.getParameters();
|
||||
numParams = parameters.size();
|
||||
}
|
||||
|
||||
@ -676,8 +655,8 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
|
||||
// Append switch() statement - namespace test dispatch loop
|
||||
final Vector namespaces = xsltc.getNamespaceIndex();
|
||||
final Vector names = xsltc.getNamesIndex();
|
||||
final List<String> namespaces = xsltc.getNamespaceIndex();
|
||||
final List<String> names = xsltc.getNamesIndex();
|
||||
final int namespaceCount = namespaces.size() + 1;
|
||||
final int namesCount = names.size();
|
||||
|
||||
@ -697,7 +676,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
// Add test sequences for known namespace types
|
||||
for (int i = DTM.NTYPES; i < (DTM.NTYPES+namesCount); i++) {
|
||||
if ((isNamespace[i]) && (isAttribute[i] == attrFlag)) {
|
||||
String name = (String)names.elementAt(i-DTM.NTYPES);
|
||||
String name = names.get(i-DTM.NTYPES);
|
||||
String namespace = name.substring(0,name.lastIndexOf(':'));
|
||||
final int type = xsltc.registerNamespace(namespace);
|
||||
|
||||
@ -737,7 +716,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
public void compileApplyTemplates(ClassGenerator classGen) {
|
||||
final XSLTC xsltc = classGen.getParser().getXSLTC();
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final Vector names = xsltc.getNamesIndex();
|
||||
final List<String> names = xsltc.getNamesIndex();
|
||||
|
||||
// Create the applyTemplates() method
|
||||
final com.sun.org.apache.bcel.internal.generic.Type[] argTypes =
|
||||
@ -816,7 +795,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
final boolean[] isAttribute = new boolean[types.length];
|
||||
final boolean[] isNamespace = new boolean[types.length];
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
final String name = (String)names.elementAt(i);
|
||||
final String name = names.get(i);
|
||||
isAttribute[i + DTM.NTYPES] = isAttributeName(name);
|
||||
isNamespace[i + DTM.NTYPES] = isNamespaceName(name);
|
||||
}
|
||||
@ -1067,28 +1046,26 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public void compileApplyImports(ClassGenerator classGen, int min, int max) {
|
||||
final XSLTC xsltc = classGen.getParser().getXSLTC();
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final Vector names = xsltc.getNamesIndex();
|
||||
final List<String> names = xsltc.getNamesIndex();
|
||||
|
||||
// Clear some datastructures
|
||||
_namedTemplates = new HashMap<>();
|
||||
_neededTemplates = new HashMap<>();
|
||||
_templateIHs = new HashMap<>();
|
||||
_templateILs = new HashMap<>();
|
||||
_patternGroups = new Vector[32];
|
||||
_patternGroups = (List<LocationPathPattern>[])new ArrayList[32];
|
||||
_rootPattern = null;
|
||||
|
||||
// IMPORTANT: Save orignal & complete set of templates!!!!
|
||||
Vector oldTemplates = _templates;
|
||||
List<Template> oldTemplates = _templates;
|
||||
|
||||
// Gather templates that are within the scope of this import
|
||||
_templates = new Vector();
|
||||
final Enumeration templates = oldTemplates.elements();
|
||||
while (templates.hasMoreElements()) {
|
||||
final Template template = (Template)templates.nextElement();
|
||||
_templates = new ArrayList<>();
|
||||
for (Template template : oldTemplates) {
|
||||
final int prec = template.getImportPrecedence();
|
||||
if ((prec >= min) && (prec < max)) addTemplate(template);
|
||||
}
|
||||
@ -1159,7 +1136,7 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
final boolean[] isAttribute = new boolean[types.length];
|
||||
final boolean[] isNamespace = new boolean[types.length];
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
final String name = (String)names.elementAt(i);
|
||||
final String name = (String)names.get(i);
|
||||
isAttribute[i+DTM.NTYPES] = isAttributeName(name);
|
||||
isNamespace[i+DTM.NTYPES] = isNamespaceName(name);
|
||||
}
|
||||
@ -1406,8 +1383,8 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
// is creating a problem in the Turkish locale
|
||||
pattern = "loadinstruction pop";
|
||||
|
||||
for (Iterator iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = (InstructionHandle[]) iter.next();
|
||||
for (Iterator<InstructionHandle[]> iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = iter.next();
|
||||
try {
|
||||
if (!match[0].hasTargeters() && !match[1].hasTargeters()) {
|
||||
il.delete(match[0], match[1]);
|
||||
@ -1423,8 +1400,8 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
// changed to lower case - changing to all lower case although only the instruction with capital I
|
||||
// is creating a problem in the Turkish locale
|
||||
pattern = "iload iload swap istore";
|
||||
for (Iterator iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = (InstructionHandle[]) iter.next();
|
||||
for (Iterator<InstructionHandle[]> iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = iter.next();
|
||||
try {
|
||||
com.sun.org.apache.bcel.internal.generic.ILOAD iload1 =
|
||||
(com.sun.org.apache.bcel.internal.generic.ILOAD) match[0].getInstruction();
|
||||
@ -1452,8 +1429,8 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
// changed to lower case - changing to all lower case although only the instruction with capital I
|
||||
// is creating a problem in the Turkish locale
|
||||
pattern = "loadinstruction loadinstruction swap";
|
||||
for (Iterator iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = (InstructionHandle[])iter.next();
|
||||
for (Iterator<InstructionHandle[]> iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = iter.next();
|
||||
try {
|
||||
if (!match[0].hasTargeters() &&
|
||||
!match[1].hasTargeters() &&
|
||||
@ -1474,8 +1451,8 @@ for (int i = 0; i < _templates.size(); i++) {
|
||||
// changed to lower case - changing to all lower case although only the instruction with capital I
|
||||
// is creating a problem in the Turkish locale
|
||||
pattern = "aload aload";
|
||||
for (Iterator iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = (InstructionHandle[])iter.next();
|
||||
for (Iterator<InstructionHandle[]> iter = find.search(pattern); iter.hasNext();) {
|
||||
InstructionHandle[] match = iter.next();
|
||||
try {
|
||||
if (!match[1].hasTargeters()) {
|
||||
com.sun.org.apache.bcel.internal.generic.ALOAD aload1 =
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
@ -30,6 +28,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Morten Jorgensen
|
||||
@ -50,7 +49,7 @@ class NameBase extends FunctionCall {
|
||||
/**
|
||||
* Handles calls with one parameter (either node or node-set).
|
||||
*/
|
||||
public NameBase(QName fname, Vector arguments) {
|
||||
public NameBase(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
_param = argument(0);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,13 +21,12 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -46,7 +45,7 @@ final class NameCall extends NameBase {
|
||||
/**
|
||||
* Handles calls with one parameter (either node or node-set).
|
||||
*/
|
||||
public NameCall(QName fname, Vector arguments) {
|
||||
public NameCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,13 +21,12 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Morten Jorgensen
|
||||
@ -44,7 +43,7 @@ final class NamespaceUriCall extends NameBase {
|
||||
/**
|
||||
* Handles calls with one parameter (either node or node-set).
|
||||
*/
|
||||
public NamespaceUriCall(QName fname, Vector arguments) {
|
||||
public NamespaceUriCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,20 +21,19 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
final class NotCall extends FunctionCall {
|
||||
public NotCall(QName fname, Vector arguments) {
|
||||
public NotCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,23 +21,21 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.classfile.Field;
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ILOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.CHECKCAST;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.D2I;
|
||||
import com.sun.org.apache.bcel.internal.generic.GETFIELD;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
import com.sun.org.apache.bcel.internal.generic.IFNONNULL;
|
||||
import com.sun.org.apache.bcel.internal.generic.ILOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.D2I;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
@ -50,6 +48,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.RealType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -86,7 +86,7 @@ final class Number extends Instruction implements Closure {
|
||||
private boolean _formatNeeded = false;
|
||||
|
||||
private String _className = null;
|
||||
private ArrayList _closureVars = null;
|
||||
private List<VariableRefBase> _closureVars = null;
|
||||
|
||||
// -- Begin Closure interface --------------------
|
||||
|
||||
@ -118,7 +118,7 @@ final class Number extends Instruction implements Closure {
|
||||
*/
|
||||
public void addVariable(VariableRefBase variableRef) {
|
||||
if (_closureVars == null) {
|
||||
_closureVars = new ArrayList();
|
||||
_closureVars = new ArrayList<>();
|
||||
}
|
||||
|
||||
// Only one reference per variable
|
||||
@ -395,8 +395,7 @@ final class Number extends Instruction implements Closure {
|
||||
_closureVars.size();
|
||||
|
||||
for (int i = 0; i < closureLen; i++) {
|
||||
VariableBase var =
|
||||
((VariableRefBase) _closureVars.get(i)).getVariable();
|
||||
VariableBase var = (_closureVars.get(i)).getVariable();
|
||||
|
||||
nodeCounterGen.addField(new Field(ACC_PUBLIC,
|
||||
cpg.addUtf8(var.getEscapedName()),
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,13 +21,12 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -35,7 +34,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
*/
|
||||
final class NumberCall extends FunctionCall {
|
||||
|
||||
public NumberCall(QName fname, Vector arguments) {
|
||||
public NumberCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.classfile.Field;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.CHECKCAST;
|
||||
@ -47,6 +45,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.Operators;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -92,7 +92,7 @@ final class Predicate extends Expression implements Closure {
|
||||
/**
|
||||
* List of variables in closure.
|
||||
*/
|
||||
private ArrayList _closureVars = null;
|
||||
private List<VariableRefBase> _closureVars = null;
|
||||
|
||||
/**
|
||||
* Reference to parent closure.
|
||||
@ -208,7 +208,7 @@ final class Predicate extends Expression implements Closure {
|
||||
*/
|
||||
public void addVariable(VariableRefBase variableRef) {
|
||||
if (_closureVars == null) {
|
||||
_closureVars = new ArrayList();
|
||||
_closureVars = new ArrayList<>();
|
||||
}
|
||||
|
||||
// Only one reference per variable
|
||||
@ -372,7 +372,7 @@ final class Predicate extends Expression implements Closure {
|
||||
|
||||
// Add a new instance variable for each var in closure
|
||||
for (int i = 0; i < length; i++) {
|
||||
VariableBase var = ((VariableRefBase) _closureVars.get(i)).getVariable();
|
||||
VariableBase var = (_closureVars.get(i)).getVariable();
|
||||
|
||||
filterGen.addField(new Field(ACC_PUBLIC,
|
||||
cpg.addUtf8(var.getEscapedName()),
|
||||
@ -559,7 +559,7 @@ final class Predicate extends Expression implements Closure {
|
||||
final int length = (_closureVars == null) ? 0 : _closureVars.size();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
VariableRefBase varRef = (VariableRefBase) _closureVars.get(i);
|
||||
VariableRefBase varRef = _closureVars.get(i);
|
||||
VariableBase var = varRef.getVariable();
|
||||
Type varType = var.getType();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -81,7 +81,7 @@ final class ProcessingInstructionPattern extends StepPattern {
|
||||
// Type check all the predicates (e -> position() = e)
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Predicate pred = (Predicate)_predicates.elementAt(i);
|
||||
final Predicate pred = _predicates.get(i);
|
||||
pred.typeCheck(stable);
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ final class ProcessingInstructionPattern extends StepPattern {
|
||||
if (hasPredicates()) {
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Predicate pred = (Predicate)_predicates.elementAt(i);
|
||||
Predicate pred = _predicates.get(i);
|
||||
Expression exp = pred.getExpr();
|
||||
exp.translateDesynthesized(classGen, methodGen);
|
||||
_trueList.append(exp._trueList);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -183,11 +183,11 @@ final class RelationalExpr extends Expression {
|
||||
new MethodType(Type.Void, tleft, tright));
|
||||
|
||||
if (ptype != null) {
|
||||
Type arg1 = (Type) ptype.argsType().elementAt(0);
|
||||
Type arg1 = ptype.argsType().get(0);
|
||||
if (!arg1.identicalTo(tleft)) {
|
||||
_left = new CastExpr(_left, arg1);
|
||||
}
|
||||
Type arg2 = (Type) ptype.argsType().elementAt(1);
|
||||
Type arg2 = ptype.argsType().get(1);
|
||||
if (!arg2.identicalTo(tright)) {
|
||||
_right = new CastExpr(_right, arg1);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,13 +21,12 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -35,7 +34,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
*/
|
||||
final class RoundCall extends FunctionCall {
|
||||
|
||||
public RoundCall(QName fname, Vector arguments) {
|
||||
public RoundCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -20,9 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.classfile.Field;
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ANEWARRAY;
|
||||
@ -53,6 +51,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.dtm.Axis;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -69,7 +69,7 @@ final class Sort extends Instruction implements Closure {
|
||||
private String _lang; // bug! see 26869
|
||||
|
||||
private String _className = null;
|
||||
private ArrayList<VariableRefBase> _closureVars = null;
|
||||
private List<VariableRefBase> _closureVars = null;
|
||||
private boolean _needsSortRecordFactory = false;
|
||||
|
||||
// -- Begin Closure interface --------------------
|
||||
@ -233,7 +233,7 @@ final class Sort extends Instruction implements Closure {
|
||||
public static void translateSortIterator(ClassGenerator classGen,
|
||||
MethodGenerator methodGen,
|
||||
Expression nodeSet,
|
||||
Vector<Sort> sortObjects)
|
||||
List<Sort> sortObjects)
|
||||
{
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
@ -299,7 +299,7 @@ final class Sort extends Instruction implements Closure {
|
||||
* Compiles code that instantiates a NodeSortRecordFactory object which
|
||||
* will produce NodeSortRecord objects of a specific type.
|
||||
*/
|
||||
public static void compileSortRecordFactory(Vector<Sort> sortObjects,
|
||||
public static void compileSortRecordFactory(List<Sort> sortObjects,
|
||||
ClassGenerator classGen, MethodGenerator methodGen)
|
||||
{
|
||||
String sortRecordClass =
|
||||
@ -308,7 +308,7 @@ final class Sort extends Instruction implements Closure {
|
||||
boolean needsSortRecordFactory = false;
|
||||
final int nsorts = sortObjects.size();
|
||||
for (int i = 0; i < nsorts; i++) {
|
||||
final Sort sort = sortObjects.elementAt(i);
|
||||
final Sort sort = sortObjects.get(i);
|
||||
needsSortRecordFactory |= sort._needsSortRecordFactory;
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ final class Sort extends Instruction implements Closure {
|
||||
il.append(new PUSH(cpg, nsorts));
|
||||
il.append(new ANEWARRAY(cpg.addClass(STRING)));
|
||||
for (int level = 0; level < nsorts; level++) {
|
||||
final Sort sort = (Sort)sortObjects.elementAt(level);
|
||||
final Sort sort = sortObjects.get(level);
|
||||
il.append(DUP);
|
||||
il.append(new PUSH(cpg, level));
|
||||
sort.translateSortOrder(classGen, methodGen);
|
||||
@ -354,7 +354,7 @@ final class Sort extends Instruction implements Closure {
|
||||
il.append(new PUSH(cpg, nsorts));
|
||||
il.append(new ANEWARRAY(cpg.addClass(STRING)));
|
||||
for (int level = 0; level < nsorts; level++) {
|
||||
final Sort sort = (Sort)sortObjects.elementAt(level);
|
||||
final Sort sort = sortObjects.get(level);
|
||||
il.append(DUP);
|
||||
il.append(new PUSH(cpg, level));
|
||||
sort.translateSortType(classGen, methodGen);
|
||||
@ -369,7 +369,7 @@ final class Sort extends Instruction implements Closure {
|
||||
il.append(new PUSH(cpg, nsorts));
|
||||
il.append(new ANEWARRAY(cpg.addClass(STRING)));
|
||||
for (int level = 0; level < nsorts; level++) {
|
||||
final Sort sort = (Sort)sortObjects.elementAt(level);
|
||||
final Sort sort = sortObjects.get(level);
|
||||
il.append(DUP);
|
||||
il.append(new PUSH(cpg, level));
|
||||
sort.translateLang(classGen, methodGen);
|
||||
@ -384,7 +384,7 @@ final class Sort extends Instruction implements Closure {
|
||||
il.append(new PUSH(cpg, nsorts));
|
||||
il.append(new ANEWARRAY(cpg.addClass(STRING)));
|
||||
for (int level = 0; level < nsorts; level++) {
|
||||
final Sort sort = (Sort)sortObjects.elementAt(level);
|
||||
final Sort sort = sortObjects.get(level);
|
||||
il.append(DUP);
|
||||
il.append(new PUSH(cpg, level));
|
||||
sort.translateCaseOrder(classGen, methodGen);
|
||||
@ -416,7 +416,7 @@ final class Sort extends Instruction implements Closure {
|
||||
+ "[" + STRING_SIG + ")V")));
|
||||
|
||||
// Initialize closure variables in sortRecordFactory
|
||||
final ArrayList<VariableRefBase> dups = new ArrayList<>();
|
||||
final List<VariableRefBase> dups = new ArrayList<>();
|
||||
|
||||
for (int j = 0; j < nsorts; j++) {
|
||||
final Sort sort = (Sort) sortObjects.get(j);
|
||||
@ -442,11 +442,11 @@ final class Sort extends Instruction implements Closure {
|
||||
}
|
||||
}
|
||||
|
||||
public static String compileSortRecordFactory(Vector<Sort> sortObjects,
|
||||
public static String compileSortRecordFactory(List<Sort> sortObjects,
|
||||
ClassGenerator classGen, MethodGenerator methodGen,
|
||||
String sortRecordClass)
|
||||
{
|
||||
final XSLTC xsltc = (sortObjects.firstElement()).getXSLTC();
|
||||
final XSLTC xsltc = (sortObjects.get(0)).getXSLTC();
|
||||
final String className = xsltc.getHelperClassName();
|
||||
|
||||
final NodeSortRecordFactGenerator sortRecordFactory =
|
||||
@ -461,7 +461,7 @@ final class Sort extends Instruction implements Closure {
|
||||
|
||||
// Add a new instance variable for each var in closure
|
||||
final int nsorts = sortObjects.size();
|
||||
final ArrayList<VariableRefBase> dups = new ArrayList<>();
|
||||
final List<VariableRefBase> dups = new ArrayList<>();
|
||||
|
||||
for (int j = 0; j < nsorts; j++) {
|
||||
final Sort sort = sortObjects.get(j);
|
||||
@ -587,10 +587,10 @@ final class Sort extends Instruction implements Closure {
|
||||
/**
|
||||
* Create a new auxillary class extending NodeSortRecord.
|
||||
*/
|
||||
private static String compileSortRecord(Vector<Sort> sortObjects,
|
||||
private static String compileSortRecord(List<Sort> sortObjects,
|
||||
ClassGenerator classGen,
|
||||
MethodGenerator methodGen) {
|
||||
final XSLTC xsltc = sortObjects.firstElement().getXSLTC();
|
||||
final XSLTC xsltc = sortObjects.get(0).getXSLTC();
|
||||
final String className = xsltc.getHelperClassName();
|
||||
|
||||
// This generates a new class for handling this specific sort
|
||||
@ -606,7 +606,7 @@ final class Sort extends Instruction implements Closure {
|
||||
|
||||
// Add a new instance variable for each var in closure
|
||||
final int nsorts = sortObjects.size();
|
||||
final ArrayList<VariableRefBase> dups = new ArrayList<>();
|
||||
final List<VariableRefBase> dups = new ArrayList<>();
|
||||
|
||||
for (int j = 0; j < nsorts; j++) {
|
||||
final Sort sort = sortObjects.get(j);
|
||||
@ -673,7 +673,7 @@ final class Sort extends Instruction implements Closure {
|
||||
/**
|
||||
* Compiles a method that overloads NodeSortRecord.extractValueFromDOM()
|
||||
*/
|
||||
private static MethodGenerator compileExtract(Vector<Sort> sortObjects,
|
||||
private static MethodGenerator compileExtract(List<Sort> sortObjects,
|
||||
NodeSortRecordGenerator sortRecord,
|
||||
ConstantPoolGen cpg,
|
||||
String className) {
|
||||
@ -715,7 +715,7 @@ final class Sort extends Instruction implements Closure {
|
||||
// Append all the cases for the switch statment
|
||||
for (int level = 0; level < levels; level++) {
|
||||
match[level] = level;
|
||||
final Sort sort = sortObjects.elementAt(level);
|
||||
final Sort sort = sortObjects.get(level);
|
||||
target[level] = il.append(NOP);
|
||||
sort.translateSelect(sortRecord, extractMethod);
|
||||
il.append(ARETURN);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
@ -31,6 +29,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -45,7 +44,7 @@ final class StartsWithCall extends FunctionCall {
|
||||
/**
|
||||
* Create a starts-with() call - two arguments, both strings
|
||||
*/
|
||||
public StartsWithCall(QName fname, Vector arguments) {
|
||||
public StartsWithCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,17 +21,15 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.CHECKCAST;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.ICONST;
|
||||
import com.sun.org.apache.bcel.internal.generic.ILOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ISTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.ISTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
@ -44,6 +42,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.dtm.Axis;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -60,7 +59,7 @@ final class Step extends RelativeLocationPath {
|
||||
/**
|
||||
* A vector of predicates (filters) defined on this step - may be null
|
||||
*/
|
||||
private Vector _predicates;
|
||||
private List<Predicate> _predicates;
|
||||
|
||||
/**
|
||||
* Some simple predicates can be handled by this class (and not by the
|
||||
@ -74,7 +73,7 @@ final class Step extends RelativeLocationPath {
|
||||
*/
|
||||
private int _nodeType;
|
||||
|
||||
public Step(int axis, int nodeType, Vector predicates) {
|
||||
public Step(int axis, int nodeType, List<Predicate> predicates) {
|
||||
_axis = axis;
|
||||
_nodeType = nodeType;
|
||||
_predicates = predicates;
|
||||
@ -88,7 +87,7 @@ final class Step extends RelativeLocationPath {
|
||||
if (_predicates != null) {
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Predicate exp = (Predicate)_predicates.elementAt(i);
|
||||
final Predicate exp = _predicates.get(i);
|
||||
exp.setParser(parser);
|
||||
exp.setParent(this);
|
||||
}
|
||||
@ -119,14 +118,14 @@ final class Step extends RelativeLocationPath {
|
||||
/**
|
||||
* Returns the vector containing all predicates for this step.
|
||||
*/
|
||||
public Vector getPredicates() {
|
||||
public List<Predicate> getPredicates() {
|
||||
return _predicates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the vector containing all predicates for this step.
|
||||
*/
|
||||
public void addPredicates(Vector predicates) {
|
||||
public void addPredicates(List<Predicate> predicates) {
|
||||
if (_predicates == null) {
|
||||
_predicates = predicates;
|
||||
}
|
||||
@ -213,9 +212,7 @@ final class Step extends RelativeLocationPath {
|
||||
|
||||
// Type check all predicates (expressions applied to the step)
|
||||
if (_predicates != null) {
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Expression pred = (Expression)_predicates.elementAt(i);
|
||||
for (Expression pred : _predicates) {
|
||||
pred.typeCheck(stable);
|
||||
}
|
||||
}
|
||||
@ -249,9 +246,9 @@ final class Step extends RelativeLocationPath {
|
||||
final XSLTC xsltc = getParser().getXSLTC();
|
||||
|
||||
if (_nodeType >= DTM.NTYPES) {
|
||||
final Vector ni = xsltc.getNamesIndex();
|
||||
final List<String> ni = xsltc.getNamesIndex();
|
||||
|
||||
name = (String)ni.elementAt(_nodeType-DTM.NTYPES);
|
||||
name = ni.get(_nodeType-DTM.NTYPES);
|
||||
star = name.lastIndexOf('*');
|
||||
}
|
||||
|
||||
@ -375,7 +372,7 @@ final class Step extends RelativeLocationPath {
|
||||
translateStep(classGen, methodGen, predicateIndex);
|
||||
}
|
||||
else {
|
||||
final Predicate predicate = (Predicate) _predicates.get(predicateIndex--);
|
||||
final Predicate predicate = _predicates.get(predicateIndex--);
|
||||
|
||||
// Special case for predicates that can use the NodeValueIterator
|
||||
// instead of an auxiliary class. Certain path/predicates pairs
|
||||
@ -525,9 +522,7 @@ final class Step extends RelativeLocationPath {
|
||||
final StringBuffer buffer = new StringBuffer("step(\"");
|
||||
buffer.append(Axis.getNames(_axis)).append("\", ").append(_nodeType);
|
||||
if (_predicates != null) {
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Predicate pred = (Predicate)_predicates.elementAt(i);
|
||||
for (Expression pred : _predicates) {
|
||||
buffer.append(", ").append(pred.toString());
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.classfile.Field;
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
@ -54,6 +52,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.dtm.Axis;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -68,7 +67,7 @@ class StepPattern extends RelativePathPattern {
|
||||
|
||||
protected final int _axis;
|
||||
protected final int _nodeType;
|
||||
protected Vector _predicates;
|
||||
protected List<Predicate> _predicates;
|
||||
|
||||
private Step _step = null;
|
||||
private boolean _isEpsilon = false;
|
||||
@ -76,7 +75,7 @@ class StepPattern extends RelativePathPattern {
|
||||
|
||||
private double _priority = Double.MAX_VALUE;
|
||||
|
||||
public StepPattern(int axis, int nodeType, Vector predicates) {
|
||||
public StepPattern(int axis, int nodeType, List<Predicate> predicates) {
|
||||
_axis = axis;
|
||||
_nodeType = nodeType;
|
||||
_predicates = predicates;
|
||||
@ -85,9 +84,7 @@ class StepPattern extends RelativePathPattern {
|
||||
public void setParser(Parser parser) {
|
||||
super.setParser(parser);
|
||||
if (_predicates != null) {
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Predicate exp = (Predicate)_predicates.elementAt(i);
|
||||
for (Predicate exp : _predicates) {
|
||||
exp.setParser(parser);
|
||||
exp.setParent(this);
|
||||
}
|
||||
@ -110,7 +107,7 @@ class StepPattern extends RelativePathPattern {
|
||||
return _isEpsilon && hasPredicates() == false;
|
||||
}
|
||||
|
||||
public StepPattern setPredicates(Vector predicates) {
|
||||
public StepPattern setPredicates(List<Predicate> predicates) {
|
||||
_predicates = predicates;
|
||||
return(this);
|
||||
}
|
||||
@ -149,7 +146,7 @@ class StepPattern extends RelativePathPattern {
|
||||
|
||||
public String toString() {
|
||||
final StringBuffer buffer = new StringBuffer("stepPattern(\"");
|
||||
buffer.append(Axis.getNames(_axis))
|
||||
buffer.append(Axis.getNames(_axis))
|
||||
.append("\", ")
|
||||
.append(_isEpsilon ?
|
||||
("epsilon{" + Integer.toString(_nodeType) + "}") :
|
||||
@ -164,7 +161,7 @@ class StepPattern extends RelativePathPattern {
|
||||
final int n = _predicates.size();
|
||||
|
||||
for (int i = 0; i < n && noContext; i++) {
|
||||
Predicate pred = (Predicate) _predicates.elementAt(i);
|
||||
Predicate pred = _predicates.get(i);
|
||||
if (pred.isNthPositionFilter() ||
|
||||
pred.hasPositionCall() ||
|
||||
pred.hasLastCall())
|
||||
@ -189,9 +186,7 @@ class StepPattern extends RelativePathPattern {
|
||||
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
|
||||
if (hasPredicates()) {
|
||||
// Type check all the predicates (e -> position() = e)
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Predicate pred = (Predicate)_predicates.elementAt(i);
|
||||
for (Predicate pred : _predicates) {
|
||||
pred.typeCheck(stable);
|
||||
}
|
||||
|
||||
@ -202,7 +197,7 @@ class StepPattern extends RelativePathPattern {
|
||||
|
||||
// Create an instance of Step to do the translation
|
||||
if (_contextCase == SIMPLE_CONTEXT) {
|
||||
Predicate pred = (Predicate)_predicates.elementAt(0);
|
||||
Predicate pred = _predicates.get(0);
|
||||
if (pred.isNthPositionFilter()) {
|
||||
_contextCase = GENERAL_CONTEXT;
|
||||
step = new Step(_axis, _nodeType, _predicates);
|
||||
@ -210,9 +205,8 @@ class StepPattern extends RelativePathPattern {
|
||||
step = new Step(_axis, _nodeType, null);
|
||||
}
|
||||
} else if (_contextCase == GENERAL_CONTEXT) {
|
||||
final int len = _predicates.size();
|
||||
for (int i = 0; i < len; i++) {
|
||||
((Predicate)_predicates.elementAt(i)).dontOptimize();
|
||||
for (Predicate pred : _predicates) {
|
||||
pred.dontOptimize();
|
||||
}
|
||||
|
||||
step = new Step(_axis, _nodeType, _predicates);
|
||||
@ -292,9 +286,7 @@ class StepPattern extends RelativePathPattern {
|
||||
}
|
||||
|
||||
// Compile the expressions within the predicates
|
||||
final int n = _predicates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
Predicate pred = (Predicate)_predicates.elementAt(i);
|
||||
for (Predicate pred : _predicates) {
|
||||
Expression exp = pred.getExpr();
|
||||
exp.translateDesynthesized(classGen, methodGen);
|
||||
_trueList.append(exp._trueList);
|
||||
@ -382,7 +374,7 @@ class StepPattern extends RelativePathPattern {
|
||||
il.append(methodGen.storeCurrentNode());
|
||||
|
||||
// Translate the expression of the predicate
|
||||
Predicate pred = (Predicate) _predicates.elementAt(0);
|
||||
Predicate pred = _predicates.get(0);
|
||||
Expression exp = pred.getExpr();
|
||||
exp.translateDesynthesized(classGen, methodGen);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,21 +21,20 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
final class StringCall extends FunctionCall {
|
||||
public StringCall(QName fname, Vector arguments) {
|
||||
public StringCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,21 +21,20 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
final class StringLengthCall extends FunctionCall {
|
||||
public StringLengthCall(QName fname, Vector arguments) {
|
||||
public StringLengthCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -53,13 +54,13 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import com.sun.org.apache.xml.internal.utils.SystemIDResolver;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -91,7 +92,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
/**
|
||||
* Contains global variables and parameters defined in the stylesheet.
|
||||
*/
|
||||
private Vector _globals = new Vector();
|
||||
private List<VariableBase> _globals = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Used to cache the result returned by <code>hasLocalParams()</code>.
|
||||
@ -106,13 +107,13 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
/**
|
||||
* Contains all templates defined in this stylesheet
|
||||
*/
|
||||
private final Vector _templates = new Vector();
|
||||
private final List<Template> _templates = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Used to cache result of <code>getAllValidTemplates()</code>. Only
|
||||
* set in top-level stylesheets that include/import other stylesheets.
|
||||
*/
|
||||
private Vector _allValidTemplates = null;
|
||||
private List<Template> _allValidTemplates = null;
|
||||
|
||||
/**
|
||||
* Counter to generate unique mode suffixes.
|
||||
@ -149,7 +150,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
/**
|
||||
* Array of all the stylesheets imported or included from this one.
|
||||
*/
|
||||
private Vector _includedStylesheets = null;
|
||||
private List<Stylesheet> _includedStylesheets = null;
|
||||
|
||||
/**
|
||||
* Import precendence for this stylesheet.
|
||||
@ -370,8 +371,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
: 0;
|
||||
|
||||
for (int i = 0; i < inclImpCount; i++) {
|
||||
int prec = ((Stylesheet)_includedStylesheets.elementAt(i))
|
||||
.getMinimumDescendantPrecedence();
|
||||
int prec = (_includedStylesheets.get(i)).getMinimumDescendantPrecedence();
|
||||
|
||||
if (prec < min) {
|
||||
min = prec;
|
||||
@ -420,9 +420,9 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
|
||||
public void addIncludedStylesheet(Stylesheet child) {
|
||||
if (_includedStylesheets == null) {
|
||||
_includedStylesheets = new Vector();
|
||||
_includedStylesheets = new ArrayList<>();
|
||||
}
|
||||
_includedStylesheets.addElement(child);
|
||||
_includedStylesheets.add(child);
|
||||
}
|
||||
|
||||
public void setSystemId(String systemId) {
|
||||
@ -461,10 +461,10 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
*/
|
||||
public boolean hasLocalParams() {
|
||||
if (_hasLocalParams == null) {
|
||||
Vector templates = getAllValidTemplates();
|
||||
List<Template> templates = getAllValidTemplates();
|
||||
final int n = templates.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final Template template = (Template)templates.elementAt(i);
|
||||
final Template template = templates.get(i);
|
||||
if (template.hasParams()) {
|
||||
_hasLocalParams = Boolean.TRUE;
|
||||
return true;
|
||||
@ -648,7 +648,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
|
||||
final int count = _globals.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final VariableBase var = (VariableBase)_globals.elementAt(i);
|
||||
final VariableBase var = _globals.get(i);
|
||||
var.typeCheck(stable);
|
||||
}
|
||||
return typeCheckContents(stable);
|
||||
@ -711,7 +711,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
if (element instanceof Template) {
|
||||
// Separate templates by modes
|
||||
final Template template = (Template)element;
|
||||
//_templates.addElement(template);
|
||||
//_templates.add(template);
|
||||
getMode(template.getModeName()).addTemplate(template);
|
||||
}
|
||||
// xsl:attribute-set
|
||||
@ -770,7 +770,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
}
|
||||
|
||||
// Put the names array into the translet - used for dom/translet mapping
|
||||
final Vector namesIndex = getXSLTC().getNamesIndex();
|
||||
final List<String> namesIndex = getXSLTC().getNamesIndex();
|
||||
int size = namesIndex.size();
|
||||
String[] namesArray = new String[size];
|
||||
String[] urisArray = new String[size];
|
||||
@ -778,7 +778,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
|
||||
int index;
|
||||
for (int i = 0; i < size; i++) {
|
||||
String encodedName = (String)namesIndex.elementAt(i);
|
||||
String encodedName = namesIndex.get(i);
|
||||
if ((index = encodedName.lastIndexOf(':')) > -1) {
|
||||
urisArray[i] = encodedName.substring(0, index);
|
||||
}
|
||||
@ -859,7 +859,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
}
|
||||
|
||||
// Put the namespace names array into the translet
|
||||
final Vector namespaces = getXSLTC().getNamespaceIndex();
|
||||
final List<String> namespaces = getXSLTC().getNamespaceIndex();
|
||||
staticConst.markChunkStart();
|
||||
il.append(new PUSH(cpg, namespaces.size()));
|
||||
il.append(new ANEWARRAY(cpg.addClass(STRING)));
|
||||
@ -870,7 +870,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
staticConst.markChunkEnd();
|
||||
|
||||
for (int i = 0; i < namespaces.size(); i++) {
|
||||
final String ns = (String)namespaces.elementAt(i);
|
||||
final String ns = namespaces.get(i);
|
||||
staticConst.markChunkStart();
|
||||
il.append(new GETSTATIC(namespaceArrayRef));
|
||||
il.append(new PUSH(cpg, i));
|
||||
@ -1050,7 +1050,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
current.setStart(il.append(new ISTORE(current.getIndex())));
|
||||
|
||||
// Create a new list containing variables/params + keys
|
||||
Vector varDepElements = new Vector(_globals);
|
||||
List<SyntaxTreeNode> varDepElements = new ArrayList<>(_globals);
|
||||
Iterator<SyntaxTreeNode> elements = elements();
|
||||
while (elements.hasNext()) {
|
||||
SyntaxTreeNode element = elements.next();
|
||||
@ -1065,7 +1065,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
// Translate vars/params and keys in the right order
|
||||
final int count = varDepElements.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final TopLevelElement tle = (TopLevelElement) varDepElements.elementAt(i);
|
||||
final TopLevelElement tle = (TopLevelElement) varDepElements.get(i);
|
||||
tle.translate(classGen, toplevel);
|
||||
if (tle instanceof Key) {
|
||||
final Key key = (Key) tle;
|
||||
@ -1074,7 +1074,7 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
}
|
||||
|
||||
// Compile code for other top-level elements
|
||||
Vector whitespaceRules = new Vector();
|
||||
List<Whitespace.WhitespaceRule> whitespaceRules = new ArrayList<>();
|
||||
elements = elements();
|
||||
while (elements.hasNext()) {
|
||||
SyntaxTreeNode element = elements.next();
|
||||
@ -1115,27 +1115,15 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
* compatibility with Xalan interpretive, that type of dependency is
|
||||
* allowed and, therefore, consider to determine the partial order.
|
||||
*/
|
||||
private Vector resolveDependencies(Vector input) {
|
||||
/* DEBUG CODE - INGORE
|
||||
for (int i = 0; i < input.size(); i++) {
|
||||
final TopLevelElement e = (TopLevelElement) input.elementAt(i);
|
||||
System.out.println("e = " + e + " depends on:");
|
||||
Vector dep = e.getDependencies();
|
||||
for (int j = 0; j < (dep != null ? dep.size() : 0); j++) {
|
||||
System.out.println("\t" + dep.elementAt(j));
|
||||
}
|
||||
}
|
||||
System.out.println("=================================");
|
||||
*/
|
||||
|
||||
Vector result = new Vector();
|
||||
private List<SyntaxTreeNode> resolveDependencies(List<SyntaxTreeNode> input) {
|
||||
List<SyntaxTreeNode> result = new ArrayList<>();
|
||||
while (input.size() > 0) {
|
||||
boolean changed = false;
|
||||
for (int i = 0; i < input.size(); ) {
|
||||
final TopLevelElement vde = (TopLevelElement) input.elementAt(i);
|
||||
final Vector dep = vde.getDependencies();
|
||||
final TopLevelElement vde = (TopLevelElement) input.get(i);
|
||||
final List<SyntaxTreeNode> dep = vde.getDependencies();
|
||||
if (dep == null || result.containsAll(dep)) {
|
||||
result.addElement(vde);
|
||||
result.add(vde);
|
||||
input.remove(i);
|
||||
changed = true;
|
||||
}
|
||||
@ -1153,14 +1141,6 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
/* DEBUG CODE - INGORE
|
||||
System.out.println("=================================");
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
final TopLevelElement e = (TopLevelElement) result.elementAt(i);
|
||||
System.out.println("e = " + e);
|
||||
}
|
||||
*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1374,8 +1354,8 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
final String pattern = "`aload'`pop'`instruction'";
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
final InstructionFinder find = new InstructionFinder(il);
|
||||
for(Iterator iter=find.search(pattern); iter.hasNext(); ) {
|
||||
InstructionHandle[] match = (InstructionHandle[])iter.next();
|
||||
for(Iterator<InstructionHandle[]> iter=find.search(pattern); iter.hasNext(); ) {
|
||||
InstructionHandle[] match = iter.next();
|
||||
try {
|
||||
il.delete(match[0], match[1]);
|
||||
}
|
||||
@ -1386,12 +1366,12 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
}
|
||||
|
||||
public int addParam(Param param) {
|
||||
_globals.addElement(param);
|
||||
_globals.add(param);
|
||||
return _globals.size() - 1;
|
||||
}
|
||||
|
||||
public int addVariable(Variable global) {
|
||||
_globals.addElement(global);
|
||||
_globals.add(global);
|
||||
return _globals.size() - 1;
|
||||
}
|
||||
|
||||
@ -1410,11 +1390,11 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
return _className;
|
||||
}
|
||||
|
||||
public Vector getTemplates() {
|
||||
public List<Template> getTemplates() {
|
||||
return _templates;
|
||||
}
|
||||
|
||||
public Vector getAllValidTemplates() {
|
||||
public List<Template> getAllValidTemplates() {
|
||||
// Return templates if no imported/included stylesheets
|
||||
if (_includedStylesheets == null) {
|
||||
return _templates;
|
||||
@ -1422,11 +1402,9 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
|
||||
// Is returned value cached?
|
||||
if (_allValidTemplates == null) {
|
||||
Vector templates = new Vector();
|
||||
templates.addAll(_templates);
|
||||
int size = _includedStylesheets.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Stylesheet included =(Stylesheet)_includedStylesheets.elementAt(i);
|
||||
List<Template> templates = new ArrayList<>();
|
||||
templates.addAll(_templates);
|
||||
for (Stylesheet included : _includedStylesheets) {
|
||||
templates.addAll(included.getAllValidTemplates());
|
||||
}
|
||||
//templates.addAll(_templates);
|
||||
@ -1442,6 +1420,6 @@ public final class Stylesheet extends SyntaxTreeNode {
|
||||
}
|
||||
|
||||
protected void addTemplate(Template template) {
|
||||
_templates.addElement(template);
|
||||
_templates.add(template);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -24,11 +25,12 @@
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -39,7 +41,7 @@ final class SymbolTable {
|
||||
|
||||
// These maps are used for all stylesheets
|
||||
private final Map<String, Stylesheet> _stylesheets = new HashMap<>();
|
||||
private final Map<String, Vector> _primops = new HashMap<>();
|
||||
private final Map<String, List<MethodType>> _primops = new HashMap<>();
|
||||
|
||||
// These maps are used for some stylesheets
|
||||
private Map<String, VariableBase> _variables = null;
|
||||
@ -138,18 +140,18 @@ final class SymbolTable {
|
||||
* is prepended.
|
||||
*/
|
||||
public void addPrimop(String name, MethodType mtype) {
|
||||
Vector methods = _primops.get(name);
|
||||
List<MethodType> methods = _primops.get(name);
|
||||
if (methods == null) {
|
||||
_primops.put(name, methods = new Vector());
|
||||
_primops.put(name, methods = new ArrayList<>());
|
||||
}
|
||||
methods.addElement(mtype);
|
||||
methods.add(mtype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup a primitive operator or function in the symbol table by
|
||||
* prepending the prefix <tt>PrimopPrefix</tt>.
|
||||
*/
|
||||
public Vector lookupPrimop(String name) {
|
||||
public List<MethodType> lookupPrimop(String name) {
|
||||
return _primops.get(name);
|
||||
}
|
||||
|
||||
@ -272,7 +274,7 @@ final class SymbolTable {
|
||||
*/
|
||||
public void pushExcludedNamespacesContext() {
|
||||
if (_excludedURIStack == null) {
|
||||
_excludedURIStack = new Stack();
|
||||
_excludedURIStack = new Stack<>();
|
||||
}
|
||||
_excludedURIStack.push(_excludedURI);
|
||||
_excludedURI = null;
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -20,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
@ -34,6 +33,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.utils.XML11Char;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ public final class Template extends TopLevelElement {
|
||||
|
||||
// The list of parameters in this template. This is only used
|
||||
// for simple named templates.
|
||||
private Vector<Param> _parameters = new Vector<>();
|
||||
private List<Param> _parameters = new ArrayList<>();
|
||||
|
||||
public boolean hasParams() {
|
||||
return _parameters.size() > 0;
|
||||
@ -79,10 +79,10 @@ public final class Template extends TopLevelElement {
|
||||
}
|
||||
|
||||
public void addParameter(Param param) {
|
||||
_parameters.addElement(param);
|
||||
_parameters.add(param);
|
||||
}
|
||||
|
||||
public Vector<Param> getParameters() {
|
||||
public List<Param> getParameters() {
|
||||
return _parameters;
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ public final class Template extends TopLevelElement {
|
||||
|
||||
// Update load/store instructions to access Params from the stack
|
||||
for (int i = 0; i < numParams; i++) {
|
||||
Param param = (Param)_parameters.elementAt(i);
|
||||
Param param = _parameters.get(i);
|
||||
param.setLoadInstruction(namedMethodGen.loadParameter(i));
|
||||
param.setStoreInstruction(namedMethodGen.storeParameter(i));
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -28,9 +29,9 @@ import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import java.util.Dictionary;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* A test sequence is a sequence of patterns that
|
||||
@ -56,10 +57,10 @@ final class TestSeq {
|
||||
private int _kernelType;
|
||||
|
||||
/**
|
||||
* Vector of all patterns in the test sequence. May include
|
||||
* ArrayList of all patterns in the test sequence. May include
|
||||
* patterns with "*", "@*" or "node()" kernel.
|
||||
*/
|
||||
private Vector _patterns = null;
|
||||
private List<LocationPathPattern> _patterns = null;
|
||||
|
||||
/**
|
||||
* A reference to the Mode object.
|
||||
@ -84,11 +85,11 @@ final class TestSeq {
|
||||
/**
|
||||
* Creates a new test sequence given a set of patterns and a mode.
|
||||
*/
|
||||
public TestSeq(Vector patterns, Mode mode) {
|
||||
public TestSeq(List<LocationPathPattern> patterns, Mode mode) {
|
||||
this(patterns, -2, mode);
|
||||
}
|
||||
|
||||
public TestSeq(Vector patterns, int kernelType, Mode mode) {
|
||||
public TestSeq(List<LocationPathPattern> patterns, int kernelType, Mode mode) {
|
||||
_patterns = patterns;
|
||||
_kernelType = kernelType;
|
||||
_mode = mode;
|
||||
@ -104,8 +105,7 @@ final class TestSeq {
|
||||
final StringBuffer result = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
final LocationPathPattern pattern =
|
||||
(LocationPathPattern) _patterns.elementAt(i);
|
||||
final LocationPathPattern pattern = _patterns.get(i);
|
||||
|
||||
if (i == 0) {
|
||||
result.append("Testseq for kernel ").append(_kernelType)
|
||||
@ -131,8 +131,8 @@ final class TestSeq {
|
||||
* of the default pattern.
|
||||
*/
|
||||
public double getPriority() {
|
||||
final Template template = (_patterns.size() == 0) ? _default
|
||||
: ((Pattern) _patterns.elementAt(0)).getTemplate();
|
||||
final Template template = (_patterns.isEmpty()) ? _default
|
||||
: ((Pattern) _patterns.get(0)).getTemplate();
|
||||
return template.getPriority();
|
||||
}
|
||||
|
||||
@ -141,8 +141,8 @@ final class TestSeq {
|
||||
* this test sequence.
|
||||
*/
|
||||
public int getPosition() {
|
||||
final Template template = (_patterns.size() == 0) ? _default
|
||||
: ((Pattern) _patterns.elementAt(0)).getTemplate();
|
||||
final Template template = (_patterns.isEmpty()) ? _default
|
||||
: ((Pattern) _patterns.get(0)).getTemplate();
|
||||
return template.getPosition();
|
||||
}
|
||||
|
||||
@ -152,13 +152,9 @@ final class TestSeq {
|
||||
* finds a patterns that is fully reduced.
|
||||
*/
|
||||
public void reduce() {
|
||||
final Vector newPatterns = new Vector();
|
||||
|
||||
final int count = _patterns.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final LocationPathPattern pattern =
|
||||
(LocationPathPattern)_patterns.elementAt(i);
|
||||
final List<LocationPathPattern> newPatterns = new ArrayList<>();
|
||||
|
||||
for (LocationPathPattern pattern : _patterns) {
|
||||
// Reduce this pattern
|
||||
pattern.reduceKernelPattern();
|
||||
|
||||
@ -168,7 +164,7 @@ final class TestSeq {
|
||||
break; // Ignore following patterns
|
||||
}
|
||||
else {
|
||||
newPatterns.addElement(pattern);
|
||||
newPatterns.add(pattern);
|
||||
}
|
||||
}
|
||||
_patterns = newPatterns;
|
||||
@ -183,9 +179,7 @@ final class TestSeq {
|
||||
if (_default != null) {
|
||||
templates.put(_default, this);
|
||||
}
|
||||
for (int i = 0; i < _patterns.size(); i++) {
|
||||
final LocationPathPattern pattern =
|
||||
(LocationPathPattern)_patterns.elementAt(i);
|
||||
for (LocationPathPattern pattern : _patterns) {
|
||||
templates.put(pattern.getTemplate(), this);
|
||||
}
|
||||
}
|
||||
@ -204,7 +198,7 @@ final class TestSeq {
|
||||
* Returns pattern n in this test sequence
|
||||
*/
|
||||
private LocationPathPattern getPattern(int n) {
|
||||
return (LocationPathPattern)_patterns.elementAt(n);
|
||||
return _patterns.get(n);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
@ -30,6 +28,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class TopLevelElement extends SyntaxTreeNode {
|
||||
|
||||
@ -37,7 +37,7 @@ class TopLevelElement extends SyntaxTreeNode {
|
||||
* List of dependencies with other variables, parameters or
|
||||
* keys defined at the top level.
|
||||
*/
|
||||
protected Vector _dependencies = null;
|
||||
protected List<SyntaxTreeNode> _dependencies = null;
|
||||
|
||||
/**
|
||||
* Type check all the children of this node.
|
||||
@ -80,10 +80,10 @@ class TopLevelElement extends SyntaxTreeNode {
|
||||
*/
|
||||
public void addDependency(TopLevelElement other) {
|
||||
if (_dependencies == null) {
|
||||
_dependencies = new Vector();
|
||||
_dependencies = new ArrayList<>();
|
||||
}
|
||||
if (!_dependencies.contains(other)) {
|
||||
_dependencies.addElement(other);
|
||||
_dependencies.add(other);
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ class TopLevelElement extends SyntaxTreeNode {
|
||||
* Get the list of dependencies with other top-level elements
|
||||
* like variables, parameteres or keys.
|
||||
*/
|
||||
public Vector getDependencies() {
|
||||
public List<SyntaxTreeNode> getDependencies() {
|
||||
return _dependencies;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -66,7 +66,7 @@ final class UnaryOpExpr extends Expression {
|
||||
tleft));
|
||||
|
||||
if (ptype != null) {
|
||||
final Type arg1 = (Type) ptype.argsType().elementAt(0);
|
||||
final Type arg1 = ptype.argsType().get(0);
|
||||
if (!arg1.identicalTo(tleft)) {
|
||||
_left = new CastExpr(_left, arg1);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
@ -35,6 +33,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xml.internal.dtm.Axis;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -57,7 +57,7 @@ final class UnionPathExpr extends Expression {
|
||||
public void setParser(Parser parser) {
|
||||
super.setParser(parser);
|
||||
// find all expressions in this Union
|
||||
final Vector components = new Vector();
|
||||
final List<Expression> components = new ArrayList<>();
|
||||
flatten(components);
|
||||
final int size = components.size();
|
||||
_components = (Expression[])components.toArray(new Expression[size]);
|
||||
@ -95,14 +95,14 @@ final class UnionPathExpr extends Expression {
|
||||
return "union(" + _pathExpr + ", " + _rest + ')';
|
||||
}
|
||||
|
||||
private void flatten(Vector components) {
|
||||
components.addElement(_pathExpr);
|
||||
private void flatten(List<Expression> components) {
|
||||
components.add(_pathExpr);
|
||||
if (_rest != null) {
|
||||
if (_rest instanceof UnionPathExpr) {
|
||||
((UnionPathExpr)_rest).flatten(components);
|
||||
}
|
||||
else {
|
||||
components.addElement(_rest);
|
||||
components.add(_rest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,8 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
@ -31,6 +29,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.StringType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -40,7 +39,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
final class UnparsedEntityUriCall extends FunctionCall {
|
||||
private Expression _entity;
|
||||
|
||||
public UnparsedEntityUriCall(QName fname, Vector arguments) {
|
||||
public UnparsedEntityUriCall(QName fname, List<Expression> arguments) {
|
||||
super(fname, arguments);
|
||||
_entity = argument();
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,19 +24,17 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -43,7 +42,7 @@ import java.util.List;
|
||||
*/
|
||||
final class UnsupportedElement extends SyntaxTreeNode {
|
||||
|
||||
private Vector _fallbacks = null;
|
||||
private List<SyntaxTreeNode> _fallbacks = null;
|
||||
private ErrorMsg _message = null;
|
||||
private boolean _isExtension = false;
|
||||
|
||||
@ -94,9 +93,9 @@ final class UnsupportedElement extends SyntaxTreeNode {
|
||||
fallback.activate();
|
||||
fallback.parseContents(parser);
|
||||
if (_fallbacks == null) {
|
||||
_fallbacks = new Vector();
|
||||
_fallbacks = new ArrayList<>();
|
||||
}
|
||||
_fallbacks.addElement(child);
|
||||
_fallbacks.add(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,7 +115,7 @@ final class UnsupportedElement extends SyntaxTreeNode {
|
||||
if (_fallbacks != null) {
|
||||
int count = _fallbacks.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
Fallback fallback = (Fallback)_fallbacks.elementAt(i);
|
||||
Fallback fallback = (Fallback)_fallbacks.get(i);
|
||||
fallback.typeCheck(stable);
|
||||
}
|
||||
}
|
||||
@ -130,7 +129,7 @@ final class UnsupportedElement extends SyntaxTreeNode {
|
||||
if (_fallbacks != null) {
|
||||
int count = _fallbacks.size();
|
||||
for (int i = 0; i < count; i++) {
|
||||
Fallback fallback = (Fallback)_fallbacks.elementAt(i);
|
||||
Fallback fallback = (Fallback)_fallbacks.get(i);
|
||||
fallback.translate(classGen, methodGen);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,9 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
@ -32,6 +29,9 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -45,7 +45,7 @@ final class UseAttributeSets extends Instruction {
|
||||
"";
|
||||
|
||||
// Contains the names of all references attribute sets
|
||||
private final Vector _sets = new Vector(2);
|
||||
private final List<QName> _sets = new ArrayList<>(2);
|
||||
|
||||
/**
|
||||
* Constructur - define initial attribute sets to use
|
||||
@ -87,10 +87,7 @@ final class UseAttributeSets extends Instruction {
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
final SymbolTable symbolTable = getParser().getSymbolTable();
|
||||
|
||||
// Go through each attribute set and generate a method call
|
||||
for (int i=0; i<_sets.size(); i++) {
|
||||
// Get the attribute set name
|
||||
final QName name = (QName)_sets.elementAt(i);
|
||||
for (QName name : _sets) {
|
||||
// Get the AttributeSet reference from the symbol table
|
||||
final AttributeSet attrs = symbolTable.lookupAttributeSet(name);
|
||||
// Compile the call to the set's method if the set exists
|
||||
@ -102,7 +99,7 @@ final class UseAttributeSets extends Instruction {
|
||||
il.append(methodGen.loadHandler());
|
||||
il.append(methodGen.loadCurrentNode());
|
||||
final int method = cpg.addMethodref(classGen.getClassName(),
|
||||
methodName, ATTR_SET_SIG);
|
||||
methodName, ATTR_SET_SIG);
|
||||
il.append(new INVOKESPECIAL(method));
|
||||
}
|
||||
// Generate an error if the attribute set does not exist
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -20,15 +21,13 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.CHECKCAST;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.Instruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.Instruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
@ -40,6 +39,8 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ResultTreeType;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import com.sun.org.apache.xml.internal.utils.XML11Char;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -61,7 +62,7 @@ class VariableBase extends TopLevelElement {
|
||||
protected String select; // Textual repr. of variable expr.
|
||||
|
||||
// References to this variable (when local)
|
||||
protected Vector<VariableRefBase> _refs = new Vector<>(2);
|
||||
protected List<VariableRefBase> _refs = new ArrayList<>(2);
|
||||
|
||||
// Used to make sure parameter field is not added twice
|
||||
protected boolean _ignore = false;
|
||||
@ -78,7 +79,7 @@ class VariableBase extends TopLevelElement {
|
||||
* expression contains a reference to this variable.
|
||||
*/
|
||||
public void addReference(VariableRefBase vref) {
|
||||
_refs.addElement(vref);
|
||||
_refs.add(vref);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,9 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.BranchHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
@ -40,6 +37,9 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* @author Morten Jorgensen
|
||||
@ -63,7 +63,7 @@ final class Whitespace extends TopLevelElement {
|
||||
/**
|
||||
* Auxillary class for encapsulating a single strip/preserve rule
|
||||
*/
|
||||
private final static class WhitespaceRule {
|
||||
final static class WhitespaceRule {
|
||||
private final int _action;
|
||||
private String _namespace; // Should be replaced by NS type (int)
|
||||
private String _element; // Should be replaced by node type (int)
|
||||
@ -174,8 +174,8 @@ final class Whitespace extends TopLevelElement {
|
||||
* De-tokenize the elements listed in the 'elements' attribute and
|
||||
* instanciate a set of strip/preserve rules.
|
||||
*/
|
||||
public Vector getRules() {
|
||||
final Vector rules = new Vector();
|
||||
public List<WhitespaceRule> getRules() {
|
||||
final List<WhitespaceRule> rules = new ArrayList<>();
|
||||
// Go through each element and instanciate strip/preserve-object
|
||||
final StringTokenizer list = new StringTokenizer(_elementList);
|
||||
while (list.hasMoreElements()) {
|
||||
@ -191,35 +191,33 @@ final class Whitespace extends TopLevelElement {
|
||||
* Scans through the rules vector and looks for a rule of higher
|
||||
* priority that contradicts the current rule.
|
||||
*/
|
||||
private static WhitespaceRule findContradictingRule(Vector rules,
|
||||
private static WhitespaceRule findContradictingRule(List<WhitespaceRule> rules,
|
||||
WhitespaceRule rule) {
|
||||
for (int i = 0; i < rules.size(); i++) {
|
||||
// Get the next rule in the prioritized list
|
||||
WhitespaceRule currentRule = (WhitespaceRule)rules.elementAt(i);
|
||||
for (WhitespaceRule currentRule : rules) {
|
||||
// We only consider rules with higher priority
|
||||
if (currentRule == rule) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if there is a contradicting rule with higher priority.
|
||||
* If the rules has the same action then this rule is redundant,
|
||||
* if they have different action then this rule will never win.
|
||||
*/
|
||||
* See if there is a contradicting rule with higher priority.
|
||||
* If the rules has the same action then this rule is redundant,
|
||||
* if they have different action then this rule will never win.
|
||||
*/
|
||||
switch (currentRule.getStrength()) {
|
||||
case RULE_ALL:
|
||||
return currentRule;
|
||||
|
||||
case RULE_ELEMENT:
|
||||
if (!rule.getElement().equals(currentRule.getElement())) {
|
||||
break;
|
||||
}
|
||||
// intentional fall-through
|
||||
case RULE_NAMESPACE:
|
||||
if (rule.getNamespace().equals(currentRule.getNamespace())) {
|
||||
case RULE_ALL:
|
||||
return currentRule;
|
||||
}
|
||||
break;
|
||||
|
||||
case RULE_ELEMENT:
|
||||
if (!rule.getElement().equals(currentRule.getElement())) {
|
||||
break;
|
||||
}
|
||||
// intentional fall-through
|
||||
case RULE_NAMESPACE:
|
||||
if (rule.getNamespace().equals(currentRule.getNamespace())) {
|
||||
return currentRule;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -230,7 +228,7 @@ final class Whitespace extends TopLevelElement {
|
||||
* Orders a set or rules by priority, removes redundant rules and rules
|
||||
* that are shadowed by stronger, contradicting rules.
|
||||
*/
|
||||
private static int prioritizeRules(Vector rules) {
|
||||
private static int prioritizeRules(List<WhitespaceRule> rules) {
|
||||
WhitespaceRule currentRule;
|
||||
int defaultAction = PRESERVE_SPACE;
|
||||
|
||||
@ -242,20 +240,20 @@ final class Whitespace extends TopLevelElement {
|
||||
// elements and signal that all whitespaces should be preserved
|
||||
boolean strip = false;
|
||||
for (int i = 0; i < rules.size(); i++) {
|
||||
currentRule = (WhitespaceRule)rules.elementAt(i);
|
||||
currentRule = rules.get(i);
|
||||
if (currentRule.getAction() == STRIP_SPACE) {
|
||||
strip = true;
|
||||
}
|
||||
}
|
||||
// Return with default action: PRESERVE_SPACE
|
||||
if (!strip) {
|
||||
rules.removeAllElements();
|
||||
rules.clear();
|
||||
return PRESERVE_SPACE;
|
||||
}
|
||||
|
||||
// Remove all rules that are contradicted by rules with higher priority
|
||||
for (int idx = 0; idx < rules.size(); ) {
|
||||
currentRule = (WhitespaceRule)rules.elementAt(idx);
|
||||
currentRule = rules.get(idx);
|
||||
|
||||
// Remove this single rule if it has no purpose
|
||||
if (findContradictingRule(rules,currentRule) != null) {
|
||||
@ -266,7 +264,7 @@ final class Whitespace extends TopLevelElement {
|
||||
if (currentRule.getStrength() == RULE_ALL) {
|
||||
defaultAction = currentRule.getAction();
|
||||
for (int i = idx; i < rules.size(); i++) {
|
||||
rules.removeElementAt(i);
|
||||
rules.remove(i);
|
||||
}
|
||||
}
|
||||
// Skip to next rule (there might not be any)...
|
||||
@ -275,16 +273,16 @@ final class Whitespace extends TopLevelElement {
|
||||
}
|
||||
|
||||
// The rules vector could be empty if first rule has strength RULE_ALL
|
||||
if (rules.size() == 0) {
|
||||
if (rules.isEmpty()) {
|
||||
return defaultAction;
|
||||
}
|
||||
|
||||
// Now work backwards and strip away all rules that have the same
|
||||
// action as the default rule (no reason the check them at the end).
|
||||
do {
|
||||
currentRule = (WhitespaceRule)rules.lastElement();
|
||||
currentRule = rules.get(rules.size() - 1);
|
||||
if (currentRule.getAction() == defaultAction) {
|
||||
rules.removeElementAt(rules.size() - 1);
|
||||
rules.remove(rules.size() - 1);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
@ -330,7 +328,7 @@ final class Whitespace extends TopLevelElement {
|
||||
/**
|
||||
* Compiles the predicate method
|
||||
*/
|
||||
private static void compilePredicate(Vector rules,
|
||||
private static void compilePredicate(List<WhitespaceRule> rules,
|
||||
int defaultAction,
|
||||
ClassGenerator classGen) {
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
@ -363,7 +361,7 @@ final class Whitespace extends TopLevelElement {
|
||||
// Traverse all strip/preserve rules
|
||||
for (int i = 0; i<rules.size(); i++) {
|
||||
// Get the next rule in the prioritised list
|
||||
WhitespaceRule rule = (WhitespaceRule)rules.elementAt(i);
|
||||
WhitespaceRule rule = rules.get(i);
|
||||
|
||||
// Returns the namespace for a node in the DOM
|
||||
final int gns = cpg.addInterfaceMethodref(DOM_INTF,
|
||||
@ -467,7 +465,7 @@ final class Whitespace extends TopLevelElement {
|
||||
* - STRIP_SPACE (always strip whitespace text-nodes)
|
||||
* - PRESERVE_SPACE (always preserve whitespace text-nodes)
|
||||
*/
|
||||
public static int translateRules(Vector rules,
|
||||
public static int translateRules(List<WhitespaceRule> rules,
|
||||
ClassGenerator classGen) {
|
||||
// Get the core rules in prioritized order
|
||||
final int defaultAction = prioritizeRules(rules);
|
||||
@ -485,7 +483,7 @@ final class Whitespace extends TopLevelElement {
|
||||
/**
|
||||
* Sorts a range of rules with regard to PRIORITY only
|
||||
*/
|
||||
private static void quicksort(Vector rules, int p, int r) {
|
||||
private static void quicksort(List<WhitespaceRule> rules, int p, int r) {
|
||||
while (p < r) {
|
||||
final int q = partition(rules, p, r);
|
||||
quicksort(rules, p, q);
|
||||
@ -496,18 +494,18 @@ final class Whitespace extends TopLevelElement {
|
||||
/**
|
||||
* Used with quicksort method above
|
||||
*/
|
||||
private static int partition(Vector rules, int p, int r) {
|
||||
final WhitespaceRule x = (WhitespaceRule)rules.elementAt((p+r) >>> 1);
|
||||
private static int partition(List<WhitespaceRule> rules, int p, int r) {
|
||||
final WhitespaceRule x = rules.get((p+r) >>> 1);
|
||||
int i = p - 1, j = r + 1;
|
||||
while (true) {
|
||||
while (x.compareTo((WhitespaceRule)rules.elementAt(--j)) < 0) {
|
||||
while (x.compareTo(rules.get(--j)) < 0) {
|
||||
}
|
||||
while (x.compareTo((WhitespaceRule)rules.elementAt(++i)) > 0) {
|
||||
while (x.compareTo(rules.get(++i)) > 0) {
|
||||
}
|
||||
if (i < j) {
|
||||
final WhitespaceRule tmp = (WhitespaceRule)rules.elementAt(i);
|
||||
rules.setElementAt(rules.elementAt(j), i);
|
||||
rules.setElementAt(tmp, j);
|
||||
final WhitespaceRule tmp = rules.get(i);
|
||||
rules.set(i, rules.get(j));
|
||||
rules.set(j, tmp);
|
||||
}
|
||||
else {
|
||||
return j;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Sep 2017
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -36,12 +36,11 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.Vector;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarOutputStream;
|
||||
@ -87,19 +86,19 @@ public final class XSLTC {
|
||||
|
||||
// Name index tables
|
||||
private int _nextGType; // Next available element type
|
||||
private Vector _namesIndex; // Index of all registered QNames
|
||||
private List<String> _namesIndex; // Index of all registered QNames
|
||||
private Map<String, Integer> _elements; // Map of all registered elements
|
||||
private Map<String, Integer> _attributes; // Map of all registered attributes
|
||||
|
||||
// Namespace index tables
|
||||
private int _nextNSType; // Next available namespace type
|
||||
private Vector _namespaceIndex; // Index of all registered namespaces
|
||||
private List<String> _namespaceIndex; // Index of all registered namespaces
|
||||
private Map<String, Integer> _namespaces; // Map of all registered namespaces
|
||||
private Map<String, Integer> _namespacePrefixes;// Map of all registered namespace prefixes
|
||||
|
||||
|
||||
// All literal text in the stylesheet
|
||||
private ArrayList<StringBuilder> m_characterData;
|
||||
private List<StringBuilder> m_characterData;
|
||||
|
||||
// These define the various methods for outputting the translet
|
||||
public static final int JAR_OUTPUT = 1;
|
||||
@ -117,8 +116,8 @@ public final class XSLTC {
|
||||
private File _destDir = null; // -d <directory-name>
|
||||
private int _outputType = BYTEARRAY_OUTPUT; // by default
|
||||
|
||||
private ArrayList<ByteArrayOutputStream> _classes;
|
||||
private ArrayList<JavaClass> _bcelClasses;
|
||||
private List<ByteArrayOutputStream> _classes;
|
||||
private List<JavaClass> _bcelClasses;
|
||||
private boolean _callsNodeset = false;
|
||||
private boolean _multiDocument = false;
|
||||
private boolean _hasIdCall = false;
|
||||
@ -309,8 +308,8 @@ public final class XSLTC {
|
||||
* The filtering of function types (external,internal) takes place in FunctionCall class
|
||||
*
|
||||
*/
|
||||
Class loadExternalFunction(String name) throws ClassNotFoundException {
|
||||
Class loaded = null;
|
||||
Class<?> loadExternalFunction(String name) throws ClassNotFoundException {
|
||||
Class<?> loaded = null;
|
||||
//Check if the function is not loaded already
|
||||
if (_externalExtensionFunctions.containsKey(name)) {
|
||||
loaded = _externalExtensionFunctions.get(name);
|
||||
@ -322,7 +321,7 @@ public final class XSLTC {
|
||||
throw new ClassNotFoundException(name);
|
||||
}
|
||||
//Return loaded class
|
||||
return (Class) loaded;
|
||||
return loaded;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -342,8 +341,8 @@ public final class XSLTC {
|
||||
_attributes = new HashMap<>();
|
||||
_namespaces = new HashMap<>();
|
||||
_namespaces.put("", _nextNSType);
|
||||
_namesIndex = new Vector(128);
|
||||
_namespaceIndex = new Vector(32);
|
||||
_namesIndex = new ArrayList<>(128);
|
||||
_namespaceIndex = new ArrayList<>(32);
|
||||
_namespacePrefixes = new HashMap<>();
|
||||
_stylesheet = null;
|
||||
_parser.init();
|
||||
@ -458,7 +457,7 @@ public final class XSLTC {
|
||||
*/
|
||||
public boolean compile(InputSource input, String name) {
|
||||
try {
|
||||
// Reset globals in case we're called by compile(Vector v);
|
||||
// Reset globals in case we're called by compile(ArrayList v);
|
||||
reset();
|
||||
|
||||
// The systemId may not be set, so we'll have to check the URL
|
||||
@ -531,11 +530,11 @@ public final class XSLTC {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a set of stylesheets pointed to by a Vector of URLs
|
||||
* @param stylesheets A Vector containing URLs pointing to the stylesheets
|
||||
* Compiles a set of stylesheets pointed to by a List of URLs
|
||||
* @param stylesheets A List containing URLs pointing to the stylesheets
|
||||
* @return 'true' if the compilation was successful
|
||||
*/
|
||||
public boolean compile(Vector stylesheets) {
|
||||
public boolean compile(List<URL> stylesheets) {
|
||||
// Get the number of stylesheets (ie. URLs) in the vector
|
||||
final int count = stylesheets.size();
|
||||
|
||||
@ -545,21 +544,13 @@ public final class XSLTC {
|
||||
// Special handling needed if the URL count is one, becuase the
|
||||
// _className global must not be reset if it was set explicitly
|
||||
if (count == 1) {
|
||||
final Object url = stylesheets.firstElement();
|
||||
if (url instanceof URL)
|
||||
return compile((URL)url);
|
||||
else
|
||||
return false;
|
||||
return compile(stylesheets.get(0));
|
||||
}
|
||||
else {
|
||||
// Traverse all elements in the vector and compile
|
||||
final Enumeration urls = stylesheets.elements();
|
||||
while (urls.hasMoreElements()) {
|
||||
for (URL url : stylesheets) {
|
||||
_className = null; // reset, so that new name will be computed
|
||||
final Object url = urls.nextElement();
|
||||
if (url instanceof URL) {
|
||||
if (!compile((URL)url)) return false;
|
||||
}
|
||||
if (!compile(url)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -623,7 +614,7 @@ public final class XSLTC {
|
||||
* Get a list of all compile error messages
|
||||
* @return A List containing all compile error messages
|
||||
*/
|
||||
public ArrayList<ErrorMsg> getErrors() {
|
||||
public List<ErrorMsg> getErrors() {
|
||||
return _parser.getErrors();
|
||||
}
|
||||
|
||||
@ -631,7 +622,7 @@ public final class XSLTC {
|
||||
* Get a list of all compile warning messages
|
||||
* @return A List containing all compile error messages
|
||||
*/
|
||||
public ArrayList<ErrorMsg> getWarnings() {
|
||||
public List<ErrorMsg> getWarnings() {
|
||||
return _parser.getWarnings();
|
||||
}
|
||||
|
||||
@ -685,7 +676,7 @@ public final class XSLTC {
|
||||
/**
|
||||
* Set the class name for the generated translet. This class name is
|
||||
* overridden if multiple stylesheets are compiled in one go using the
|
||||
* compile(Vector urls) method.
|
||||
* compile(List urls) method.
|
||||
* @param className The name to assign to the translet class
|
||||
*/
|
||||
public void setClassName(String className) {
|
||||
@ -791,9 +782,9 @@ public final class XSLTC {
|
||||
final String uri = name.getNamespace();
|
||||
final String local = "@"+name.getLocalPart();
|
||||
if ((uri != null) && (!uri.equals("")))
|
||||
_namesIndex.addElement(uri+":"+local);
|
||||
_namesIndex.add(uri+":"+local);
|
||||
else
|
||||
_namesIndex.addElement(local);
|
||||
_namesIndex.add(local);
|
||||
if (name.getLocalPart().equals("*")) {
|
||||
registerNamespace(name.getNamespace());
|
||||
}
|
||||
@ -810,7 +801,7 @@ public final class XSLTC {
|
||||
Integer code = _elements.get(name.toString());
|
||||
if (code == null) {
|
||||
_elements.put(name.toString(), code = _nextGType++);
|
||||
_namesIndex.addElement(name.toString());
|
||||
_namesIndex.add(name.toString());
|
||||
}
|
||||
if (name.getLocalPart().equals("*")) {
|
||||
registerNamespace(name.getNamespace());
|
||||
@ -832,9 +823,9 @@ public final class XSLTC {
|
||||
final String uri = name.getNamespace();
|
||||
if ((uri != null) && (!uri.equals(""))){
|
||||
// namespace::ext2:ped2 will be made empty in TypedNamespaceIterator
|
||||
_namesIndex.addElement("?");
|
||||
_namesIndex.add("?");
|
||||
} else{
|
||||
_namesIndex.addElement("?"+name.getLocalPart());
|
||||
_namesIndex.add("?"+name.getLocalPart());
|
||||
}
|
||||
}
|
||||
return code.intValue();
|
||||
@ -849,7 +840,7 @@ public final class XSLTC {
|
||||
if (code == null) {
|
||||
code = _nextNSType++;
|
||||
_namespaces.put(namespaceURI,code);
|
||||
_namespaceIndex.addElement(namespaceURI);
|
||||
_namespaceIndex.add(namespaceURI);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
@ -878,11 +869,11 @@ public final class XSLTC {
|
||||
return _attributeSetSerial++;
|
||||
}
|
||||
|
||||
public Vector getNamesIndex() {
|
||||
public List<String> getNamesIndex() {
|
||||
return _namesIndex;
|
||||
}
|
||||
|
||||
public Vector getNamespaceIndex() {
|
||||
public List<String> getNamespaceIndex() {
|
||||
return _namespaceIndex;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,8 +24,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
@ -40,7 +39,6 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
|
||||
|
||||
import com.sun.org.apache.xml.internal.serializer.ElemDesc;
|
||||
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
|
||||
import com.sun.org.apache.xml.internal.utils.XML11Char;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -149,7 +149,7 @@ public final class BooleanType extends Type {
|
||||
* Translates an internal boolean into an external (Java) boolean.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
if (clazz == java.lang.Boolean.TYPE) {
|
||||
methodGen.getInstructionList().append(NOP);
|
||||
}
|
||||
@ -168,7 +168,7 @@ public final class BooleanType extends Type {
|
||||
* Translates an external (Java) boolean into internal boolean.
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
translateTo(classGen, methodGen, clazz);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -188,7 +189,7 @@ public final class IntType extends NumberType {
|
||||
* type after coercion.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
if (clazz == Character.TYPE) {
|
||||
il.append(I2C);
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -23,14 +24,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
|
||||
import com.sun.org.apache.bcel.internal.Const;
|
||||
import com.sun.org.apache.bcel.internal.classfile.Field;
|
||||
import com.sun.org.apache.bcel.internal.classfile.Method;
|
||||
@ -46,23 +39,23 @@ import com.sun.org.apache.bcel.internal.generic.FSTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.GETFIELD;
|
||||
import com.sun.org.apache.bcel.internal.generic.GOTO;
|
||||
import com.sun.org.apache.bcel.internal.generic.ICONST;
|
||||
import com.sun.org.apache.bcel.internal.generic.IfInstruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.ILOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.IndexedInstruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.ISTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.IfInstruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.IndexedInstruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.Instruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionConst;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionTargeter;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableInstruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.LLOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.LSTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.LocalVariableInstruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.MethodGen;
|
||||
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUTFIELD;
|
||||
@ -70,9 +63,15 @@ import com.sun.org.apache.bcel.internal.generic.RET;
|
||||
import com.sun.org.apache.bcel.internal.generic.Select;
|
||||
import com.sun.org.apache.bcel.internal.generic.TargetLostException;
|
||||
import com.sun.org.apache.bcel.internal.generic.Type;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.Pattern;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -266,7 +265,7 @@ public class MethodGenerator extends MethodGen
|
||||
*/
|
||||
protected class LocalVariableRegistry {
|
||||
/**
|
||||
* <p>A <code>java.lang.ArrayList</code> of all
|
||||
* <p>A <code>java.lang.List</code> of all
|
||||
* {@link LocalVariableGen}s created for this method, indexed by the
|
||||
* slot number of the local variable. The JVM stack frame of local
|
||||
* variables is divided into "slots". A single slot can be used to
|
||||
@ -279,12 +278,12 @@ public class MethodGenerator extends MethodGen
|
||||
* registered for the same slot; and if none occurs, the entry will be
|
||||
* <code>null</code>.
|
||||
*/
|
||||
protected ArrayList _variables = new ArrayList();
|
||||
protected List<Object> _variables = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Maps a name to a {@link LocalVariableGen}
|
||||
*/
|
||||
protected HashMap _nameToLVGMap = new HashMap();
|
||||
protected Map<String, Object> _nameToLVGMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Registers a {@link org.apache.bcel.generic.LocalVariableGen}
|
||||
@ -298,6 +297,7 @@ public class MethodGenerator extends MethodGen
|
||||
* </ul></p>
|
||||
* @param lvg The variable to be registered
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void registerLocalVariable(LocalVariableGen lvg) {
|
||||
int slot = lvg.getIndex();
|
||||
|
||||
@ -320,12 +320,12 @@ public class MethodGenerator extends MethodGen
|
||||
Object localsInSlot = _variables.get(slot);
|
||||
if (localsInSlot != null) {
|
||||
if (localsInSlot instanceof LocalVariableGen) {
|
||||
ArrayList listOfLocalsInSlot = new ArrayList();
|
||||
listOfLocalsInSlot.add(localsInSlot);
|
||||
List<LocalVariableGen> listOfLocalsInSlot = new ArrayList<>();
|
||||
listOfLocalsInSlot.add((LocalVariableGen)localsInSlot);
|
||||
listOfLocalsInSlot.add(lvg);
|
||||
_variables.set(slot, listOfLocalsInSlot);
|
||||
} else {
|
||||
((ArrayList) localsInSlot).add(lvg);
|
||||
((List<LocalVariableGen>) localsInSlot).add(lvg);
|
||||
}
|
||||
} else {
|
||||
_variables.set(slot, lvg);
|
||||
@ -369,12 +369,11 @@ public class MethodGenerator extends MethodGen
|
||||
return lvg;
|
||||
}
|
||||
} else {
|
||||
ArrayList listOfLocalsInSlot = (ArrayList) localsInSlot;
|
||||
int size = listOfLocalsInSlot.size();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<LocalVariableGen> listOfLocalsInSlot =
|
||||
(List<LocalVariableGen>) localsInSlot;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
LocalVariableGen lvg =
|
||||
(LocalVariableGen)listOfLocalsInSlot.get(i);
|
||||
for (LocalVariableGen lvg : listOfLocalsInSlot) {
|
||||
if (offsetInLocalVariableGenRange(lvg, offset)) {
|
||||
return lvg;
|
||||
}
|
||||
@ -403,20 +402,21 @@ public class MethodGenerator extends MethodGen
|
||||
* {@link #removeByNameTracking(LocalVariableGen)}</P
|
||||
* @param lvg a <code>LocalVariableGen</code>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void registerByName(LocalVariableGen lvg) {
|
||||
Object duplicateNameEntry = _nameToLVGMap.get(lvg.getName());
|
||||
|
||||
if (duplicateNameEntry == null) {
|
||||
_nameToLVGMap.put(lvg.getName(), lvg);
|
||||
} else {
|
||||
ArrayList sameNameList;
|
||||
List<LocalVariableGen> sameNameList;
|
||||
|
||||
if (duplicateNameEntry instanceof ArrayList) {
|
||||
sameNameList = (ArrayList) duplicateNameEntry;
|
||||
sameNameList = (List<LocalVariableGen>)duplicateNameEntry;
|
||||
sameNameList.add(lvg);
|
||||
} else {
|
||||
sameNameList = new ArrayList();
|
||||
sameNameList.add(duplicateNameEntry);
|
||||
sameNameList = new ArrayList<>();
|
||||
sameNameList.add((LocalVariableGen)duplicateNameEntry);
|
||||
sameNameList.add(lvg);
|
||||
}
|
||||
|
||||
@ -431,11 +431,13 @@ public class MethodGenerator extends MethodGen
|
||||
* {@link #lookUpByName(String)}
|
||||
* @param lvg a <code>LocalVariableGen</code>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void removeByNameTracking(LocalVariableGen lvg) {
|
||||
Object duplicateNameEntry = _nameToLVGMap.get(lvg.getName());
|
||||
|
||||
if (duplicateNameEntry instanceof ArrayList) {
|
||||
ArrayList sameNameList = (ArrayList) duplicateNameEntry;
|
||||
List<LocalVariableGen> sameNameList =
|
||||
(List<LocalVariableGen>)duplicateNameEntry;
|
||||
for (int i = 0; i < sameNameList.size(); i++) {
|
||||
if (sameNameList.get(i) == lvg) {
|
||||
sameNameList.remove(i);
|
||||
@ -455,16 +457,18 @@ public class MethodGenerator extends MethodGen
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected LocalVariableGen lookUpByName(String name) {
|
||||
LocalVariableGen lvg = null;
|
||||
Object duplicateNameEntry = _nameToLVGMap.get(name);
|
||||
|
||||
if (duplicateNameEntry instanceof ArrayList) {
|
||||
ArrayList sameNameList = (ArrayList) duplicateNameEntry;
|
||||
List<LocalVariableGen> sameNameList =
|
||||
(List<LocalVariableGen>)duplicateNameEntry;
|
||||
|
||||
for (int i = 0; i < sameNameList.size(); i++) {
|
||||
lvg = (LocalVariableGen)sameNameList.get(i);
|
||||
if (lvg.getName() == name) {
|
||||
lvg = sameNameList.get(i);
|
||||
if (lvg.getName() == null ? name == null : lvg.getName().equals(name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -489,9 +493,10 @@ public class MethodGenerator extends MethodGen
|
||||
* @return an array of <code>LocalVariableGen</code> containing all the
|
||||
* local variables
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected LocalVariableGen[] getLocals(boolean includeRemoved) {
|
||||
LocalVariableGen[] locals = null;
|
||||
ArrayList allVarsEverDeclared = new ArrayList();
|
||||
List<LocalVariableGen> allVarsEverDeclared = new ArrayList<>();
|
||||
|
||||
if (includeRemoved) {
|
||||
int slotCount = allVarsEverDeclared.size();
|
||||
@ -500,31 +505,29 @@ public class MethodGenerator extends MethodGen
|
||||
Object slotEntries = _variables.get(i);
|
||||
if (slotEntries != null) {
|
||||
if (slotEntries instanceof ArrayList) {
|
||||
ArrayList slotList = (ArrayList) slotEntries;
|
||||
List<LocalVariableGen> slotList =
|
||||
(List<LocalVariableGen>)slotEntries;
|
||||
|
||||
for (int j = 0; j < slotList.size(); j++) {
|
||||
allVarsEverDeclared.add(slotList.get(i));
|
||||
}
|
||||
} else {
|
||||
allVarsEverDeclared.add(slotEntries);
|
||||
allVarsEverDeclared.add((LocalVariableGen)slotEntries);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Iterator nameVarsPairsIter = _nameToLVGMap.entrySet().iterator();
|
||||
|
||||
while (nameVarsPairsIter.hasNext()) {
|
||||
Map.Entry nameVarsPair =
|
||||
(Map.Entry) nameVarsPairsIter.next();
|
||||
for (Map.Entry<String, Object> nameVarsPair : _nameToLVGMap.entrySet()) {
|
||||
Object vars = nameVarsPair.getValue();
|
||||
if (vars != null) {
|
||||
if (vars instanceof ArrayList) {
|
||||
ArrayList varsList = (ArrayList) vars;
|
||||
List<LocalVariableGen> varsList =
|
||||
(List<LocalVariableGen>) vars;
|
||||
for (int i = 0; i < varsList.size(); i++) {
|
||||
allVarsEverDeclared.add(varsList.get(i));
|
||||
}
|
||||
} else {
|
||||
allVarsEverDeclared.add(vars);
|
||||
allVarsEverDeclared.add((LocalVariableGen)vars);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -720,7 +723,7 @@ public class MethodGenerator extends MethodGen
|
||||
* current method. See {@link OutlineableChunkStart} and
|
||||
* {@link OutlineableChunkEnd} for more information.
|
||||
*/
|
||||
private class Chunk implements Comparable {
|
||||
private class Chunk implements Comparable<Object> {
|
||||
/**
|
||||
* {@link InstructionHandle} of the first instruction in the outlineable
|
||||
* chunk.
|
||||
@ -821,15 +824,15 @@ public class MethodGenerator extends MethodGen
|
||||
* @param classGen The {@link ClassGen} with which the generated methods
|
||||
* will be associated
|
||||
* @param totalMethodSize the size of the bytecode in the original method
|
||||
* @return a <code>java.util.ArrayList</code> containing the
|
||||
* @return a <code>java.util.List</code> containing the
|
||||
* {@link MethodGenerator.Chunk}s that may be outlined from this method
|
||||
*/
|
||||
private ArrayList getCandidateChunks(ClassGenerator classGen,
|
||||
private List<Chunk> getCandidateChunks(ClassGenerator classGen,
|
||||
int totalMethodSize) {
|
||||
Iterator instructions = getInstructionList().iterator();
|
||||
ArrayList candidateChunks = new ArrayList();
|
||||
ArrayList currLevelChunks = new ArrayList();
|
||||
Stack subChunkStack = new Stack();
|
||||
Iterator<InstructionHandle> instructions = getInstructionList().iterator();
|
||||
List<Chunk> candidateChunks = new ArrayList<>();
|
||||
List<InstructionHandle> currLevelChunks = new ArrayList<>();
|
||||
Stack<List<InstructionHandle>> subChunkStack = new Stack<>();
|
||||
boolean openChunkAtCurrLevel = false;
|
||||
boolean firstInstruction = true;
|
||||
|
||||
@ -884,7 +887,7 @@ public class MethodGenerator extends MethodGen
|
||||
// from the outer level onto the stack
|
||||
if (openChunkAtCurrLevel) {
|
||||
subChunkStack.push(currLevelChunks);
|
||||
currLevelChunks = new ArrayList();
|
||||
currLevelChunks = new ArrayList<>();
|
||||
}
|
||||
|
||||
openChunkAtCurrLevel = true;
|
||||
@ -892,7 +895,7 @@ public class MethodGenerator extends MethodGen
|
||||
// Close off an open chunk
|
||||
} else if (currentHandle == null
|
||||
|| inst instanceof OutlineableChunkEnd) {
|
||||
ArrayList nestedSubChunks = null;
|
||||
List<InstructionHandle> nestedSubChunks = null;
|
||||
|
||||
// If the last MarkerInstruction encountered was an
|
||||
// OutlineableChunkEnd, it means that the current instruction
|
||||
@ -901,7 +904,7 @@ public class MethodGenerator extends MethodGen
|
||||
// are better candidates for outlining than the current chunk.
|
||||
if (!openChunkAtCurrLevel) {
|
||||
nestedSubChunks = currLevelChunks;
|
||||
currLevelChunks = (ArrayList)subChunkStack.pop();
|
||||
currLevelChunks = (List<InstructionHandle>)subChunkStack.pop();
|
||||
}
|
||||
|
||||
// Get the handle for the start of this chunk (the last entry
|
||||
@ -948,14 +951,12 @@ public class MethodGenerator extends MethodGen
|
||||
}
|
||||
|
||||
// Merge adjacent siblings
|
||||
ArrayList mergedChildChunks =
|
||||
List<Chunk> mergedChildChunks =
|
||||
mergeAdjacentChunks(childChunks);
|
||||
|
||||
// Add chunks that mean minimum size requirements
|
||||
// to the list of candidate chunks for outlining
|
||||
for (int i = 0; i < mergedChildChunks.size(); i++) {
|
||||
Chunk mergedChunk =
|
||||
(Chunk)mergedChildChunks.get(i);
|
||||
for (Chunk mergedChunk : mergedChildChunks) {
|
||||
int mergedSize = mergedChunk.getChunkSize();
|
||||
|
||||
if (mergedSize >= MINIMUM_OUTLINEABLE_CHUNK_SIZE
|
||||
@ -987,10 +988,10 @@ public class MethodGenerator extends MethodGen
|
||||
* @param chunks array of sibling {@link MethodGenerator.Chunk}s that are
|
||||
* under consideration for outlining. Chunks must be in
|
||||
* the order encountered in the {@link InstructionList}
|
||||
* @return a <code>java.util.ArrayList</code> of
|
||||
* @return a <code>java.util.List</code> of
|
||||
* <code>MethodGenerator.Chunk</code>s maximally merged
|
||||
*/
|
||||
private ArrayList mergeAdjacentChunks(Chunk[] chunks) {
|
||||
private List<Chunk> mergeAdjacentChunks(Chunk[] chunks) {
|
||||
int[] adjacencyRunStart = new int[chunks.length];
|
||||
int[] adjacencyRunLength = new int[chunks.length];
|
||||
boolean[] chunkWasMerged = new boolean[chunks.length];
|
||||
@ -999,7 +1000,7 @@ public class MethodGenerator extends MethodGen
|
||||
int startOfCurrentRun;
|
||||
int numAdjacentRuns = 0;
|
||||
|
||||
ArrayList mergedChunks = new ArrayList();
|
||||
List<Chunk> mergedChunks = new ArrayList<>();
|
||||
|
||||
startOfCurrentRun = 0;
|
||||
|
||||
@ -1133,7 +1134,7 @@ public class MethodGenerator extends MethodGen
|
||||
*/
|
||||
public Method[] outlineChunks(ClassGenerator classGen,
|
||||
int originalMethodSize) {
|
||||
ArrayList methodsOutlined = new ArrayList();
|
||||
List<Method> methodsOutlined = new ArrayList<>();
|
||||
int currentMethodSize = originalMethodSize;
|
||||
|
||||
int outlinedCount = 0;
|
||||
@ -1154,7 +1155,7 @@ public class MethodGenerator extends MethodGen
|
||||
do {
|
||||
// Get all the best candidates for outlining, and sort them in
|
||||
// ascending order of size
|
||||
ArrayList candidateChunks = getCandidateChunks(classGen,
|
||||
List<Chunk> candidateChunks = getCandidateChunks(classGen,
|
||||
currentMethodSize);
|
||||
Collections.sort(candidateChunks);
|
||||
|
||||
@ -1352,14 +1353,14 @@ public class MethodGenerator extends MethodGen
|
||||
// method to instruction handles in the outlined method. Only need
|
||||
// to track instructions that are targeted by something else in the
|
||||
// generated BCEL
|
||||
HashMap targetMap = new HashMap();
|
||||
HashMap<InstructionHandle, InstructionHandle> targetMap = new HashMap<>();
|
||||
|
||||
// Keeps track of the mapping from local variables in the old method
|
||||
// to local variables in the outlined method.
|
||||
HashMap localVarMap = new HashMap();
|
||||
HashMap<LocalVariableGen, LocalVariableGen> localVarMap = new HashMap<>();
|
||||
|
||||
HashMap revisedLocalVarStart = new HashMap();
|
||||
HashMap revisedLocalVarEnd = new HashMap();
|
||||
HashMap<LocalVariableGen, InstructionHandle> revisedLocalVarStart = new HashMap<>();
|
||||
HashMap<LocalVariableGen, InstructionHandle> revisedLocalVarEnd = new HashMap<>();
|
||||
|
||||
// Pass 1: Make copies of all instructions, append them to the new list
|
||||
// and associate old instruction references with the new ones, i.e.,
|
||||
@ -1415,8 +1416,7 @@ public class MethodGenerator extends MethodGen
|
||||
getLocalVariableRegistry()
|
||||
.lookupRegisteredLocalVariable(oldLocalVarIndex,
|
||||
ih.getPosition());
|
||||
LocalVariableGen newLVG =
|
||||
(LocalVariableGen)localVarMap.get(oldLVG);
|
||||
LocalVariableGen newLVG = localVarMap.get(oldLVG);
|
||||
|
||||
// Has the code already mapped this local variable to a
|
||||
// local in the new method?
|
||||
@ -1574,8 +1574,7 @@ public class MethodGenerator extends MethodGen
|
||||
InstructionHandle itarget = bi.getTarget(); // old target
|
||||
|
||||
// New target must be in targetMap
|
||||
InstructionHandle newTarget =
|
||||
(InstructionHandle)targetMap.get(itarget);
|
||||
InstructionHandle newTarget = targetMap.get(itarget);
|
||||
|
||||
bc.setTarget(newTarget);
|
||||
|
||||
@ -1587,8 +1586,7 @@ public class MethodGenerator extends MethodGen
|
||||
|
||||
// Update all targets
|
||||
for (int j=0; j < itargets.length; j++) {
|
||||
ctargets[j] =
|
||||
(InstructionHandle)targetMap.get(itargets[j]);
|
||||
ctargets[j] = targetMap.get(itargets[j]);
|
||||
}
|
||||
}
|
||||
} else if (i instanceof LocalVariableInstruction
|
||||
@ -1602,8 +1600,7 @@ public class MethodGenerator extends MethodGen
|
||||
getLocalVariableRegistry()
|
||||
.lookupRegisteredLocalVariable(oldLocalVarIndex,
|
||||
ih.getPosition());
|
||||
LocalVariableGen newLVG =
|
||||
(LocalVariableGen)localVarMap.get(oldLVG);
|
||||
LocalVariableGen newLVG = localVarMap.get(oldLVG);
|
||||
int newLocalVarIndex;
|
||||
|
||||
if (newLVG == null) {
|
||||
@ -1645,10 +1642,9 @@ public class MethodGenerator extends MethodGen
|
||||
|
||||
if (targeter instanceof LocalVariableGen
|
||||
&& ((LocalVariableGen)targeter).getEnd()==ih) {
|
||||
Object newLVG = localVarMap.get(targeter);
|
||||
LocalVariableGen newLVG = localVarMap.get(targeter);
|
||||
if (newLVG != null) {
|
||||
outlinedMethodGen.removeLocalVariable(
|
||||
(LocalVariableGen)newLVG);
|
||||
outlinedMethodGen.removeLocalVariable(newLVG);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1667,29 +1663,18 @@ public class MethodGenerator extends MethodGen
|
||||
// POP the reference to the CopyLocals object from the stack
|
||||
oldMethCopyOutIL.append(InstructionConst.POP);
|
||||
|
||||
// Now that the generation of the outlined code is complete, update
|
||||
// the old local variables with new start and end ranges, as required.
|
||||
Iterator revisedLocalVarStartPairIter = revisedLocalVarStart.entrySet()
|
||||
.iterator();
|
||||
while (revisedLocalVarStartPairIter.hasNext()) {
|
||||
Map.Entry lvgRangeStartPair =
|
||||
(Map.Entry)revisedLocalVarStartPairIter.next();
|
||||
LocalVariableGen lvg = (LocalVariableGen)lvgRangeStartPair.getKey();
|
||||
InstructionHandle startInst =
|
||||
(InstructionHandle)lvgRangeStartPair.getValue();
|
||||
for (Map.Entry<LocalVariableGen, InstructionHandle> lvgRangeStartPair :
|
||||
revisedLocalVarStart.entrySet()) {
|
||||
LocalVariableGen lvg = lvgRangeStartPair.getKey();
|
||||
InstructionHandle startInst = lvgRangeStartPair.getValue();
|
||||
|
||||
lvg.setStart(startInst);
|
||||
|
||||
}
|
||||
|
||||
Iterator revisedLocalVarEndPairIter = revisedLocalVarEnd.entrySet()
|
||||
.iterator();
|
||||
while (revisedLocalVarEndPairIter.hasNext()) {
|
||||
Map.Entry lvgRangeEndPair =
|
||||
(Map.Entry)revisedLocalVarEndPairIter.next();
|
||||
LocalVariableGen lvg = (LocalVariableGen)lvgRangeEndPair.getKey();
|
||||
InstructionHandle endInst =
|
||||
(InstructionHandle)lvgRangeEndPair.getValue();
|
||||
for (Map.Entry<LocalVariableGen, InstructionHandle> lvgRangeEndPair :
|
||||
revisedLocalVarEnd.entrySet()) {
|
||||
LocalVariableGen lvg = lvgRangeEndPair.getKey();
|
||||
InstructionHandle endInst = lvgRangeEndPair.getValue();
|
||||
|
||||
lvg.setEnd(endInst);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,7 +21,8 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -29,7 +30,7 @@ import java.util.Vector;
|
||||
*/
|
||||
public final class MethodType extends Type {
|
||||
private final Type _resultType;
|
||||
private final Vector _argsType;
|
||||
private final List<Type> _argsType;
|
||||
|
||||
public MethodType(Type resultType) {
|
||||
_argsType = null;
|
||||
@ -38,8 +39,8 @@ public final class MethodType extends Type {
|
||||
|
||||
public MethodType(Type resultType, Type arg1) {
|
||||
if (arg1 != Type.Void) {
|
||||
_argsType = new Vector();
|
||||
_argsType.addElement(arg1);
|
||||
_argsType = new ArrayList<>();
|
||||
_argsType.add(arg1);
|
||||
}
|
||||
else {
|
||||
_argsType = null;
|
||||
@ -48,21 +49,21 @@ public final class MethodType extends Type {
|
||||
}
|
||||
|
||||
public MethodType(Type resultType, Type arg1, Type arg2) {
|
||||
_argsType = new Vector(2);
|
||||
_argsType.addElement(arg1);
|
||||
_argsType.addElement(arg2);
|
||||
_argsType = new ArrayList<>(2);
|
||||
_argsType.add(arg1);
|
||||
_argsType.add(arg2);
|
||||
_resultType = resultType;
|
||||
}
|
||||
|
||||
public MethodType(Type resultType, Type arg1, Type arg2, Type arg3) {
|
||||
_argsType = new Vector(3);
|
||||
_argsType.addElement(arg1);
|
||||
_argsType.addElement(arg2);
|
||||
_argsType.addElement(arg3);
|
||||
_argsType = new ArrayList<>(3);
|
||||
_argsType.add(arg1);
|
||||
_argsType.add(arg2);
|
||||
_argsType.add(arg3);
|
||||
_resultType = resultType;
|
||||
}
|
||||
|
||||
public MethodType(Type resultType, Vector argsType) {
|
||||
public MethodType(Type resultType, List<Type> argsType) {
|
||||
_resultType = resultType;
|
||||
_argsType = argsType.size() > 0 ? argsType : null;
|
||||
}
|
||||
@ -72,7 +73,7 @@ public final class MethodType extends Type {
|
||||
if (_argsType != null) {
|
||||
final int count = _argsType.size();
|
||||
for (int i=0; i<count; i++) {
|
||||
result.append(_argsType.elementAt(i));
|
||||
result.append(_argsType.get(i));
|
||||
if (i != (count-1)) result.append(',');
|
||||
}
|
||||
}
|
||||
@ -97,7 +98,7 @@ public final class MethodType extends Type {
|
||||
if (_argsType != null) {
|
||||
final int n = _argsType.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
buffer.append(((Type)_argsType.elementAt(i)).toSignature());
|
||||
buffer.append((_argsType.get(i)).toSignature());
|
||||
}
|
||||
}
|
||||
return buffer
|
||||
@ -119,8 +120,8 @@ public final class MethodType extends Type {
|
||||
final int len = argsCount();
|
||||
result = len == temp.argsCount();
|
||||
for (int i = 0; i < len && result; i++) {
|
||||
final Type arg1 = (Type)_argsType.elementAt(i);
|
||||
final Type arg2 = (Type)temp._argsType.elementAt(i);
|
||||
final Type arg1 = _argsType.get(i);
|
||||
final Type arg2 = temp._argsType.get(i);
|
||||
result = arg1.identicalTo(arg2);
|
||||
}
|
||||
}
|
||||
@ -137,8 +138,8 @@ public final class MethodType extends Type {
|
||||
if (len == mtype._argsType.size()) {
|
||||
result = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
Type arg1 = (Type) _argsType.elementAt(i);
|
||||
Type arg2 = (Type) mtype._argsType.elementAt(i);
|
||||
Type arg1 = _argsType.get(i);
|
||||
Type arg2 = mtype._argsType.get(i);
|
||||
final int temp = arg1.distanceTo(arg2);
|
||||
if (temp == Integer.MAX_VALUE) {
|
||||
result = temp; // return MAX_VALUE
|
||||
@ -161,7 +162,7 @@ public final class MethodType extends Type {
|
||||
return _resultType;
|
||||
}
|
||||
|
||||
public Vector argsType() {
|
||||
public List<Type> argsType() {
|
||||
return _argsType;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -98,7 +98,7 @@ public final class NodeSetType extends Type {
|
||||
* Expects the Java object on the stack, pushes the internal type
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen,
|
||||
MethodGenerator methodGen, Class clazz)
|
||||
MethodGenerator methodGen, Class<?> clazz)
|
||||
{
|
||||
|
||||
InstructionList il = methodGen.getInstructionList();
|
||||
@ -242,7 +242,7 @@ public final class NodeSetType extends Type {
|
||||
* type after coercion.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
final String className = clazz.getName();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -251,7 +251,7 @@ public final class NodeType extends Type {
|
||||
* type after coercion.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -31,8 +31,8 @@ import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
|
||||
import com.sun.org.apache.bcel.internal.generic.Instruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
|
||||
|
||||
/**
|
||||
* @author Todd Miller
|
||||
@ -41,7 +41,7 @@ import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
public final class ObjectType extends Type {
|
||||
|
||||
private String _javaClassName = "java.lang.Object";
|
||||
private Class _clazz = java.lang.Object.class;
|
||||
private Class<?> _clazz = java.lang.Object.class;
|
||||
|
||||
/**
|
||||
* Used to represent a Java Class type such is required to support
|
||||
@ -59,7 +59,7 @@ public final class ObjectType extends Type {
|
||||
}
|
||||
}
|
||||
|
||||
protected ObjectType(Class clazz) {
|
||||
protected ObjectType(Class<?> clazz) {
|
||||
_clazz = clazz;
|
||||
_javaClassName = clazz.getName();
|
||||
}
|
||||
@ -80,7 +80,7 @@ public final class ObjectType extends Type {
|
||||
return _javaClassName;
|
||||
}
|
||||
|
||||
public Class getJavaClass() {
|
||||
public Class<?> getJavaClass() {
|
||||
return _clazz;
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ public final class ObjectType extends Type {
|
||||
* when external functions are called.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
if (clazz.isAssignableFrom(_clazz))
|
||||
methodGen.getInstructionList().append(NOP);
|
||||
else {
|
||||
@ -163,7 +163,7 @@ public final class ObjectType extends Type {
|
||||
* Translates an external Java type into an Object type
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen,
|
||||
MethodGenerator methodGen, Class clazz) {
|
||||
MethodGenerator methodGen, Class<?> clazz) {
|
||||
methodGen.getInstructionList().append(NOP);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -208,7 +209,7 @@ public final class RealType extends NumberType {
|
||||
* type after coercion.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
final Class clazz) {
|
||||
final Class<?> clazz) {
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
if (clazz == Character.TYPE) {
|
||||
il.append(D2I);
|
||||
@ -250,7 +251,7 @@ public final class RealType extends NumberType {
|
||||
* object on the stack and pushes a real (i.e., a double).
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
InstructionList il = methodGen.getInstructionList();
|
||||
|
||||
if (clazz == Character.TYPE || clazz == Byte.TYPE ||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,7 +21,6 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.compiler.util;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
import com.sun.org.apache.bcel.internal.generic.ALOAD;
|
||||
import com.sun.org.apache.bcel.internal.generic.ASTORE;
|
||||
import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
|
||||
@ -31,10 +30,9 @@ import com.sun.org.apache.bcel.internal.generic.INVOKEINTERFACE;
|
||||
import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
|
||||
import com.sun.org.apache.bcel.internal.generic.Instruction;
|
||||
import com.sun.org.apache.bcel.internal.generic.InstructionList;
|
||||
|
||||
import com.sun.org.apache.bcel.internal.generic.PUSH;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.Constants;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.FlowList;
|
||||
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
|
||||
/**
|
||||
@ -224,7 +222,7 @@ public final class ReferenceType extends Type {
|
||||
* Translates a reference into the Java type denoted by <code>clazz</code>.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
|
||||
@ -326,7 +324,7 @@ public final class ReferenceType extends Type {
|
||||
* allowed is from java.lang.Object.
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
if (clazz.getName().equals("java.lang.Object")) {
|
||||
methodGen.getInstructionList().append(NOP);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -398,7 +398,7 @@ public final class ResultTreeType extends Type {
|
||||
* @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateTo
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
final String className = clazz.getName();
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -27,17 +27,17 @@ import java.util.Stack;
|
||||
* @author Jacek Ambroziak
|
||||
* @author Santiago Pericas-Geertsen
|
||||
*/
|
||||
public final class StringStack extends Stack {
|
||||
public final class StringStack extends Stack<String> {
|
||||
static final long serialVersionUID = -1506910875640317898L;
|
||||
public String peekString() {
|
||||
return (String) super.peek();
|
||||
return super.peek();
|
||||
}
|
||||
|
||||
public String popString() {
|
||||
return (String) super.pop();
|
||||
return super.pop();
|
||||
}
|
||||
|
||||
public String pushString(String val) {
|
||||
return (String) super.push(val);
|
||||
return super.push(val);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -156,7 +156,7 @@ public class StringType extends Type {
|
||||
* @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz)
|
||||
Class<?> clazz)
|
||||
{
|
||||
// Is String <: clazz? I.e. clazz in { String, Object }
|
||||
if (clazz.isAssignableFrom(java.lang.String.class)) {
|
||||
@ -175,7 +175,7 @@ public class StringType extends Type {
|
||||
* @see com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type#translateFrom
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen,
|
||||
MethodGenerator methodGen, Class clazz)
|
||||
MethodGenerator methodGen, Class<?> clazz)
|
||||
{
|
||||
final ConstantPoolGen cpg = classGen.getConstantPool();
|
||||
final InstructionList il = methodGen.getInstructionList();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -76,7 +76,7 @@ public abstract class Type implements Constants {
|
||||
* Factory method to instantiate object types. Returns a pre-defined
|
||||
* instance for java.lang.Object.class and java.lang.String.class.
|
||||
*/
|
||||
public static Type newObjectType(Class clazz) {
|
||||
public static Type newObjectType(Class<?> clazz) {
|
||||
if (clazz == java.lang.Object.class) {
|
||||
return Type.Object;
|
||||
}
|
||||
@ -189,7 +189,7 @@ public abstract class Type implements Constants {
|
||||
* when external functions are called.
|
||||
*/
|
||||
public void translateTo(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
|
||||
toString(), clazz.getClass().toString());
|
||||
classGen.getParser().reportError(Constants.FATAL, err);
|
||||
@ -201,7 +201,7 @@ public abstract class Type implements Constants {
|
||||
* when external functions are called.
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
|
||||
clazz.getClass().toString(), toString());
|
||||
classGen.getParser().reportError(Constants.FATAL, err);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -88,7 +88,7 @@ public final class VoidType extends Type {
|
||||
* Only an external "void" can be converted to this class.
|
||||
*/
|
||||
public void translateFrom(ClassGenerator classGen, MethodGenerator methodGen,
|
||||
Class clazz) {
|
||||
Class<?> clazz) {
|
||||
if (!clazz.getName().equals("void")) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
|
||||
toString(), clazz.getName());
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -59,7 +60,7 @@ public class KeyIndex extends DTMAxisIteratorBase {
|
||||
/**
|
||||
* A mapping from a document node to the mapping between values and nodesets
|
||||
*/
|
||||
private Map<Integer, Map> _rootToIndexMap = new HashMap<>();
|
||||
private Map<Integer, Map<String, IntegerArray>> _rootToIndexMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The node set associated to the current value passed
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -21,12 +21,12 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.dom;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOM;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.Translet;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Jacek Ambroziak
|
||||
@ -52,8 +52,8 @@ public abstract class NodeCounter {
|
||||
|
||||
private boolean _separFirst = true;
|
||||
private boolean _separLast = false;
|
||||
private Vector _separToks = new Vector();
|
||||
private Vector _formatToks = new Vector();
|
||||
private List<String> _separToks = new ArrayList<>();
|
||||
private List<String> _formatToks = new ArrayList<>();
|
||||
private int _nSepars = 0;
|
||||
private int _nFormats = 0;
|
||||
|
||||
@ -204,10 +204,10 @@ public abstract class NodeCounter {
|
||||
}
|
||||
if (i > j) {
|
||||
if (isFirst) {
|
||||
_separToks.addElement(".");
|
||||
_separToks.add(".");
|
||||
isFirst = _separFirst = false;
|
||||
}
|
||||
_formatToks.addElement(format.substring(j, i));
|
||||
_formatToks.add(format.substring(j, i));
|
||||
}
|
||||
|
||||
if (i == length) break;
|
||||
@ -219,7 +219,7 @@ public abstract class NodeCounter {
|
||||
isFirst = false;
|
||||
}
|
||||
if (i > j) {
|
||||
_separToks.addElement(format.substring(j, i));
|
||||
_separToks.add(format.substring(j, i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ public abstract class NodeCounter {
|
||||
if (_separFirst) _nSepars--;
|
||||
if (_separLast) _nSepars--;
|
||||
if (_nSepars == 0) {
|
||||
_separToks.insertElementAt(".", 1);
|
||||
_separToks.add(1, ".");
|
||||
_nSepars++;
|
||||
}
|
||||
if (_separFirst) _nSepars ++;
|
||||
@ -305,14 +305,14 @@ public abstract class NodeCounter {
|
||||
final StringBuilder buffer = _tempBuffer;
|
||||
|
||||
// Append separation token before first digit/letter/numeral
|
||||
if (_separFirst) buffer.append((String)_separToks.elementAt(0));
|
||||
if (_separFirst) buffer.append(_separToks.get(0));
|
||||
|
||||
// Append next digit/letter/numeral and separation token
|
||||
while (n < nValues) {
|
||||
final int value = values[n];
|
||||
if (value != Integer.MIN_VALUE) {
|
||||
if (!isFirst) buffer.append((String) _separToks.elementAt(s++));
|
||||
formatValue(value, (String)_formatToks.elementAt(t++), buffer);
|
||||
if (!isFirst) buffer.append(_separToks.get(s++));
|
||||
formatValue(value, _formatToks.get(t++), buffer);
|
||||
if (t == _nFormats) t--;
|
||||
if (s >= _nSepars) s--;
|
||||
isFirst = false;
|
||||
@ -321,7 +321,7 @@ public abstract class NodeCounter {
|
||||
}
|
||||
|
||||
// Append separation token after last digit/letter/numeral
|
||||
if (_separLast) buffer.append((String)_separToks.lastElement());
|
||||
if (_separLast) buffer.append(_separToks.get(_separToks.size() - 1));
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Sep 2017
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -27,7 +27,6 @@ import com.sun.org.apache.xalan.internal.xsltc.DOM;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
|
||||
import com.sun.org.apache.xml.internal.utils.StringComparable;
|
||||
import java.text.CollationKey;
|
||||
import java.text.Collator;
|
||||
import java.util.Locale;
|
||||
import jdk.xml.internal.SecuritySupport;
|
||||
@ -157,6 +156,7 @@ public abstract class NodeSortRecord {
|
||||
* element. The value is extracted from the DOM if it is not already in
|
||||
* our sort key vector.
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private final Comparable stringValue(int level) {
|
||||
// Get value from our array if possible
|
||||
if (_scanned <= level) {
|
||||
@ -167,10 +167,8 @@ public abstract class NodeSortRecord {
|
||||
// Get value from DOM if accessed for the first time
|
||||
final String str = extractValueFromDOM(_dom, _node, level,
|
||||
translet, _last);
|
||||
final Comparable key =
|
||||
StringComparable.getComparator(str, locales[level],
|
||||
_collators[level],
|
||||
caseOrder[level]);
|
||||
final Comparable key = StringComparable.getComparator(
|
||||
str, locales[level], _collators[level], caseOrder[level]);
|
||||
_values[_scanned++] = key;
|
||||
return(key);
|
||||
}
|
||||
@ -206,6 +204,7 @@ public abstract class NodeSortRecord {
|
||||
*
|
||||
* !!!!MUST OPTIMISE - THIS IS REALLY, REALLY SLOW!!!!
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public int compareTo(NodeSortRecord other) {
|
||||
int cmp, level;
|
||||
int[] sortOrder = _settings.getSortOrders();
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -20,15 +21,15 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.dom;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.DOM;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.Translet;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.TransletException;
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
|
||||
import com.sun.org.apache.xml.internal.utils.LocaleUtility;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Locale;
|
||||
import java.text.Collator;
|
||||
import java.util.Locale;
|
||||
|
||||
public class NodeSortRecordFactory {
|
||||
|
||||
@ -37,7 +38,7 @@ public class NodeSortRecordFactory {
|
||||
|
||||
private final DOM _dom;
|
||||
private final String _className;
|
||||
private Class _class;
|
||||
private Class<?> _class;
|
||||
private SortSettings _sortSettings;
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -33,15 +34,14 @@ import com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHand
|
||||
import com.sun.org.apache.xml.internal.dtm.DTM;
|
||||
import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
|
||||
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
|
||||
import com.sun.org.apache.xml.internal.serializer.ToStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
@ -71,7 +71,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
public String _doctypeSystem = null;
|
||||
public boolean _indent = false;
|
||||
public String _mediaType = null;
|
||||
public ArrayList<String> _cdata = null;
|
||||
public List<String> _cdata = null;
|
||||
public int _indentamount = -1;
|
||||
|
||||
public static final int FIRST_TRANSLET_VERSION = 100;
|
||||
@ -149,7 +149,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
// Parameter's stack: <tt>pbase</tt> and <tt>pframe</tt> are used
|
||||
// to denote the current parameter frame.
|
||||
protected int pbase = 0, pframe = 0;
|
||||
protected ArrayList paramsStack = new ArrayList();
|
||||
protected List<Object> paramsStack = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Push a new parameter frame.
|
||||
@ -164,7 +164,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
*/
|
||||
public final void popParamFrame() {
|
||||
if (pbase > 0) {
|
||||
final int oldpbase = ((Integer)paramsStack.get(--pbase)).intValue();
|
||||
final int oldpbase = ((Integer)paramsStack.get(--pbase));
|
||||
for (int i = pframe - 1; i >= pbase; i--) {
|
||||
paramsStack.remove(i);
|
||||
}
|
||||
@ -716,7 +716,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
|
||||
private Map<String, Class<?>> _auxClasses = null;
|
||||
|
||||
public void addAuxiliaryClass(Class auxClass) {
|
||||
public void addAuxiliaryClass(Class<?> auxClass) {
|
||||
if (_auxClasses == null) _auxClasses = new HashMap<>();
|
||||
_auxClasses.put(auxClass.getName(), auxClass);
|
||||
}
|
||||
@ -725,7 +725,7 @@ public abstract class AbstractTranslet implements Translet {
|
||||
_auxClasses = auxClasses;
|
||||
}
|
||||
|
||||
public Class getAuxiliaryClass(String className) {
|
||||
public Class<?> getAuxiliaryClass(String className) {
|
||||
if (_auxClasses == null) return null;
|
||||
return((Class)_auxClasses.get(className));
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -25,6 +26,7 @@ import com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
@ -103,7 +105,7 @@ public class DOM2SAX implements XMLReader, Locator {
|
||||
}
|
||||
} else {
|
||||
_sax.startPrefixMapping(prefix, uri);
|
||||
_nsPrefixes.put(prefix, uriStack = new Stack());
|
||||
_nsPrefixes.put(prefix, uriStack = new Stack<>());
|
||||
uriStack.push(uri);
|
||||
}
|
||||
return pushed;
|
||||
@ -194,7 +196,7 @@ public class DOM2SAX implements XMLReader, Locator {
|
||||
break;
|
||||
case Node.ELEMENT_NODE:
|
||||
String prefix;
|
||||
ArrayList<String> pushedPrefixes = new ArrayList<>();
|
||||
List<String> pushedPrefixes = new ArrayList<>();
|
||||
final AttributesImpl attrs = new AttributesImpl();
|
||||
final NamedNodeMap map = node.getAttributes();
|
||||
final int length = map.getLength();
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* @LastModified: Oct 2017
|
||||
*/
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
@ -22,21 +22,19 @@
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.Constants;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.Vector;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.Constants;
|
||||
|
||||
import org.w3c.dom.Comment;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.ProcessingInstruction;
|
||||
import org.w3c.dom.Text;
|
||||
import org.xml.sax.Attributes;
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.Locator;
|
||||
@ -54,8 +52,8 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
private Node _root = null;
|
||||
private Document _document = null;
|
||||
private Node _nextSibling = null;
|
||||
private Stack _nodeStk = new Stack();
|
||||
private Vector _namespaceDecls = null;
|
||||
private Stack<Node> _nodeStk = new Stack<>();
|
||||
private List<String> _namespaceDecls = null;
|
||||
private Node _lastSibling = null;
|
||||
private Locator locator = null;
|
||||
private boolean needToSetDocumentInfo = true;
|
||||
@ -107,7 +105,7 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
return;
|
||||
}
|
||||
|
||||
final Node last = (Node)_nodeStk.peek();
|
||||
final Node last = _nodeStk.peek();
|
||||
|
||||
// No text nodes can be children of root (DOM006 exception)
|
||||
if (last != _document) {
|
||||
@ -117,7 +115,7 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
}
|
||||
private void appendTextNode() {
|
||||
if (_textBuffer.length() > 0) {
|
||||
final Node last = (Node)_nodeStk.peek();
|
||||
final Node last = _nodeStk.peek();
|
||||
if (last == _root && _nextSiblingCache != null) {
|
||||
_lastSibling = last.insertBefore(_document.createTextNode(_textBuffer.toString()), _nextSiblingCache);
|
||||
}
|
||||
@ -159,15 +157,15 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
if (_namespaceDecls != null) {
|
||||
final int nDecls = _namespaceDecls.size();
|
||||
for (int i = 0; i < nDecls; i++) {
|
||||
final String prefix = (String) _namespaceDecls.elementAt(i++);
|
||||
final String prefix = _namespaceDecls.get(i++);
|
||||
|
||||
if (prefix == null || prefix.equals(EMPTYSTRING)) {
|
||||
tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX,
|
||||
(String) _namespaceDecls.elementAt(i));
|
||||
_namespaceDecls.get(i));
|
||||
}
|
||||
else {
|
||||
tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix,
|
||||
(String) _namespaceDecls.elementAt(i));
|
||||
_namespaceDecls.get(i));
|
||||
}
|
||||
}
|
||||
_namespaceDecls.clear();
|
||||
@ -207,7 +205,7 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
|
||||
|
||||
// Append this new node onto current stack node
|
||||
Node last = (Node)_nodeStk.peek();
|
||||
Node last = _nodeStk.peek();
|
||||
|
||||
// If the SAX2DOM is created with a non-null next sibling node,
|
||||
// insert the result nodes before the next sibling under the root.
|
||||
@ -229,10 +227,10 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
|
||||
public void startPrefixMapping(String prefix, String uri) {
|
||||
if (_namespaceDecls == null) {
|
||||
_namespaceDecls = new Vector(2);
|
||||
_namespaceDecls = new ArrayList<>(2);
|
||||
}
|
||||
_namespaceDecls.addElement(prefix);
|
||||
_namespaceDecls.addElement(uri);
|
||||
_namespaceDecls.add(prefix);
|
||||
_namespaceDecls.add(uri);
|
||||
}
|
||||
|
||||
public void endPrefixMapping(String prefix) {
|
||||
@ -251,7 +249,7 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
*/
|
||||
public void processingInstruction(String target, String data) {
|
||||
appendTextNode();
|
||||
final Node last = (Node)_nodeStk.peek();
|
||||
final Node last = _nodeStk.peek();
|
||||
ProcessingInstruction pi = _document.createProcessingInstruction(
|
||||
target, data);
|
||||
if (pi != null){
|
||||
@ -285,7 +283,7 @@ public class SAX2DOM implements ContentHandler, LexicalHandler, Constants {
|
||||
*/
|
||||
public void comment(char[] ch, int start, int length) {
|
||||
appendTextNode();
|
||||
final Node last = (Node)_nodeStk.peek();
|
||||
final Node last = _nodeStk.peek();
|
||||
Comment comment = _document.createComment(new String(ch,start,length));
|
||||
if (comment != null){
|
||||
if (last == _root && _nextSibling != null)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user