java 8 problems #129

Closed
puntogil opened this Issue Apr 4, 2014 · 5 comments

Comments

Projects
None yet
3 participants
@puntogil

puntogil commented Apr 4, 2014

Enviroment:
openjdk version "1.8.0"
OpenJDK Runtime Environment (build 1.8.0-b132)
OpenJDK Server VM (build 25.0-b70, mixed mode)

Apache Maven 3.2.1
Maven home: /usr/share/maven
Java version: 1.8.0-b132, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.0/jre
Default locale: it_IT, platform encoding: UTF-8
OS name: "linux", version: "3.13.7-100.fc19.i686", arch: "i386", family: "unix"

compile.core:
[copy] Copying 13 files to /builddir/build/BUILD/jdom-JDOM-2.0.5/build/core
[copy] Copied 16 empty directories to 2 empty directories under /builddir/build/BUILD/jdom-JDOM-2.0.5/build/core
[javac] Compiling 133 source files to /builddir/build/BUILD/jdom-JDOM-2.0.5/build/core
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] /builddir/build/BUILD/jdom-JDOM-2.0.5/core/src/java/org/jdom2/ContentList.java:631: error: sort(Comparator<? super Content>) in ContentList cannot implement sort(Comparator<? super E>) in List
[javac] final void sort(final Comparator<? super Content> comp) {
[javac] ^
[javac] attempting to assign weaker access privileges; was public
[javac] where E is a type-variable:
[javac] E extends Object declared in interface List
[javac] /builddir/build/BUILD/jdom-JDOM-2.0.5/core/src/java/org/jdom2/ContentList.java:1241: error: sort(Comparator<? super F>) in ContentList.FilterList cannot implement sort(Comparator<? super E>) in List
[javac] final void sort(final Comparator<? super F> comp) {
[javac] ^
[javac] attempting to assign weaker access privileges; was public
[javac] where F,E are type-variables:
[javac] F extends Content declared in class ContentList.FilterList
[javac] E extends Object declared in interface List
[javac] /builddir/build/BUILD/jdom-JDOM-2.0.5/core/src/java/org/jdom2/AttributeList.java:609: error: sort(Comparator<? super Attribute>) in AttributeList cannot implement sort(Comparator<? super E>) in List
[javac] void sort(Comparator<? super Attribute> comp) {
[javac] ^
[javac] attempting to assign weaker access privileges; was public
[javac] where E is a type-variable:
[javac] E extends Object declared in interface List
[javac] 3 errors
[javac] 4 warnings

any ideas?
thanks in advance
regards

@hunterhacker

This comment has been minimized.

Show comment
Hide comment
@hunterhacker

hunterhacker Apr 4, 2014

Owner

I see they added a new List.sort() method in Java 8.
http://docs.oracle.com/javase/8/docs/api/java/util/List.html#sort-java.util.Comparator-

Now our sort() on ContentList is having a signature conflict.

Ours isn't a public method, so you should be able to rename it to internalSort() and change the calls in Element.java to call it by its new name, and that should take care of the collision and be backward compatible.

Rolf?

Owner

hunterhacker commented Apr 4, 2014

I see they added a new List.sort() method in Java 8.
http://docs.oracle.com/javase/8/docs/api/java/util/List.html#sort-java.util.Comparator-

Now our sort() on ContentList is having a signature conflict.

Ours isn't a public method, so you should be able to rename it to internalSort() and change the calls in Element.java to call it by its new name, and that should take care of the collision and be backward compatible.

Rolf?

@rolfl

This comment has been minimized.

Show comment
Hide comment
@rolfl

rolfl Apr 4, 2014

Collaborator

OK, I see this, and understand the issue. That should work. I am pretty familiar with Java-8 at the moment (been learning), just have not tried JDOM on it... Will make this happen properly.

Puntogil ... if you find anything else .... shout.

Collaborator

rolfl commented Apr 4, 2014

OK, I see this, and understand the issue. That should work. I am pretty familiar with Java-8 at the moment (been learning), just have not tried JDOM on it... Will make this happen properly.

Puntogil ... if you find anything else .... shout.

@puntogil

This comment has been minimized.

Show comment
Hide comment
@puntogil

puntogil Apr 4, 2014

Sure, thanks for your help
regards

puntogil commented Apr 4, 2014

Sure, thanks for your help
regards

@rolfl

This comment has been minimized.

Show comment
Hide comment
@rolfl

rolfl Apr 4, 2014

Collaborator

I believe the issue is actually best solved by making the sort method public. I guess it is a testament to the generics strategy of JDOM 2.x that the generics are all compatible with what Java8 wants.

Changing the methods to public, and running with Java8, all 1887 tests pass.

Collaborator

rolfl commented Apr 4, 2014

I believe the issue is actually best solved by making the sort method public. I guess it is a testament to the generics strategy of JDOM 2.x that the generics are all compatible with what Java8 wants.

Changing the methods to public, and running with Java8, all 1887 tests pass.

rolfl added a commit that referenced this issue Apr 4, 2014

@puntogil

This comment has been minimized.

Show comment
Hide comment

@rolfl rolfl closed this in 884c0ac Apr 5, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment