First not enough generic types found - lessons learn - never make two objects in the arguments be typed with the same type variable AST_BeforeMergeFromTrunk fullscreen73766_root
authorjtulach@netbeans.org
Tue, 28 Mar 2006 09:59:14 +0000
changeset 136d009bc0b244e
parent 135 d6620bdcd270
child 137 c960aa1e832f
First not enough generic types found - lessons learn - never make two objects in the arguments be typed with the same type variable
openide.util/src/org/openide/util/Enumerations.java
     1.1 --- a/openide.util/src/org/openide/util/Enumerations.java	Sat Mar 25 16:36:12 2006 +0000
     1.2 +++ b/openide.util/src/org/openide/util/Enumerations.java	Tue Mar 28 09:59:14 2006 +0000
     1.3 @@ -142,7 +142,7 @@
     1.4       * @param processor a callback processor for the elements (its toAdd arguments is always null)
     1.5       * @return new enumeration where all elements has been processed
     1.6       */
     1.7 -    public static <T,R> Enumeration<R> convert(Enumeration<T> en, Processor<T,R> processor) {
     1.8 +    public static <T,R> Enumeration<R> convert(Enumeration<? extends T> en, Processor<T,R> processor) {
     1.9          return new AltEn<T,R>(en, processor);
    1.10      }
    1.11  
    1.12 @@ -170,7 +170,7 @@
    1.13       * @param filter a callback processor for the elements (its toAdd arguments is always null)
    1.14       * @return new enumeration which does not include non-processed (returned null from processor) elements
    1.15       */
    1.16 -    public static <T,R> Enumeration<R> filter(Enumeration<T> en, Processor<T,R> filter) {
    1.17 +    public static <T,R> Enumeration<R> filter(Enumeration<? extends T> en, Processor<T,R> filter) {
    1.18          return new FilEn<T,R>(en, filter);
    1.19      }
    1.20  
    1.21 @@ -203,7 +203,7 @@
    1.22       *       <code>null</code> if the filter returned <code>null</code> from its
    1.23       *       {@link Processor#process} method.
    1.24       */
    1.25 -    public static <T,R> Enumeration<R> queue(Enumeration<T> en, Processor<T,R> filter) {
    1.26 +    public static <T,R> Enumeration<R> queue(Enumeration<? extends T> en, Processor<T,R> filter) {
    1.27          QEn<T,R> q = new QEn<T,R>(filter);
    1.28  
    1.29          while (en.hasMoreElements()) {
    1.30 @@ -228,7 +228,7 @@
    1.31      /** Altering enumeration implementation */
    1.32      private static final class AltEn<T,R> extends Object implements Enumeration<R> {
    1.33          /** enumeration to filter */
    1.34 -        private Enumeration<T> en;
    1.35 +        private Enumeration<? extends T> en;
    1.36  
    1.37          /** map to alter */
    1.38          private Processor<T,R> process;
    1.39 @@ -236,7 +236,7 @@
    1.40          /**
    1.41          * @param en enumeration to filter
    1.42          */
    1.43 -        public AltEn(Enumeration<T> en, Processor<T,R> process) {
    1.44 +        public AltEn(Enumeration<? extends T> en, Processor<T,R> process) {
    1.45              this.en = en;
    1.46              this.process = process;
    1.47          }
    1.48 @@ -489,7 +489,7 @@
    1.49          private static final Object EMPTY = new Object();
    1.50  
    1.51          /** enumeration to filter */
    1.52 -        private Enumeration<T> en;
    1.53 +        private Enumeration<? extends T> en;
    1.54  
    1.55          /** element to be returned next time or {@link #EMPTY} if there is
    1.56          * no such element prepared */
    1.57 @@ -501,7 +501,7 @@
    1.58          /**
    1.59          * @param en enumeration to filter
    1.60          */
    1.61 -        public FilEn(Enumeration<T> en, Processor<T,R> filter) {
    1.62 +        public FilEn(Enumeration<? extends T> en, Processor<T,R> filter) {
    1.63              this.en = en;
    1.64              this.filter = filter;
    1.65          }