Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error with Java 21 #86

Open
cushon opened this issue Jan 23, 2024 · 0 comments · May be fixed by #91
Open

Compilation error with Java 21 #86

cushon opened this issue Jan 23, 2024 · 0 comments · May be fixed by #91

Comments

@cushon
Copy link

cushon commented Jan 23, 2024

The definition of SIPHeaderList#removeLast causes a compilation error with Java 21:

public void removeLast() {

The change is due to the introduction of 'Sequenced Collections' in JDK 21 release notes, which added a removeLast method to the collections API that clashes with the definition in SIPHeaderList.

The error could be fixed by changing the definition of SIPHeaderList#removeLast to match the definition in the collections API, or by renaming the method.


Repro:

JAVA_HOME=<path to JDK 21> ant -Djavac.source=8 -Djavac.target=8 -Dsource.encoding=iso-8859-1 runtck
[jain-javac] /usr/local/google/home/cushon/src/jsip/src/gov/nist/javax/sip/header/ims/ServiceRouteList.java:37: error: removeLast() in SIPHeaderList cannot implement removeLast() in List
[jain-javac] public class ServiceRouteList extends SIPHeaderList<ServiceRoute> {
[jain-javac]        ^
[jain-javac]   return type void is not compatible with ServiceRoute
[jain-javac]   where E is a type-variable:
[jain-javac]     E extends Object declared in interface List
cushon added a commit to cushon/jsip that referenced this issue Nov 6, 2024
This updates the return type of getFirst and getLast, and returns the
removed value from removeFirst and removeLast, for compatibility with
the versions of those methods added to SequencedCollection in JDK 21.

Fixes usnistgov#86
@cushon cushon linked a pull request Nov 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant