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

java 8 problems #129

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

java 8 problems #129

puntogil opened this issue Apr 4, 2014 · 5 comments

Comments

@puntogil
Copy link

@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
Copy link
Owner

@hunterhacker 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
Copy link
Collaborator

@rolfl 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
Copy link
Author

@puntogil puntogil commented Apr 4, 2014

Sure, thanks for your help
regards

@rolfl
Copy link
Collaborator

@rolfl 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
Copy link
Author

@puntogil puntogil commented Apr 4, 2014

@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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.