You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Vincent Privat (JIRA)" <ji...@apache.org> on 2017/01/08 15:42:58 UTC

[jira] [Commented] (COLLECTIONS-593) Compilation errors (generics) with JDK9

    [ https://issues.apache.org/jira/browse/COLLECTIONS-593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15809580#comment-15809580 ] 

Vincent Privat commented on COLLECTIONS-593:
--------------------------------------------

yes sure!

> Compilation errors (generics) with JDK9
> ---------------------------------------
>
>                 Key: COLLECTIONS-593
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-593
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 4.x
>         Environment: Java 9b125
>            Reporter: Vincent Privat
>              Labels: generics, jdk9, josm-found
>
> Current codebase does not compile with JDK9 (build 125): 28 errors below.
> I am not sure if this is a bug of JDK9 of a stricter compilation rule with generics.
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/BagUtils.java:98: error: incompatible types: Bag<CAP#1> cannot be converted to Bag<E>
>     [javac]         return UnmodifiableBag.unmodifiableBag(bag);
>     [javac]                                               ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>unmodifiableBag(Bag<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/CollectionUtils.java:795: error: incompatible types: Collection<CAP#1> cannot be converted to Collection<C>
>     [javac]                 final Collection<C> resultCollection = collect(collection, transformer);
>     [javac]                                                               ^
>     [javac]   where C is a type-variable:
>     [javac]     C extends Object declared in method <C>transform(Collection<C>,Transformer<? super C,? extends C>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends C from capture of ? extends C
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/CollectionUtils.java:1835: error: incompatible types: Collection<CAP#1> cannot be converted to Collection<C>
>     [javac]         return UnmodifiableCollection.unmodifiableCollection(collection);
>     [javac]                                                             ^
>     [javac]   where C is a type-variable:
>     [javac]     C extends Object declared in method <C>unmodifiableCollection(Collection<? extends C>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends C from capture of ? extends C
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/FluentIterable.java:311: error: incompatible types: FluentIterable<CAP#1> cannot be converted to FluentIterable<O>
>     [javac]         return of(IterableUtils.transformedIterable(iterable, transformer));
>     [javac]                  ^
>     [javac]   where O,E are type-variables:
>     [javac]     O extends Object declared in method <O>transform(Transformer<? super E,? extends O>)
>     [javac]     E extends Object declared in class FluentIterable
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends O from capture of ? extends O
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IterableUtils.java:429: error: incompatible types: Iterator<CAP#1> cannot be converted to Iterator<O>
>     [javac]                 return IteratorUtils.transformedIterator(iterable.iterator(), transformer);
>     [javac]                                                         ^
>     [javac]   where O,I are type-variables:
>     [javac]     O extends Object declared in method <I,O>transformedIterable(Iterable<I>,Transformer<? super I,? extends O>)
>     [javac]     I extends Object declared in method <I,O>transformedIterable(Iterable<I>,Transformer<? super I,? extends O>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends O from capture of ? extends O
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IterableUtils.java:833: error: no suitable method found for partition(Iterable<CAP#1>,Factory<List<O#1>>,Predicate<? super O#1>[])
>     [javac]         return partition(iterable, factory, predicates);
>     [javac]                ^
>     [javac]     method IterableUtils.<O#1>partition(Iterable<? extends O#1>,Predicate<? super O#1>) is not applicable
>     [javac]       (cannot infer type-variable(s) O#1
>     [javac]         (actual and formal argument lists differ in length))
>     [javac]     method IterableUtils.<O#2>partition(Iterable<? extends O#2>,Predicate<? super O#2>...) is not applicable
>     [javac]       (cannot infer type-variable(s) O#2
>     [javac]         (varargs mismatch; Factory<List<O#1>> cannot be converted to Predicate<? super O#2>))
>     [javac]     method IterableUtils.<O#3,R>partition(Iterable<? extends O#3>,Factory<R>,Predicate<? super O#3>...) is not applicable
>     [javac]       (cannot infer type-variable(s) O#3,R
>     [javac]         (varargs mismatch; Predicate<? super O#1>[] cannot be converted to Predicate<? super O#3>))
>     [javac]   where O#1,O#2,O#3,R are type-variables:
>     [javac]     O#1 extends Object declared in method <O#1>partition(Iterable<? extends O#1>,Predicate<? super O#1>)
>     [javac]     O#2 extends Object declared in method <O#2>partition(Iterable<? extends O#2>,Predicate<? super O#2>...)
>     [javac]     O#3 extends Object declared in method <O#3,R>partition(Iterable<? extends O#3>,Factory<R>,Predicate<? super O#3>...)
>     [javac]     R extends Collection<O#3> declared in method <O#3,R>partition(Iterable<? extends O#3>,Factory<R>,Predicate<? super O#3>...)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends O#1 from capture of ? extends O#1
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IterableUtils.java:873: error: no suitable method found for partition(Iterable<CAP#1>,Factory<List<O#1>>,Predicate<? super O#1>[])
>     [javac]         return partition(iterable, factory, predicates);
>     [javac]                ^
>     [javac]     method IterableUtils.<O#2>partition(Iterable<? extends O#2>,Predicate<? super O#2>) is not applicable
>     [javac]       (cannot infer type-variable(s) O#2
>     [javac]         (actual and formal argument lists differ in length))
>     [javac]     method IterableUtils.<O#1>partition(Iterable<? extends O#1>,Predicate<? super O#1>...) is not applicable
>     [javac]       (cannot infer type-variable(s) O#1
>     [javac]         (varargs mismatch; Factory<List<O#1>> cannot be converted to Predicate<? super O#1>))
>     [javac]     method IterableUtils.<O#3,R>partition(Iterable<? extends O#3>,Factory<R>,Predicate<? super O#3>...) is not applicable
>     [javac]       (cannot infer type-variable(s) O#3,R
>     [javac]         (varargs mismatch; Predicate<? super O#1>[] cannot be converted to Predicate<? super O#3>))
>     [javac]   where O#1,O#2,O#3,R are type-variables:
>     [javac]     O#1 extends Object declared in method <O#1>partition(Iterable<? extends O#1>,Predicate<? super O#1>...)
>     [javac]     O#2 extends Object declared in method <O#2>partition(Iterable<? extends O#2>,Predicate<? super O#2>)
>     [javac]     O#3 extends Object declared in method <O#3,R>partition(Iterable<? extends O#3>,Factory<R>,Predicate<? super O#3>...)
>     [javac]     R extends Collection<O#3> declared in method <O#3,R>partition(Iterable<? extends O#3>,Factory<R>,Predicate<? super O#3>...)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends O#1 from capture of ? extends O#1
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IteratorUtils.java:438: error: incompatible types: BoundedIterator<CAP#1> cannot be converted to BoundedIterator<E>
>     [javac]         return boundedIterator(iterator, 0, max);
>     [javac]                               ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>boundedIterator(Iterator<? extends E>,long)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IteratorUtils.java:862: error: incompatible types: PeekingIterator<CAP#1> cannot be converted to Iterator<E>
>     [javac]         return PeekingIterator.peekingIterator(iterator);
>     [javac]                                               ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>peekingIterator(Iterator<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IteratorUtils.java:878: error: incompatible types: PushbackIterator<CAP#1> cannot be converted to Iterator<E>
>     [javac]         return PushbackIterator.pushbackIterator(iterator);
>     [javac]                                                 ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>pushbackIterator(Iterator<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IteratorUtils.java:1086: error: incompatible types: List<CAP#1> cannot be converted to List<E>
>     [javac]         final List<E> list = toList(iterator, 100);
>     [javac]                                    ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>toArray(Iterator<? extends E>,Class<E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/IteratorUtils.java:1104: error: incompatible types: List<CAP#1> cannot be converted to List<E>
>     [javac]         return toList(iterator, 10);
>     [javac]                      ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>toList(Iterator<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/ListUtils.java:394: error: incompatible types: List<CAP#1> cannot be converted to List<E>
>     [javac]         return UnmodifiableList.unmodifiableList(list);
>     [javac]                                                 ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>unmodifiableList(List<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/MapUtils.java:1272: error: incompatible types: Map<CAP#1,CAP#2> cannot be converted to Map<K,V>
>     [javac]         return UnmodifiableMap.unmodifiableMap(map);
>     [javac]                                               ^
>     [javac]   where K,V are type-variables:
>     [javac]     K extends Object declared in method <K,V>unmodifiableMap(Map<? extends K,? extends V>)
>     [javac]     V extends Object declared in method <K,V>unmodifiableMap(Map<? extends K,? extends V>)
>     [javac]   where CAP#1,CAP#2 are fresh type-variables:
>     [javac]     CAP#1 extends K from capture of ? extends K
>     [javac]     CAP#2 extends V from capture of ? extends V
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/MapUtils.java:1537: error: incompatible types: SortedMap<K,CAP#1> cannot be converted to SortedMap<K,V>
>     [javac]         return UnmodifiableSortedMap.unmodifiableSortedMap(map);
>     [javac]                                                           ^
>     [javac]   where K,V are type-variables:
>     [javac]     K extends Object declared in method <K,V>unmodifiableSortedMap(SortedMap<K,? extends V>)
>     [javac]     V extends Object declared in method <K,V>unmodifiableSortedMap(SortedMap<K,? extends V>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends V from capture of ? extends V
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/MultiSetUtils.java:85: error: incompatible types: MultiSet<CAP#1> cannot be converted to MultiSet<E>
>     [javac]         return UnmodifiableMultiSet.unmodifiableMultiSet(multiset);
>     [javac]                                                         ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>unmodifiableMultiSet(MultiSet<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/PredicateUtils.java:537: error: incompatible types: Predicate<CAP#1> cannot be converted to Predicate<T>
>     [javac]         return TransformedPredicate.transformedPredicate(transformer, predicate);
>     [javac]                                                         ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in method <T>transformedPredicate(Transformer<? super T,? extends T>,Predicate<? super T>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends T from capture of ? extends T
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/QueueUtils.java:56: error: incompatible types: Queue<CAP#1> cannot be converted to Queue<E>
>     [javac]         return UnmodifiableQueue.unmodifiableQueue(queue);
>     [javac]                                                   ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>unmodifiableQueue(Queue<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/SetUtils.java:225: error: incompatible types: Set<CAP#1> cannot be converted to Set<E>
>     [javac]         return UnmodifiableSet.unmodifiableSet(set);
>     [javac]                                               ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>unmodifiableSet(Set<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/SetUtils.java:505: error: incompatible types: Iterator<CAP#1> cannot be converted to Iterator<E>
>     [javac]                 return IteratorUtils.filteredIterator(a.iterator(), notContainedInB);
>     [javac]                                                      ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>difference(Set<? extends E>,Set<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/SetUtils.java:543: error: incompatible types: Iterator<CAP#1> cannot be converted to Iterator<E>
>     [javac]                 return IteratorUtils.filteredIterator(a.iterator(), containedInB);
>     [javac]                                                      ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in method <E>intersection(Set<? extends E>,Set<? extends E>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/TransformerUtils.java:187: error: incompatible types: no instance(s) of type variable(s) I#1 exist so that Transformer<I#1,CAP#1> conforms to Transformer<I#2,O#2>
>     [javac]         return FactoryTransformer.factoryTransformer(factory);
>     [javac]                                                     ^
>     [javac]   where I#1,O#1,O#2,I#2 are type-variables:
>     [javac]     I#1 extends Object declared in method <I#1,O#1>factoryTransformer(Factory<? extends O#1>)
>     [javac]     O#1 extends Object declared in method <I#1,O#1>factoryTransformer(Factory<? extends O#1>)
>     [javac]     O#2 extends Object declared in method <I#2,O#2>asTransformer(Factory<? extends O#2>)
>     [javac]     I#2 extends Object declared in method <I#2,O#2>asTransformer(Factory<? extends O#2>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends O#2 from capture of ? extends O#2
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/TransformerUtils.java:235: error: incompatible types: Transformer<CAP#1,CAP#1> cannot be converted to Transformer<T,T>
>     [javac]         return IfTransformer.ifTransformer(predicate, trueTransformer);
>     [javac]                                           ^
>     [javac]   where T is a type-variable:
>     [javac]     T extends Object declared in method <T>ifTransformer(Predicate<? super T>,Transformer<? super T,? extends T>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends T from capture of ? extends T
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/TransformerUtils.java:428: error: incompatible types: no instance(s) of type variable(s) I#1 exist so that Transformer<I#1,CAP#1> conforms to Transformer<I#2,O#2>
>     [javac]         return MapTransformer.mapTransformer(map);
>     [javac]                                             ^
>     [javac]   where I#1,O#1,O#2,I#2 are type-variables:
>     [javac]     I#1 extends Object declared in method <I#1,O#1>mapTransformer(Map<? super I#1,? extends O#1>)
>     [javac]     O#1 extends Object declared in method <I#1,O#1>mapTransformer(Map<? super I#1,? extends O#1>)
>     [javac]     O#2 extends Object declared in method <I#2,O#2>mapTransformer(Map<? super I#2,? extends O#2>)
>     [javac]     I#2 extends Object declared in method <I#2,O#2>mapTransformer(Map<? super I#2,? extends O#2>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends O#2 from capture of ? extends O#2
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/TrieUtils.java:46: error: incompatible types: Trie<K,CAP#1> cannot be converted to Trie<K,V>
>     [javac]         return UnmodifiableTrie.unmodifiableTrie(trie);
>     [javac]                                                 ^
>     [javac]   where K,V are type-variables:
>     [javac]     K extends Object declared in method <K,V>unmodifiableTrie(Trie<K,? extends V>)
>     [javac]     V extends Object declared in method <K,V>unmodifiableTrie(Trie<K,? extends V>)
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends V from capture of ? extends V
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/iterators/IteratorIterable.java:118: error: incompatible types: Iterator<CAP#1> cannot be converted to Iterator<E>
>     [javac]         this.typeSafeIterator = createTypesafeIterator(this.iterator);
>     [javac]                                                       ^
>     [javac]   where E is a type-variable:
>     [javac]     E extends Object declared in class IteratorIterable
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends E from capture of ? extends E
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/collections4/multimap/TransformedMultiValuedMap.java:162: error: incompatible types: FluentIterable<CAP#1> cannot be converted to Iterable<V>
>     [javac]         final Iterable<V> transformedValues = FluentIterable.of(values).transform(valueTransformer);
>     [javac]                                                                                  ^
>     [javac]   where V is a type-variable:
>     [javac]     V extends Object declared in class TransformedMultiValuedMap
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends V from capture of ? extends V
>     [javac] /var/lib/jenkins/jobs/Java-EarlyAccess-JOSM-Plugins/workspace/jdk/JDK9/apache-commons/src/org/apache/commons/imaging/util/Debug.java:125: error: incompatible types: ArrayList<CAP#1> cannot be converted to List<Object>
>     [javac]         final List<Object> keys = new ArrayList<>(map.keySet());
>     [javac]                                   ^
>     [javac]   where CAP#1 is a fresh type-variable:
>     [javac]     CAP#1 extends Object from capture of ?
>     [javac] 28 errors
>     [javac] 1 warning



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)