Project

Profile

Help

Revision 19efb3e5

Added by Michael Kay about 3 years ago

Fix bug 3982 (Item<?> vs Item)

View differences:

latest9.9/hej/net/sf/saxon/Configuration.java
2403 2403
     * @throws XPathException if (for example) a dynamic error occurs while priming the queue
2404 2404
     */
2405 2405

  
2406
    public <F extends Item, T extends Item> SequenceIterator<T> getMultithreadedItemMappingIterator(
2406
    public <F extends Item<?>, T extends Item<?>> SequenceIterator<T> getMultithreadedItemMappingIterator(
2407 2407
            SequenceIterator<F> base, ItemMappingFunction<F, T> action) throws XPathException {
2408 2408
        return new ItemMappingIterator<>(base, action);
2409 2409
    }
......
3606 3606
    /**
3607 3607
     * Get a factory function that can be used to wrap a SequenceIterator in a FocusTrackingIterator. This
3608 3608
     * is called by the {@link Controller} to get a default factory function; the value can be overridden
3609
     * by the application using {@link Controller#setFocusTrackerFactory(java.util.function.Function)}.
3609
     * by the application using {@link Controller#setFocusTrackerFactory(FocusTrackingFactory)}.
3610 3610
     * The {@link FocusTrackingIterator} that is created by the factory must be thread-safe if it is
3611 3611
     * to be used for iterating over a sequence where the items might be processed asynchronously using
3612 3612
     * <code>xsl:result-document</code>; for this reason this method is overridden for a Saxon-EE configuration.
......
3617 3617
     * @return a suitable factory function
3618 3618
     */
3619 3619

  
3620
    public java.util.function.Function<SequenceIterator, FocusIterator> getFocusTrackerFactory(
3620
    public FocusTrackingFactory getFocusTrackerFactory(
3621 3621
            Executable exec, boolean multithreaded) {
3622 3622
        return FocusTrackingIterator::new;
3623 3623
    }
......
3741 3741
     * @throws XPathException if a failure occurs constructing the Closure
3742 3742
     */
3743 3743

  
3744
    public Sequence makeClosure(Expression expression, int ref, XPathContext context) throws XPathException {
3744
    public Sequence<? extends Item<?>> makeClosure(Expression expression, int ref, XPathContext context) throws XPathException {
3745 3745
        if (getBooleanProperty(Feature.EAGER_EVALUATION)) {
3746 3746
            // Using eager evaluation can make for easier debugging
3747 3747
            SequenceIterator<? extends Item> iter = expression.iterate(context);
......
3766 3766
     * @throws XPathException if evaluation of the expression fails
3767 3767
     */
3768 3768

  
3769
    public GroundedValue makeSequenceExtent(Expression expression, int ref, XPathContext context) throws XPathException {
3769
    public GroundedValue<? extends Item<?>> makeSequenceExtent(Expression expression, int ref, XPathContext context) throws XPathException {
3770 3770
        return expression.iterate(context).materialize();
3771 3771
    }
3772 3772

  
latest9.9/hej/net/sf/saxon/Controller.java
50 50
import java.util.HashSet;
51 51
import java.util.Map;
52 52
import java.util.Set;
53
import java.util.function.Function;
54 53

  
55 54
import static net.sf.saxon.om.SequenceIterator.GROUNDED;
56 55

  
......
121 120
    public final static String ANONYMOUS_PRINCIPAL_OUTPUT_URI = "dummy:/anonymous/principal/result";
122 121
    private StylesheetCache stylesheetCache = null;
123 122

  
124
    private java.util.function.Function<SequenceIterator, FocusIterator> focusTrackerFactory =
125
            FocusTrackingIterator::new;
123
    private FocusTrackingFactory focusTrackerFactory = FocusTrackingIterator::new;
126 124

  
127
    private java.util.function.Function<SequenceIterator, FocusIterator> multiThreadedFocusTrackerFactory;
125
    private FocusTrackingFactory multiThreadedFocusTrackerFactory;
128 126

  
129 127
    /**
130 128
     * Create a Controller and initialise variables. Note: XSLT applications should
......
268 266
     * against the required type.
269 267
     */
270 268

  
271
    public GroundedValue getConvertedParameter(StructuredQName name, SequenceType requiredType, XPathContext context)
269
    public GroundedValue<? extends Item<?>> getConvertedParameter(StructuredQName name, SequenceType requiredType, XPathContext context)
272 270
            throws XPathException {
273
        GroundedValue val = globalParameters.convertParameterValue(name, requiredType, convertParameters, context);
271
        GroundedValue<? extends Item<?>> val =
272
                globalParameters.convertParameterValue(name, requiredType, convertParameters, context);
274 273
        if (val != null) {
275 274

  
276 275
            // Check that any nodes belong to the right configuration
......
653 652
     */
654 653

  
655 654
    /*@Nullable*/
656
    public Item getGlobalContextItem() {
655
    public Item<?> getGlobalContextItem() {
657 656
        return globalContextItem;
658 657
        // See W3C bug 5224, which points out that the rules for XQuery 1.0 weren't clearly defined
659 658
    }
......
1574 1573
     * @return a factory function that is used to create FocusTrackingIterator instances
1575 1574
     */
1576 1575

  
1577
    public Function<SequenceIterator, FocusIterator> getFocusTrackerFactory(boolean multithreaded) {
1576
    public FocusTrackingFactory getFocusTrackerFactory(boolean multithreaded) {
1578 1577
        return multithreaded && multiThreadedFocusTrackerFactory != null ?
1579 1578
                multiThreadedFocusTrackerFactory :
1580 1579
                focusTrackerFactory;
......
1588 1587
     * @param focusTrackerFactory a factory function that is used to create FocusTrackingIterator instances
1589 1588
     */
1590 1589

  
1591
    public void setFocusTrackerFactory(Function<SequenceIterator, FocusIterator> focusTrackerFactory) {
1590
    public void setFocusTrackerFactory(FocusTrackingFactory focusTrackerFactory) {
1592 1591
        this.focusTrackerFactory = focusTrackerFactory;
1593 1592
    }
1594 1593

  
......
1601 1600
     * @param focusTrackerFactory a factory function that is used to create FocusTrackingIterator instances
1602 1601
     */
1603 1602

  
1604
    public void setMultithreadedFocusTrackerFactory(Function<SequenceIterator, FocusIterator> focusTrackerFactory) {
1603
    public void setMultithreadedFocusTrackerFactory(FocusTrackingFactory focusTrackerFactory) {
1605 1604
        this.multiThreadedFocusTrackerFactory = focusTrackerFactory;
1606 1605
    }
1607 1606

  
latest9.9/hej/net/sf/saxon/dom/DOMEnvelope.java
14 14
import net.sf.saxon.expr.PJConverter;
15 15
import net.sf.saxon.expr.XPathContext;
16 16
import net.sf.saxon.lib.ExternalObjectModel;
17
import net.sf.saxon.om.Item;
17 18
import net.sf.saxon.om.NodeInfo;
18 19
import net.sf.saxon.om.Sequence;
19 20
import net.sf.saxon.pattern.AnyNodeTest;
......
78 79
    public PJConverter getPJConverter(Class targetClass) {
79 80
        if (NodeOverNodeInfo.class.isAssignableFrom(targetClass)) {
80 81
            return new PJConverter() {
81
                public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
82
                public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
82 83
                    return DOMObjectModel.convertXPathValueToObject(value, targetClass);
83 84
                }
84 85
            };
85 86
        } else if (NodeList.class.isAssignableFrom(targetClass)) {
86 87
            return new PJConverter() {
87
                public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
88
                public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
88 89
                    return DOMObjectModel.convertXPathValueToObject(value, targetClass);
89 90
                }
90 91
            };
latest9.9/hej/net/sf/saxon/dom/DOMObjectModel.java
110 110
    public PJConverter getPJConverter(Class targetClass) {
111 111
        if (Node.class.isAssignableFrom(targetClass) && !NodeOverNodeInfo.class.isAssignableFrom(targetClass)) {
112 112
            return new PJConverter() {
113
                public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
113
                public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
114 114
                    return convertXPathValueToObject(value, targetClass);
115 115
                }
116 116
            };
117 117
        } else if (NodeList.class == targetClass) {
118 118
            return new PJConverter() {
119
                public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
119
                public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
120 120
                    return convertXPathValueToObject(value, targetClass);
121 121
                }
122 122
            };
......
201 201
                (node instanceof VirtualNode && ((VirtualNode) node).getRealNode() instanceof Node)) {
202 202
            return new PJConverter() {
203 203
                /*@Nullable*/
204
                public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
204
                public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
205 205
                    return convertXPathValueToObject(value, NodeList.class);
206 206
                }
207 207
            };
latest9.9/hej/net/sf/saxon/dotnet/DotNetObjectModel.java
59 59
    public PJConverter getPJConverter(Class targetClass) {
60 60
        if (isRecognizedNodeClass(targetClass)) {
61 61
            return new PJConverter() {
62
                public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
62
                public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
63 63
                    if (value instanceof ZeroOrOne) {
64 64
                        NodeInfo node = (NodeInfo) ((ZeroOrOne) value).head();
65 65
                        if (node instanceof VirtualNode) {
......
218 218
                ((ZeroOrOne) value).head() instanceof DotNetNodeWrapper) {
219 219
            return ((DotNetNodeWrapper) ((ZeroOrOne) value).head()).getRealNode();
220 220
        } else if (isXdmAtomicValueType(targetClass)) {
221
            SequenceIterator atomIterator = Atomizer.getAtomizingIterator(value.iterate(), false);
222
            GroundedValue extent = ((SequenceIterator<Item>) atomIterator).materialize();
221
            SequenceIterator<? extends AtomicValue> atomIterator = Atomizer.getAtomizingIterator(value.iterate(), false);
222
            GroundedValue<? extends AtomicValue> extent = atomIterator.materialize();
223 223
            if (extent.getLength() == 0) {
224 224
                return null;
225 225
            } else if (extent instanceof AtomicValue) {
latest9.9/hej/net/sf/saxon/event/SequenceOutputter.java
39 39

  
40 40
public final class SequenceOutputter extends SequenceWriter {
41 41

  
42
    private List<Item> list;
42
    private List<Item<?>> list;
43 43

  
44 44

  
45 45
    /**
......
96 96
     * @return the value (sequence of items) that have been written to this SequenceOutputter
97 97
     */
98 98

  
99
    public Sequence<? extends Item> getSequence() {
99
    public Sequence<? extends Item<?>> getSequence() {
100 100
        switch (list.size()) {
101 101
            case 0:
102 102
                return EmptySequence.getInstance();
......
114 114
     * @return an iterator over the items that have been written to this SequenceOutputter
115 115
     */
116 116

  
117
    public SequenceIterator<Item> iterate() {
117
    public SequenceIterator<Item<?>> iterate() {
118 118
        if (list.isEmpty()) {
119 119
            return EmptyIterator.emptyIterator();
120 120
        } else {
......
128 128
     * @return the list of items that have been written to this SequenceOutputter
129 129
     */
130 130

  
131
    public List<Item> getList() {
131
    public List<Item<?>> getList() {
132 132
        return list;
133 133
    }
134 134

  
latest9.9/hej/net/sf/saxon/expr/AtomicSequenceConverter.java
338 338
     */
339 339

  
340 340
    public static class ToStringMappingFunction
341
            implements ItemMappingFunction<Item, StringValue> {
342
        public StringValue mapItem(Item item) {
341
            implements ItemMappingFunction<Item<?>, StringValue> {
342
        public StringValue mapItem(Item<?> item) {
343 343
            return StringValue.makeStringValue(item.getStringValueCS());
344 344
        }
345 345
    }
latest9.9/hej/net/sf/saxon/expr/BindingReference.java
23 23
     * Fix up the static type of this variable reference; optionally, supply a constant value for
24 24
     * the variable. Also supplies other static properties of the expression to which the variable
25 25
     * is bound, for example whether it is an ordered node-set.
26
     *
27
     * @param type          The static type of the variable reference, typically either the declared type
26
     *  @param type          The static type of the variable reference, typically either the declared type
28 27
     *                      of the variable, or the static type of the expression to which the variable is bound
29 28
     * @param constantValue if non-null, indicates that the value of the variable is known at compile
30 29
     *                      time, and supplies the value
31 30
     * @param properties    static properties of the expression to which the variable is bound
32 31
     */
33 32

  
34
    public void setStaticType(SequenceType type, /*@Nullable*/ GroundedValue constantValue, int properties);
33
    void setStaticType(SequenceType type, GroundedValue<? extends Item<?>> constantValue, int properties);
35 34

  
36 35
    /**
37 36
     * Fix up this binding reference to a binding
......
39 38
     * @param binding the Binding to which the variable refers
40 39
     */
41 40

  
42
    public void fixup(Binding binding);
41
    void fixup(Binding binding);
43 42

  
44 43
}
45 44

  
latest9.9/hej/net/sf/saxon/expr/Callable.java
40 40
     */
41 41

  
42 42
    /*@Nullable*/
43
    Sequence<? extends Item> call(XPathContext context, Sequence<? extends Item>[] arguments) throws XPathException;
43
    Sequence<? extends Item<?>> call(XPathContext context, Sequence<? extends Item<?>>[] arguments) throws XPathException;
44 44

  
45 45
}
latest9.9/hej/net/sf/saxon/expr/CardinalityChecker.java
291 291
            if (second != null) {
292 292
                Item[] leaders = new Item[]{first, second};
293 293
                typeError("A sequence of more than one item is not allowed as the " +
294
                    role.getMessage() + depictSequenceStart(new ArrayIterator<Item>(leaders), 2), role.getErrorCode(), context);
294
                    role.getMessage() + depictSequenceStart(new ArrayIterator<Item<?>>(leaders), 2), role.getErrorCode(), context);
295 295
                return null;
296 296
            }
297 297
        }
latest9.9/hej/net/sf/saxon/expr/CardinalityCheckingIterator.java
24 24
 * the checks; after that we can simply return the items from the base sequence.
25 25
 */
26 26

  
27
public final class CardinalityCheckingIterator<T extends Item> implements SequenceIterator<T> {
27
public final class CardinalityCheckingIterator<T extends Item<?>> implements SequenceIterator<T> {
28 28

  
29 29
    private SequenceIterator<T> base;
30 30
    private Location locator;
latest9.9/hej/net/sf/saxon/expr/CastToList.java
80 80
            GroundedValue literalOperand = ((Literal) operand).getValue();
81 81
            if (literalOperand instanceof AtomicValue) {
82 82
                try {
83
                    SequenceIterator seq = iterate(visitor.getStaticContext().makeEarlyEvaluationContext());
84
                    return Literal.makeLiteral(((SequenceIterator<Item>) seq).materialize(), this);
83
                    SequenceIterator<? extends Item<?>> seq =
84
                            iterate(visitor.getStaticContext().makeEarlyEvaluationContext());
85
                    return Literal.makeLiteral(seq.materialize(), this);
85 86
                } catch (XPathException err) {
86 87
                    err.maybeSetErrorCode("FORG0001");
87 88
                    err.setLocation(getLocation());
latest9.9/hej/net/sf/saxon/expr/CastToUnion.java
89 89
        if (operand instanceof Literal) {
90 90
            GroundedValue literalOperand = ((Literal) operand).getValue();
91 91
            if (literalOperand instanceof AtomicValue) {
92
                GroundedValue av = ((SequenceIterator<Item>) iterate(visitor.getStaticContext().makeEarlyEvaluationContext())).materialize();
92
                GroundedValue<? extends Item<?>> av = ((SequenceIterator<? extends Item<?>>) iterate(visitor.getStaticContext().makeEarlyEvaluationContext())).materialize();
93 93
                return Literal.makeLiteral(av, this);
94 94
            }
95 95
            if (literalOperand.getLength() == 0) {
latest9.9/hej/net/sf/saxon/expr/ContextMappingIterator.java
22 22
 * sets each item being processed as the context item</p>
23 23
 */
24 24

  
25
public final class ContextMappingIterator<T extends Item> implements SequenceIterator<T> {
25
public final class ContextMappingIterator<T extends Item<?>> implements SequenceIterator<T> {
26 26

  
27 27
    private FocusIterator<? extends Item> base;
28 28
    private ContextMappingFunction<T> action;
latest9.9/hej/net/sf/saxon/expr/EarlyEvaluationContext.java
337 337
    }
338 338

  
339 339
    @Override
340
    public <T extends Item> FocusIterator<T> trackFocus(SequenceIterator<T> iter) {
340
    public <T extends Item<?>> FocusIterator<T> trackFocus(SequenceIterator<T> iter) {
341 341
        notAllowed();
342 342
        return null;
343 343
    }
......
346 346
     * Set the value of a local variable, identified by its slot number
347 347
     */
348 348

  
349
    public void setLocalVariable(int slotNumber, Sequence value) {
349
    public void setLocalVariable(int slotNumber, Sequence<? extends Item<?>> value) {
350 350
        notAllowed();
351 351
    }
352 352

  
......
368 368
     * @param isTunnel    True if a tunnel parameter is required, else false  @return true if a parameter of this name was supplied, false if not
369 369
     */
370 370

  
371
    public int useLocalParameter(StructuredQName parameterId, int slotNumber, boolean isTunnel) throws XPathException {
371
    public int useLocalParameter(StructuredQName parameterId, int slotNumber, boolean isTunnel) {
372 372
        return ParameterSet.NOT_SUPPLIED;
373 373
    }
374 374

  
latest9.9/hej/net/sf/saxon/expr/ErrorIterator.java
15 15
 * A SequenceIterator that throws an exception as soon as its next() method is called. Used when
16 16
 * the method that returns the iterator isn't allowed to throw a checked exception itself.
17 17
 */
18
public class ErrorIterator implements SequenceIterator<Item> {
18
public class ErrorIterator implements SequenceIterator<Item<?>> {
19 19

  
20 20
    private XPathException exception;
21 21

  
latest9.9/hej/net/sf/saxon/expr/Expression.java
842 842
     */
843 843

  
844 844
    /*@Nullable*/
845
    public Item evaluateItem(XPathContext context) throws XPathException {
845
    public Item<?> evaluateItem(XPathContext context) throws XPathException {
846 846
        return iterate(context).next();
847 847
    }
848 848

  
latest9.9/hej/net/sf/saxon/expr/FilterExpression.java
507 507
    }
508 508

  
509 509

  
510
    private Sequence tryEarlyEvaluation(ExpressionVisitor visitor) throws XPathException {
510
    private Sequence<? extends Item<?>> tryEarlyEvaluation(ExpressionVisitor visitor) throws XPathException {
511 511
        // Attempt early evaluation of a filter expression if the base sequence is constant and the
512 512
        // filter depends only on the context. (This can't be done if, for example, the predicate uses
513 513
        // local variables, even variables declared within the predicate)
......
516 516
                    !ExpressionTool.refersToVariableOrFunction(getFilter()) &&
517 517
                    (getFilter().getDependencies() & ~StaticProperty.DEPENDS_ON_FOCUS) == 0) {
518 518
                XPathContext context = visitor.getStaticContext().makeEarlyEvaluationContext();
519
                return ((SequenceIterator<Item>) iterate(context)).materialize();
519
                return iterate(context).materialize();
520 520
            }
521 521
        } catch (XPathException e) {
522 522
            // can happen for a variety of reasons, for example the filter references a global parameter,
latest9.9/hej/net/sf/saxon/expr/FilterIterator.java
21 21
 * so this class does no optimizations for numeric predicates.
22 22
 */
23 23

  
24
public class FilterIterator<T extends Item> implements SequenceIterator<T> {
24
public class FilterIterator<T extends Item<?>> implements SequenceIterator<T> {
25 25

  
26 26
    protected FocusIterator<T> base;
27 27
    protected Expression filter;
......
49 49
     * @param context the context in which the (outer) filter expression is evaluated
50 50
     */
51 51

  
52
    public void setSequence(SequenceIterator base, XPathContext context) {
52
    public void setSequence(SequenceIterator<? extends Item<?>> base, XPathContext context) {
53 53
        filterContext = context.newMinorContext();
54
        this.base = filterContext.trackFocus(base);
54
        this.base = (FocusIterator<T>)filterContext.trackFocus(base);
55 55
    }
56 56

  
57 57
    /**
latest9.9/hej/net/sf/saxon/expr/ItemChecker.java
236 236
     *         as the input sequence, unless the dynamic type checking reveals an error.
237 237
     */
238 238

  
239
    public ItemMappingFunction<Item, Item> getMappingFunction(XPathContext context) {
239
    public ItemMappingFunction<Item<?>, Item<?>> getMappingFunction(XPathContext context) {
240 240
        return new ItemTypeCheckingFunction(requiredItemType, role, getBaseExpression(), context.getConfiguration());
241 241
    }
242 242

  
latest9.9/hej/net/sf/saxon/expr/ItemMappingFunction.java
18 18
 * the output item type</p>
19 19
 */
20 20

  
21
public interface ItemMappingFunction<F extends Item, T extends Item> {
21
public interface ItemMappingFunction<F extends Item<?>, T extends Item<?>> {
22 22

  
23 23
    /**
24 24
     * Map one item to another item.
latest9.9/hej/net/sf/saxon/expr/ItemMappingIterator.java
21 21
 * output item.</p>
22 22
 */
23 23

  
24
public class ItemMappingIterator<F extends Item, T extends Item>
24
public class ItemMappingIterator<F extends Item<?>, T extends Item<?>>
25 25
        implements SequenceIterator<T>, LookaheadIterator<T>, LastPositionFinder {
26 26

  
27 27
    private SequenceIterator<? extends F> base;
latest9.9/hej/net/sf/saxon/expr/ItemTypeCheckingFunction.java
22 22
 * all the items in a sequence are instances of a given item type
23 23
 *
24 24
 */
25
public class ItemTypeCheckingFunction implements ItemMappingFunction<Item, Item> {
25
public class ItemTypeCheckingFunction<T extends Item<?>> implements ItemMappingFunction<T, T> {
26 26

  
27 27
    private ItemType requiredItemType;
28 28
    private RoleDiagnostic role;
......
54 54
        this.config = config;
55 55
    }
56 56

  
57
    public Item mapItem(Item item) throws XPathException {
57
    public T mapItem(T item) throws XPathException {
58 58
        testConformance(item, config);
59 59
        return item;
60 60
    }
61 61

  
62
    private void testConformance(Item item, Configuration config) throws XPathException {
62
    private void testConformance(T item, Configuration config) throws XPathException {
63 63
        final TypeHierarchy th = config.getTypeHierarchy();
64 64
        if (requiredItemType.matches(item, th)) {
65 65
            // OK, no action
latest9.9/hej/net/sf/saxon/expr/JPConverter.java
271 271
        public static final FromSequenceIterator INSTANCE = new FromSequenceIterator();
272 272

  
273 273
        public Sequence convert(Object object, XPathContext context) throws XPathException {
274
            return ((SequenceIterator<Item>) (SequenceIterator) object).materialize();
274
            return ((SequenceIterator<Item<?>>)object).materialize();
275 275
        }
276 276

  
277 277
        public ItemType getItemType() {
......
320 320
            this.cardinality = cardinality;
321 321
        }
322 322

  
323
        public Sequence convert(Object object, XPathContext context) throws XPathException {
323
        public Sequence<? extends Item<?>> convert(Object object, XPathContext context) throws XPathException {
324 324
            return object instanceof Closure ?
325
                    ((SequenceIterator<Item>) ((Closure) object).iterate()).materialize() :
325
                    ((Closure) object).iterate().materialize() :
326 326
                    (Sequence) object;
327 327
        }
328 328

  
latest9.9/hej/net/sf/saxon/expr/Literal.java
37 37

  
38 38
public class Literal extends Expression {
39 39

  
40
    private GroundedValue value;
40
    private GroundedValue<? extends Item<?>> value;
41 41

  
42 42
    /**
43 43
     * Create a literal as a wrapper around a Value
......
45 45
     * @param value the value of this literal
46 46
     */
47 47

  
48
    protected Literal(GroundedValue value) {
48
    protected Literal(GroundedValue<? extends Item<?>> value) {
49 49
        this.value = value.reduce();
50 50
    }
51 51

  
......
70 70
     * @return the constant value
71 71
     */
72 72

  
73
    public GroundedValue getValue() {
73
    public GroundedValue<? extends Item<?>> getValue() {
74 74
        return value;
75 75
    }
76 76

  
......
235 235
    /**
236 236
     * Copy an expression. This makes a deep copy.
237 237
     *
238
     * @param rebindings
238
     * @param rebindings variables that need to be re-bound
239 239
     * @return a copy of the original literal. Note that the
240 240
     * underlying value is not copied; the code relies on the caller
241 241
     * treating the underlying value as immutable.
......
351 351
        if (value instanceof Item) {
352 352
            out.append((Item) value, getLocation(), ReceiverOptions.ALL_NAMESPACES);
353 353
        } else {
354
            value.iterate().forEachOrFail(it -> {
355
                out.append(it, getLocation(), ReceiverOptions.ALL_NAMESPACES);
356
            });
354
            value.iterate().forEachOrFail(it -> out.append(it, getLocation(), ReceiverOptions.ALL_NAMESPACES));
357 355
        }
358 356
    }
359 357

  
......
436 434
        if (!(obj instanceof Literal)) {
437 435
            return false;
438 436
        }
439
        GroundedValue v0 = value;
440
        GroundedValue v1 = ((Literal) obj).value;
437
        GroundedValue<? extends Item<?>> v0 = value;
438
        GroundedValue<? extends Item<?>> v1 = ((Literal) obj).value;
441 439
        try {
442
            SequenceIterator i0 = v0.iterate();
443
            SequenceIterator i1 = v1.iterate();
440
            SequenceIterator<? extends Item<?>> i0 = v0.iterate();
441
            SequenceIterator<? extends Item<?>> i1 = v1.iterate();
444 442
            while (true) {
445 443
                Item m0 = i0.next();
446 444
                Item m1 = i1.next();
......
459 457
                    return false;
460 458
                }
461 459
                if (n0) {
462
                    if (((NodeInfo) m0).equals((NodeInfo) m1)) {
460
                    if (m0.equals(m1)) {
463 461
                        continue;
464 462
                    } else {
465 463
                        return false;
......
630 628
        } else if (value instanceof AtomicValue) {
631 629
            return value.toString();
632 630
        } else {
633
            return "(" + value.head().toString() + ",...)";
631
            return "(" + value.head() + ",...)";
634 632
        }
635 633
    }
636 634

  
......
742 740
     * @return the Literal
743 741
     */
744 742

  
745
    public static <T extends Item> Literal makeLiteral(GroundedValue<T> value) {
743
    public static <T extends Item<?>> Literal makeLiteral(GroundedValue<T> value) {
746 744
        value = value.reduce();
747 745
        if (value instanceof StringValue) {
748 746
            return new StringLiteral((StringValue) value);
......
765 763
     * @return the Literal
766 764
     */
767 765

  
768
    public static Literal makeLiteral(GroundedValue value, Expression origin) {
766
    public static Literal makeLiteral(GroundedValue<? extends Item<?>> value, Expression origin) {
769 767
        Literal lit = makeLiteral(value);
770 768
        //lit.setRetainedStaticContextLocally(origin.getLocalRetainedStaticContext());
771 769
        ExpressionTool.copyLocationInfo(origin, lit);
latest9.9/hej/net/sf/saxon/expr/LookupExpression.java
342 342
                        }));
343 343
            }
344 344
        } else if (isObjectLookup) {
345
            SequenceIterator<? extends Item> baseIterator = getLhsExpression().iterate(context);
346
            GroundedValue<? extends Item> rhs = getRhsExpression().iterate(context).materialize();
345
            SequenceIterator<? extends Item<?>> baseIterator = getLhsExpression().iterate(context);
346
            GroundedValue<? extends Item<?>> rhs = getRhsExpression().iterate(context).materialize();
347 347
            String key = rhs.getStringValue();
348 348
            return new ItemMappingIterator<>(baseIterator,
349
                                           item -> (Item)config.externalObjectAsMap(((ObjectValue)item), key).get((StringValue)rhs));
349
                                           item -> (Item<?>)config.externalObjectAsMap((ObjectValue)item, key).get((StringValue)rhs));
350 350
        } else {
351
            SequenceIterator<? extends Item> baseIterator = getLhsExpression().iterate(context);
352
            GroundedValue<? extends Item> rhs = getRhsExpression().iterate(context).materialize();
353
            MappingFunction<? extends Item, ? extends Item> mappingFunction = baseItem -> {
351
            SequenceIterator<? extends Item<?>> baseIterator = getLhsExpression().iterate(context);
352
            GroundedValue<? extends Item<?>> rhs = getRhsExpression().iterate(context).materialize();
353
            MappingFunction<? extends Item<?>, ? extends Item<?>> mappingFunction = baseItem -> {
354 354
                if (baseItem instanceof ArrayItem) {
355
                    MappingFunction<Item, Item> arrayAccess = index -> {
355
                    MappingFunction<Item<?>, Item<?>> arrayAccess = index -> {
356 356
                        if (index instanceof IntegerValue) {
357 357
                            GroundedValue<? extends Item> member = ((ArrayItem) baseItem).get((int) ((IntegerValue) index).longValue() - 1);
358 358
                            return member.iterate();
......
366 366
                            throw exception;
367 367
                        }
368 368
                    };
369
                    SequenceIterator<? extends Item> rhsIter = rhs.iterate();
369
                    SequenceIterator<? extends Item<?>> rhsIter = rhs.iterate();
370 370
                    return new MappingIterator<>(rhsIter, arrayAccess);
371 371
                } else if (baseItem instanceof MapItem) {
372
                    SequenceIterator<? extends Item> rhsIter = rhs.iterate();
372
                    SequenceIterator<? extends Item<?>> rhsIter = rhs.iterate();
373 373
                    return new MappingIterator<>(rhsIter, key -> {
374
                        GroundedValue<? extends Item> value = ((MapItem) baseItem).get((AtomicValue) key);
374
                        GroundedValue<? extends Item<?>> value = ((MapItem) baseItem).get((AtomicValue) key);
375 375
                        return value == null ? EmptyIterator.emptyIterator() : value.iterate();
376 376
                    });
377 377
                } else if (baseItem instanceof ObjectValue) {
......
385 385
                        throw exception;
386 386
                    }
387 387
                    String key = rhs.getStringValue();
388
                    return config.externalObjectAsMap(((ObjectValue) baseItem), key).get((StringValue) rhs).iterate();
388
                    return config.externalObjectAsMap((ObjectValue) baseItem, key).get((StringValue) rhs).iterate();
389 389
                } else {
390 390
                    mustBeArrayOrMap(this, baseItem);
391 391
                    return null;
latest9.9/hej/net/sf/saxon/expr/MappingFunction.java
19 19
 * <p>It maps an item of class F to a sequence of items of class T, returned as an iterator.</p>
20 20
 */
21 21

  
22
public interface MappingFunction<F extends Item, T extends Item> {
22
public interface MappingFunction<F extends Item<?>, T extends Item<?>> {
23 23

  
24 24
    /**
25 25
     * Map one item to a sequence.
latest9.9/hej/net/sf/saxon/expr/MappingIterator.java
23 23
 * used in the implementation of the document(), key(), and id() functions.</p>
24 24
 */
25 25

  
26
public class MappingIterator<F extends Item, T extends Item> implements SequenceIterator<T> {
26
public class MappingIterator<F extends Item<?>, T extends Item<?>> implements SequenceIterator<T> {
27 27

  
28 28
    private SequenceIterator<F> base;
29 29
    private MappingFunction<? super F, ? extends T> action;
latest9.9/hej/net/sf/saxon/expr/PJConverter.java
175 175
     */
176 176

  
177 177
    /*@Nullable*/
178
    public abstract Object convert(Sequence value, Class targetClass, XPathContext context)
178
    public abstract Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context)
179 179
            throws XPathException;
180 180

  
181 181
    /**
......
262 262
                        try {
263 263
                            final Constructor constructor = targetClass.getConstructor(String.class);
264 264
                            return new PJConverter() {
265
                                public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
265
                                public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
266 266
                                    try {
267 267
                                        return constructor.newInstance(value.head().getStringValue());
268 268
                                    } catch (InstantiationException | IllegalAccessException e) {
......
515 515

  
516 516
        public static final ToSequenceIterator INSTANCE = new ToSequenceIterator();
517 517

  
518
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
518
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
519 519
            return value.iterate();
520 520
        }
521 521

  
......
525 525

  
526 526
        public static final ToNull INSTANCE = new ToNull();
527 527

  
528
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
528
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
529 529
            return null;
530 530
        }
531 531

  
......
535 535

  
536 536
        public static final ToSequenceExtent INSTANCE = new ToSequenceExtent();
537 537

  
538
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
539
            return ((SequenceIterator<Item>) value.iterate()).materialize();
538
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
539
            return value.iterate().materialize();
540 540
        }
541 541

  
542 542
    }
......
550 550

  
551 551
        public static final ToCollection INSTANCE = new ToCollection();
552 552

  
553
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
553
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
554 554
            Collection<Object> list;
555 555
            if (targetClass.isAssignableFrom(ArrayList.class)) {
556 556
                list = new ArrayList<Object>(100);
......
598 598
            this.itemConverter = itemConverter;
599 599
        }
600 600

  
601
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
601
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
602 602
            if (value instanceof ExternalObject && targetClass.isAssignableFrom(((ExternalObject) value).getObject().getClass())) {
603 603
                return ((ExternalObject) value).getObject();
604 604
            }
......
631 631

  
632 632
        public static final ToOne INSTANCE = new ToOne();
633 633

  
634
        public One<Item> convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
634
        public One<Item<?>> convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
635 635
            // Assume all the type checking has already been done
636
            return new One<Item>(value.head());
636
            return new One<>(value.head());
637 637
        }
638 638

  
639 639
    }
......
647 647

  
648 648
        public static final ToZeroOrOne INSTANCE = new ToZeroOrOne();
649 649

  
650
        public ZeroOrOne<Item> convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
650
        public ZeroOrOne<Item<?>> convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
651 651
            // Assume all the type checking has already been done
652
            return new ZeroOrOne<Item>(value.head());
652
            return new ZeroOrOne<>(value.head());
653 653
        }
654 654

  
655 655
    }
......
663 663

  
664 664
        public static final ToOneOrMore INSTANCE = new ToOneOrMore();
665 665

  
666
        public OneOrMore<Item> convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
666
        public OneOrMore<Item> convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
667 667
            return OneOrMore.makeOneOrMore(value);
668 668
        }
669 669

  
......
679 679

  
680 680
        public static final ToZeroOrMore INSTANCE = new ToZeroOrMore();
681 681

  
682
        public ZeroOrMore<Item> convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
683
            return new ZeroOrMore<Item>(value.iterate());
682
        public ZeroOrMore<Item<?>> convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
683
            return new ZeroOrMore<>(value.iterate());
684 684
        }
685 685

  
686 686
    }
......
690 690

  
691 691
        public static final Identity INSTANCE = new Identity();
692 692

  
693
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
693
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
694 694
            if (value instanceof Closure) {
695 695
                value = ((Closure) value).reduce();
696 696
            }
......
730 730

  
731 731
        public static final UnwrapExternalObject INSTANCE = new UnwrapExternalObject();
732 732

  
733
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
733
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
734 734
            Item head = value.head();
735 735
            if (head == null) {
736 736
                return null;
737 737
            }
738 738
            if (!(head instanceof ExternalObject)) {
739 739
                if (Sequence.class.isAssignableFrom(targetClass)) {
740
                    head = (ExternalObject<Sequence>) new ObjectValue<>(value);
740
                    head = new ObjectValue<>(value);
741 741
                } else {
742 742
                    throw new XPathException("Expected external object of class " + targetClass.getName() +
743 743
                            ", got " + head.getClass());
......
757 757

  
758 758
        public static final StringValueToString INSTANCE = new StringValueToString();
759 759

  
760
        public String convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
760
        public String convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
761 761
            Item first = value.head();
762 762
            return first == null ? null : first.getStringValue();
763 763
        }
......
768 768

  
769 769
        public static final StringValueToChar INSTANCE = new StringValueToChar();
770 770

  
771
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
771
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
772 772
            Item first = value.head();
773 773
            if (first == null) {
774 774
                return null;
......
791 791

  
792 792
        public static final BooleanValueToBoolean INSTANCE = new BooleanValueToBoolean();
793 793

  
794
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
794
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
795 795
            BooleanValue bv = (BooleanValue) value.head();
796 796
            assert bv != null;
797 797
            return bv.getBooleanValue();
......
803 803

  
804 804
        public static final IntegerValueToBigInteger INSTANCE = new IntegerValueToBigInteger();
805 805

  
806
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
806
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
807 807
            IntegerValue val = (IntegerValue) value.head();
808 808
            return val == null ? null : val.asBigInteger();
809 809
        }
......
814 814

  
815 815
        public static final IntegerValueToLong INSTANCE = new IntegerValueToLong();
816 816

  
817
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
817
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
818 818
            IntegerValue iv = (IntegerValue) value.head();
819 819
            assert iv != null;
820 820
            return iv.longValue();
......
826 826

  
827 827
        public static final IntegerValueToInt INSTANCE = new IntegerValueToInt();
828 828

  
829
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
829
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
830 830
            IntegerValue iv = (IntegerValue) value.head();
831 831
            assert iv != null;
832 832
            return (int) iv.longValue();
......
838 838

  
839 839
        public static final IntegerValueToShort INSTANCE = new IntegerValueToShort();
840 840

  
841
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
841
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
842 842
            IntegerValue iv = (IntegerValue) value.head();
843 843
            assert iv != null;
844 844
            return (short) iv.longValue();
......
850 850

  
851 851
        public static final IntegerValueToByte INSTANCE = new IntegerValueToByte();
852 852

  
853
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
853
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
854 854
            IntegerValue iv = (IntegerValue) value.head();
855 855
            assert iv != null;
856 856
            return (byte) iv.longValue();
......
862 862

  
863 863
        public static final IntegerValueToChar INSTANCE = new IntegerValueToChar();
864 864

  
865
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
865
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
866 866
            IntegerValue iv = (IntegerValue) value.head();
867 867
            assert iv != null;
868 868
            return (char) iv.longValue();
......
874 874

  
875 875
        public static final NumericValueToBigDecimal INSTANCE = new NumericValueToBigDecimal();
876 876

  
877
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
877
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
878 878
            NumericValue nv = (NumericValue) value.head();
879 879
            return (nv == null ? null : nv.getDecimalValue());
880 880
        }
......
885 885

  
886 886
        public static final NumericValueToDouble INSTANCE = new NumericValueToDouble();
887 887

  
888
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
888
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
889 889
            NumericValue nv = (NumericValue) value.head();
890 890
            assert nv != null;
891 891
            return nv.getDoubleValue();
......
897 897

  
898 898
        public static final NumericValueToFloat INSTANCE = new NumericValueToFloat();
899 899

  
900
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
900
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
901 901
            NumericValue nv = (NumericValue) value.head();
902 902
            assert nv != null;
903 903
            return nv.getFloatValue();
......
909 909

  
910 910
        public static final AnyURIValueToURI INSTANCE = new AnyURIValueToURI();
911 911

  
912
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
912
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
913 913
            AnyURIValue av = (AnyURIValue) value.head();
914 914
            try {
915 915
                return (av == null ? null : new URI(((AnyURIValue) value).getStringValue()));
......
924 924

  
925 925
        public static final AnyURIValueToURL INSTANCE = new AnyURIValueToURL();
926 926

  
927
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
927
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
928 928
            AnyURIValue av = (AnyURIValue) value.head();
929 929
            try {
930 930
                return (av == null ? null : new URL(((AnyURIValue) value).getStringValue()));
......
939 939

  
940 940
        public static final QualifiedNameValueToQName INSTANCE = new QualifiedNameValueToQName();
941 941

  
942
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
942
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
943 943
            QualifiedNameValue qv = (QualifiedNameValue) value.head();
944 944
            return qv == null ? null : qv.toJaxpQName();
945 945
        }
......
950 950

  
951 951
        public static final CalendarValueToInstant INSTANCE = new CalendarValueToInstant();
952 952

  
953
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
953
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
954 954
            CalendarValue cv = (CalendarValue) value.head();
955 955
            return cv == null ? null : cv.toDateTime().toJavaInstant();
956 956
        }
......
961 961

  
962 962
        public static final CalendarValueToZonedDateTime INSTANCE = new CalendarValueToZonedDateTime();
963 963

  
964
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
964
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
965 965
            CalendarValue cv = (CalendarValue) value.head();
966 966
            return cv == null ? null : cv.toDateTime().toZonedDateTime();
967 967
        }
......
972 972

  
973 973
        public static final CalendarValueToDate INSTANCE = new CalendarValueToDate();
974 974

  
975
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
975
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
976 976
            CalendarValue cv = (CalendarValue) value.head();
977 977
            return (cv == null ? null : cv.getCalendar().getTime());
978 978
        }
......
983 983

  
984 984
        public static final CalendarValueToCalendar INSTANCE = new CalendarValueToCalendar();
985 985

  
986
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
986
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
987 987
            CalendarValue cv = (CalendarValue) value.head();
988 988
            return (cv == null ? null : cv.getCalendar());
989 989
        }
......
1034 1034

  
1035 1035
        public static final Atomic INSTANCE = new Atomic();
1036 1036

  
1037
        public Object convert(Sequence value, Class targetClass, XPathContext context) throws XPathException {
1037
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context) throws XPathException {
1038 1038
            // TODO: not really worth separating from General
1039 1039
            AtomicValue item = (AtomicValue) value.head();
1040 1040
            if (item == null) {
......
1056 1056

  
1057 1057
        public static final General INSTANCE = new General();
1058 1058

  
1059
        public Object convert(Sequence value, Class targetClass, XPathContext context)
1059
        public Object convert(Sequence<? extends Item<?>> value, Class targetClass, XPathContext context)
1060 1060
                throws XPathException {
1061 1061
            Configuration config = context.getConfiguration();
1062 1062
            GroundedValue gv = value.materialize();
latest9.9/hej/net/sf/saxon/expr/SlashExpression.java
925 925

  
926 926
        XPathContext context2 = context.newMinorContext();
927 927
        context2.trackFocus(getStart().iterate(context));
928
        return new ContextMappingIterator<Item>(this, context2);
928
        return new ContextMappingIterator<Item<?>>(this, context2);
929 929
    }
930 930

  
931 931
    /**
latest9.9/hej/net/sf/saxon/expr/StackFrame.java
8 8
package net.sf.saxon.expr;
9 9

  
10 10
import net.sf.saxon.expr.instruct.SlotManager;
11
import net.sf.saxon.om.Item;
11 12
import net.sf.saxon.om.Sequence;
12 13

  
13 14
import java.util.Arrays;
......
20 21

  
21 22
public class StackFrame {
22 23
    protected SlotManager map;
23
    protected Sequence[] slots;
24
    protected Stack<Sequence> dynamicStack;
24
    protected Sequence<? extends Item<?>>[] slots;
25
    protected Stack<Sequence<? extends Item<?>>> dynamicStack;
25 26

  
26 27
    public static final StackFrame EMPTY = new StackFrame(SlotManager.EMPTY, new Sequence[0]);
27 28

  
28
    public StackFrame(SlotManager map, Sequence[] slots) {
29
    public StackFrame(SlotManager map, Sequence<? extends Item<?>>[] slots) {
29 30
        this.map = map;
30 31
        this.slots = slots;
31 32
    }
......
34 35
        return map;
35 36
    }
36 37

  
37
    public Sequence[] getStackFrameValues() {
38
    public Sequence<? extends Item<?>>[] getStackFrameValues() {
38 39
        return slots;
39 40
    }
40 41

  
41
    public void setStackFrameValues(Sequence[] values) {
42
    public void setStackFrameValues(Sequence<? extends Item<?>>[] values) {
42 43
        slots = values;
43 44
    }
44 45

  
......
46 47
        Sequence[] v2 = Arrays.copyOf(slots, slots.length);
47 48
        StackFrame s = new StackFrame(map, v2);
48 49
        if (dynamicStack != null) {
49
            s.dynamicStack = new Stack<Sequence>();
50
            s.dynamicStack = new Stack<>();
50 51
            s.dynamicStack.addAll(dynamicStack);
51 52
        }
52 53
        return s;
53 54
    }
54 55

  
55
    public void pushDynamicValue(Sequence value) {
56
    public void pushDynamicValue(Sequence<? extends Item<?>> value) {
56 57
        if (this == StackFrame.EMPTY) {
57 58
            throw new IllegalStateException("Immutable stack frame");
58 59
        }
59 60
        if (dynamicStack == null) {
60
            dynamicStack = new Stack<Sequence>();
61
            dynamicStack = new Stack<>();
61 62
        }
62 63
        dynamicStack.push(value);
63 64
    }
64 65

  
65
    public Sequence popDynamicValue() {
66
    public Sequence<? extends Item<?>> popDynamicValue() {
66 67
        return dynamicStack.pop();
67 68
    }
68 69

  
latest9.9/hej/net/sf/saxon/expr/StaticFunctionCall.java
177 177
     * of the callee to ensure that the type of result conforms to the expected result type.
178 178
     * @throws net.sf.saxon.trans.XPathException if a dynamic error occurs during the evaluation of the expression
179 179
     */
180
    public Sequence<? extends Item> call(XPathContext context, Sequence[] arguments) throws XPathException {
180
    public Sequence<? extends Item<?>> call(XPathContext context, Sequence<? extends Item<?>>[] arguments) throws XPathException {
181 181
        return target.call(context, arguments);
182 182
    }
183 183

  
......
194 194
    }
195 195

  
196 196
    /**
197
     * Diagnostic print of expression structure. The abstract expression tree
197
     * Serialized output of expression structure. The abstract expression tree
198 198
     * is written to the supplied output destination.
199 199
     *
200
     * @param out
200
     * @param out destination of the SEF output
201 201
     */
202 202
    @Override
203 203
    public void export(ExpressionPresenter out) throws XPathException {
latest9.9/hej/net/sf/saxon/expr/SubsequenceIterator.java
19 19
 * A SubsequenceIterator selects a subsequence of a sequence
20 20
 */
21 21

  
22
public class SubsequenceIterator<T extends Item> implements SequenceIterator<T>, LastPositionFinder, LookaheadIterator<T> {
22
public class SubsequenceIterator<T extends Item<?>> implements SequenceIterator<T>, LastPositionFinder, LookaheadIterator<T> {
23 23

  
24 24
    private SequenceIterator<T> base;
25 25
    private int basePosition = 0;
......
70 70
     * @throws XPathException if a dynamic error occurs
71 71
     */
72 72

  
73
    public static <T extends Item> SequenceIterator<T> make(SequenceIterator<T> base, int min, int max) throws XPathException {
73
    public static <T extends Item<?>> SequenceIterator<T> make(SequenceIterator<T> base, int min, int max) throws XPathException {
74 74
        if (base instanceof ArrayIterator) {
75 75
            return ((ArrayIterator<T>) base).makeSliceIterator(min, max);
76 76
        } else if (max == Integer.MAX_VALUE) {
latest9.9/hej/net/sf/saxon/expr/SuppliedParameterReference.java
156 156
     * @throws XPathException if the variable is undefined
157 157
     */
158 158

  
159
    public Sequence evaluateVariable(XPathContext c) throws XPathException {
159
    public Sequence<? extends Item<?>> evaluateVariable(XPathContext c) {
160 160
        if (slotNumber == -1) {
161 161
            return c.getStackFrame().popDynamicValue();
162 162
        }
latest9.9/hej/net/sf/saxon/expr/TailExpression.java
44 44
    public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException {
45 45
        getOperand().optimize(visitor, contextInfo);
46 46
        if (getBaseExpression() instanceof Literal) {
47
            GroundedValue value =
48
                    ((SequenceIterator<Item>) iterate(visitor.getStaticContext().makeEarlyEvaluationContext())).materialize();
47
            GroundedValue<? extends Item<?>> value =
48
                    iterate(visitor.getStaticContext().makeEarlyEvaluationContext()).materialize();
49 49
            return Literal.makeLiteral(value, this);
50 50
        }
51 51
        return this;
......
55 55
     * Copy an expression. This makes a deep copy.
56 56
     *
57 57
     * @return the copy of the original expression
58
     * @param rebindings
58
     * @param rebindings variables that need to be re-bound
59 59
     */
60 60

  
61 61
    /*@NotNull*/
......
131 131
    }
132 132

  
133 133
    /*@NotNull*/
134
    public SequenceIterator<? extends Item> iterate(XPathContext context) throws XPathException {
135
        SequenceIterator baseIter = getBaseExpression().iterate(context);
134
    public SequenceIterator<? extends Item<?>> iterate(XPathContext context) throws XPathException {
135
        SequenceIterator<? extends Item<?>> baseIter = getBaseExpression().iterate(context);
136 136
        return TailIterator.make(baseIter, start);
137 137
    }
138 138

  
......
173 173
    @Override
174 174
    public String toString() {
175 175
        if (start == 2) {
176
            return "tail(" + getBaseExpression().toString() + ")";
176
            return "tail(" + getBaseExpression() + ")";
177 177
        } else {
178 178
            return ExpressionTool.parenthesize(getBaseExpression()) + "[position() ge " + start + "]";
179 179
        }
latest9.9/hej/net/sf/saxon/expr/TailIterator.java
20 20
 * The base sequence is represented by an iterator which is consumed in the process
21 21
 */
22 22

  
23
public class TailIterator<T extends Item>
23
public class TailIterator<T extends Item<?>>
24 24
        implements SequenceIterator<T>, LastPositionFinder, LookaheadIterator<T> {
25 25

  
26 26
    private SequenceIterator<T> base;
......
59 59
     *          if a dynamic error occurs
60 60
     */
61 61

  
62
    public static <T extends Item> SequenceIterator<T> make(SequenceIterator<T> base, int start) throws XPathException {
62
    public static <T extends Item<?>> SequenceIterator<T> make(SequenceIterator<T> base, int start) throws XPathException {
63 63
        if (start <= 1) {
64 64
            return base;
65 65
        } else if (base instanceof ArrayIterator) {
latest9.9/hej/net/sf/saxon/expr/ValueTailIterator.java
20 20
 * supports efficient direct addressing.
21 21
 */
22 22

  
23
public class ValueTailIterator<T extends Item>
23
public class ValueTailIterator<T extends Item<?>>
24 24
        implements SequenceIterator<T>, GroundedIterator<T>, LookaheadIterator<T> {
25 25

  
26 26
    private GroundedValue<T> baseValue;
latest9.9/hej/net/sf/saxon/expr/VariableReference.java
35 35
    /*@Nullable*/ protected Binding binding = null;     // This will be null until fixup() is called; it will also be null
36 36
    // if the variable reference has been inlined
37 37
    protected SequenceType staticType = null;
38
    protected GroundedValue constantValue = null;
38
    protected GroundedValue<? extends Item<?>> constantValue = null;
39 39
    private StructuredQName variableName = null;
40 40
    private boolean flattened = false;
41 41
    private boolean inLoop = false;
......
116 116
     * as supplying the static type, it may also supply a compile-time value for the variable.
117 117
     * As well as the type information, other static properties of the value are supplied:
118 118
     * for example, whether the value is an ordered node-set.
119
     *
120
     * @param type       the static type of the variable
119
     *  @param type       the static type of the variable
121 120
     * @param value      the value of the variable if this is a compile-time constant, or null otherwise
122 121
     * @param properties static properties of the expression to which the variable is bound
123 122
     */
124 123

  
125
    public void setStaticType(SequenceType type, /*@Nullable*/ GroundedValue value, int properties) {
124
    public void setStaticType(SequenceType type, GroundedValue<? extends Item<?>> value, int properties) {
126 125
        // System.err.println(this + " Set static type = " + type);
127 126
        if (type == null) {
128 127
            type = SequenceType.ANY_SEQUENCE;
latest9.9/hej/net/sf/saxon/expr/XPathContext.java
123 123
     *             to the current iterator.
124 124
     */
125 125

  
126
    <T extends Item> FocusIterator<T> trackFocus(SequenceIterator<T> iter);
126
    <T extends Item<?>> FocusIterator<T> trackFocus(SequenceIterator<T> iter);
127 127

  
128 128
    /**
129 129
     * Set a new sequence iterator.
......
150 150
     * @return the context item, or null if the context item is undefined
151 151
     */
152 152

  
153
    Item getContextItem();
153
    Item<?> getContextItem();
154 154

  
155 155
    /**
156 156
     * Get the context size (the position of the last item in the current node list)
......
236 236
     * @return the value of the variable.
237 237
     */
238 238

  
239
    Sequence evaluateLocalVariable(int slotnumber);
239
    Sequence<? extends Item<?>> evaluateLocalVariable(int slotnumber);
240 240

  
241 241
    /**
242 242
     * Set the value of a local variable, identified by its slot number
243
     *
244
     * @param slotNumber the slot number allocated at compile time to the variable,
243
     *  @param slotNumber the slot number allocated at compile time to the variable,
245 244
     *                   which identifies its position within the local stack frame
246 245
     * @param value      the value of the variable
247 246
     */
248 247

  
249
    void setLocalVariable(int slotNumber, Sequence value) throws XPathException;
248
    void setLocalVariable(int slotNumber, Sequence<? extends Item<?>> value) throws XPathException;
250 249

  
251 250
    /**
252 251
     * Set the XSLT output state to "temporary" or "final"
latest9.9/hej/net/sf/saxon/expr/XPathContextMajor.java
87 87
     * @param exec the Executable
88 88
     */
89 89

  
90
    public XPathContextMajor(Item item, Executable exec) {
90
    public XPathContextMajor(Item<?> item, Executable exec) {
91 91
        controller = exec instanceof PreparedStylesheet ?
92 92
                new XsltController(exec.getConfiguration(), (PreparedStylesheet)exec) :
93 93
                new Controller(exec.getConfiguration(), exec);
latest9.9/hej/net/sf/saxon/expr/XPathContextMinor.java
166 166
     *             to the current iterator.
167 167
     */
168 168

  
169
    public <T extends Item> FocusIterator<T> trackFocus(SequenceIterator<T> iter) {
170
        FocusIterator<T> fit = controller.getFocusTrackerFactory(false).apply(iter);
169
    public <T extends Item<?>> FocusIterator<T> trackFocus(SequenceIterator<T> iter) {
170
        FocusTrackingFactory factory =
171
                controller.getFocusTrackerFactory(false);
172
        FocusIterator<T> fit = (FocusIterator<T>)factory.apply(iter);
171 173
        setCurrentIterator(fit);
172 174
        return fit;
173 175
    }
......
180 182
     *             to the current iterator.
181 183
     */
182 184

  
183
    public <T extends Item> FocusIterator<T> trackFocusMultithreaded(SequenceIterator<T> iter) {
184
        FocusIterator<T> fit = controller.getFocusTrackerFactory(true).apply(iter);
185
    public <T extends Item<?>> FocusIterator<T> trackFocusMultithreaded(SequenceIterator<T> iter) {
186
        FocusTrackingFactory factory = controller.getFocusTrackerFactory(true);
187
        FocusIterator<T> fit = (FocusIterator<T>)factory.apply(iter);
185 188
        setCurrentIterator(fit);
186 189
        return fit;
187 190
    }
......
320 323
     * Get the value of a local variable, identified by its slot number
321 324
     */
322 325

  
323
    public final Sequence evaluateLocalVariable(int slotnumber) {
326
    public final Sequence<? extends Item<?>> evaluateLocalVariable(int slotnumber) {
324 327
        return stackFrame.slots[slotnumber];
325 328
    }
326 329

  
......
328 331
     * Set the value of a local variable, identified by its slot number
329 332
     */
330 333

  
331
    public final void setLocalVariable(int slotNumber, Sequence value) throws XPathException {
334
    public final void setLocalVariable(int slotNumber, Sequence<? extends Item<?>> value) throws XPathException {
332 335

  
333 336
        // The following code is deep defence against attempting to store a non-memo Closure in a variable.
334 337
        // This should not happen, and if it does, it means that the evaluation mode has been miscalculated.
latest9.9/hej/net/sf/saxon/expr/flwor/GroupByClause.java
291 291
            context.setLocalVariable(bindings[j].getLocalSlotNumber(), v);
292 292
        }
293 293
        for (int j = groupingValues.length; j < bindings.length; j++) {
294
            List<Item> concatenatedValue = new ArrayList<>();
294
            List<Item<?>> concatenatedValue = new ArrayList<>();
295 295
            for (ObjectToBeGrouped otbg : group) {
296
                Sequence val = otbg.retainedValues.getMembers()[j - groupingValues.length];
297
                SequenceIterator si = val.iterate();
298
                Item it;
296
                Sequence<? extends Item<?>> val = otbg.retainedValues.getMembers()[j - groupingValues.length];
297
                SequenceIterator<? extends Item<?>> si = val.iterate();
298
                Item<?> it;
299 299
                while ((it = si.next()) != null) {
300 300
                    concatenatedValue.add(it);
301 301
                }
302 302
            }
303
            SequenceExtent<Item> se = new SequenceExtent<>(concatenatedValue);
303
            SequenceExtent<Item<?>> se = new SequenceExtent<>(concatenatedValue);
304 304
            context.setLocalVariable(bindings[j].getLocalSlotNumber(), se);
305 305
        }
306 306
    }
latest9.9/hej/net/sf/saxon/expr/flwor/ReturnClauseIterator.java
18 18
 * of the tuples in a supplied tuple stream, returning the result as an iterator
19 19
 */
20 20

  
21
public class ReturnClauseIterator implements SequenceIterator<Item> {
21
public class ReturnClauseIterator implements SequenceIterator<Item<?>> {
22 22

  
23 23
    private TuplePull base;
24 24
    private Expression action;
25 25
    private XPathContext context;
26
    private SequenceIterator results = null;
26
    private SequenceIterator<? extends Item<?>> results = null;
27 27

  
28 28
    /**
29 29
     * Construct an iterator over the results of the FLWOR expression.
latest9.9/hej/net/sf/saxon/expr/flwor/Tuple.java
7 7

  
8 8
package net.sf.saxon.expr.flwor;
9 9

  
10
import net.sf.saxon.om.Item;
10 11
import net.sf.saxon.om.Sequence;
11 12
import net.sf.saxon.value.ObjectValue;
12 13

  
13 14
/**
14 15
 * A tuple, as it appears in an XQuery tuple stream handled by extended FLWOR expressions.
15 16
 */
16
public class Tuple extends ObjectValue<Sequence[]> {
17
public class Tuple extends ObjectValue<Sequence<? extends Item<?>>[]> {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff