You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Julian Reschke (Jira)" <ji...@apache.org> on 2024/03/28 13:05:00 UTC

[jira] [Commented] (COLLECTIONS-849) Compilation with Java 21 fails with "error: addFirst(E#1) in AbstractLinkedList cannot implement addFirst(E#2) in List"

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

Julian Reschke commented on COLLECTIONS-849:
--------------------------------------------

Maybe close as "duplicate" then?

> Compilation with Java 21 fails with "error: addFirst(E#1) in AbstractLinkedList cannot implement addFirst(E#2) in List"
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: COLLECTIONS-849
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-849
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.2.2, 4.4
>            Reporter: Volkmar W. Pogatzki
>            Priority: Major
>         Attachments: build.log
>
>
> javac -source 1.8 -target 1.8 -d target/classes -encoding UTF-8 @sources.lst
> warning: [options] bootstrap class path not set in conjunction with -source 8
> warning: [options] source value 8 is obsolete and will be removed in a future release
> warning: [options] target value 8 is obsolete and will be removed in a future release
> warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
> src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java:1158: error: lastEntry() in AbstractPatriciaTrie cannot implement lastEntry() in SequencedMap
>     TrieEntry<K, V> lastEntry() {
>                     ^
>   attempting to assign weaker access privileges; was public
>   where K#1,V#1,K#2,V#2 are type-variables:
>     K#1 extends Object declared in class AbstractPatriciaTrie
>     V#1 extends Object declared in class AbstractPatriciaTrie
>     K#2 extends Object declared in interface SequencedMap
>     V#2 extends Object declared in interface SequencedMap
> src/main/java/org/apache/commons/collections4/trie/AbstractPatriciaTrie.java:744: error: firstEntry() in AbstractPatriciaTrie cannot implement firstEntry() in SequencedMap
>     TrieEntry<K, V> firstEntry() {
>                     ^
>   attempting to assign weaker access privileges; was public
>   where K#1,V#1,K#2,V#2 are type-variables:
>     K#1 extends Object declared in class AbstractPatriciaTrie
>     V#1 extends Object declared in class AbstractPatriciaTrie
>     K#2 extends Object declared in interface SequencedMap
>     V#2 extends Object declared in interface SequencedMap
> src/main/java/org/apache/commons/collections4/trie/PatriciaTrie.java:65: error: lastEntry() in AbstractPatriciaTrie cannot implement lastEntry() in SequencedMap
> public class PatriciaTrie<V> extends AbstractPatriciaTrie<String, V> {
>        ^
>   attempting to assign weaker access privileges; was public
>   where K#1,V#1,K#2,V#2 are type-variables:
>     K#1 extends Object declared in class AbstractPatriciaTrie
>     V#1 extends Object declared in class AbstractPatriciaTrie
>     K#2 extends Object declared in interface SequencedMap
>     V#2 extends Object declared in interface SequencedMap
> src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java:340: error: addLast(E#1) in AbstractLinkedList cannot implement addLast(E#2) in List
>     public boolean addLast(final E o) {
>                    ^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
>     E#1 extends Object declared in class AbstractLinkedList
>     E#2 extends Object declared in interface List
> src/main/java/org/apache/commons/collections4/list/AbstractLinkedList.java:335: error: addFirst(E#1) in AbstractLinkedList cannot implement addFirst(E#2) in List
>     public boolean addFirst(final E o) {
>                    ^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
>     E#1 extends Object declared in class AbstractLinkedList
>     E#2 extends Object declared in interface List
> src/main/java/org/apache/commons/collections4/list/NodeCachingLinkedList.java:44: error: addLast(E#1) in AbstractLinkedList cannot implement addLast(E#2) in List
> public class NodeCachingLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
>        ^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
>     E#1 extends Object declared in class AbstractLinkedList
>     E#2 extends Object declared in interface List
> src/main/java/org/apache/commons/collections4/list/CursorableLinkedList.java:61: error: addLast(E#1) in AbstractLinkedList cannot implement addLast(E#2) in List
> public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Serializable {
>        ^
>   return type boolean is not compatible with void
>   where E#1,E#2 are type-variables:
>     E#1 extends Object declared in class AbstractLinkedList
>     E#2 extends Object declared in interface List
> Note: Some input files use or override a deprecated API.
> Note: Recompile with -Xlint:deprecation for details.
> Note: Some input files use unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> 7 errors



--
This message was sent by Atlassian Jira
(v8.20.10#820010)