Skip to content

Clarify targeted Java version #145

Open

Description

@dbaston

I'm not able to find anything in the POM files or project documentation that states which version of Java is targeted by JTS. (Does Maven default to Java 5?).

Activity

  1. dr-jts commented on Sep 1, 2017

    @dr-jts
    Contributor

    Would be nice, especially once #146 is resolved.

    Perhaps Java 1.7? Not sure there's any point in staying with 1.5. I think TestBuilder needs 1.7 for finicky Swing API reasons.

  2. dsmiley commented on Sep 1, 2017

    @dsmiley

    I think the point here isn't the merits of one version over another, it's about the pom stating the version explicitly: https://github.com/locationtech/spatial4j/blob/master/pom.xml#L172 IMO every project ought to do this explicitly (and vast majority do); it's a shame Maven doesn't make you because it's presumptuous to depend on the JVM the user is using to run Maven itself.

  3. dr-jts commented on Sep 2, 2017

    @dr-jts
    Contributor

    @dsmiley Fair enough. But in order to state the version we first need to decide what the version should be.

  4. dr-jts commented on Oct 16, 2017

    @dr-jts
    Contributor

    Are there actually two issues here? Which Java to use for compiling, and which versions JTS will run on? And is there a relationship between them? I.e. if we compile with 1.7 can it still run on say 1.5 or even earlier?

  5. dbaston commented on Oct 17, 2017

    @dbaston
    ContributorAuthor

    I don't have experience targeting an earlier Java version than what I'm compiling on, but it seems like it could complicate project development and testing (developers would need to verify that standard library methods used are in fact available in the earlier versions, and that they behave equivalently, right?)

    Is JTS used on platforms that do not support Java 8? (whether the project wants to use Java 8 features being another matter)

  6. mprins commented on Oct 17, 2017

    @mprins
    Contributor

    FWIW you can just add the following properties to the parent pom:

    <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            ....

    for java 8 (or 1.7 for java 7 or...), by default maven uses 1.5 because that is what the compiler plugin is defined to do.

    IMHO, since the new release will also be a change in groupId I'd say it would be a safe bet to pin to 1.7 (unless you want to use closures etc..)

  7. jnh5y commented on Oct 28, 2017

    @jnh5y
    Contributor

    Can we pick a source and target version for the 1.15.0 release?

  8. jnh5y commented on Oct 28, 2017

    @jnh5y
    Contributor

    Generally, I'd suggest one of two options:

    A. Be conservative, and pick something like 1.5.
    B. Note that Java 7 has been EOL'ed for over two years, and pick Java 1.8.

  9. snodnipper commented on Jan 15, 2018

    @snodnipper

    just for the record, we use JTS for Android apps. Java 1.8 on android is pretty sketchy - some Java 1.8 classes / methods are unsupported depending on android version etc. Conservative is good for us 👍

    https://developer.android.com/studio/write/java8-support.html

  10. jnh5y commented on Jan 15, 2018

    @jnh5y
    Contributor

    @snodnipper Do you know anything we can use in a Maven build to verify/check that JTS would be compatible with Android? (It sounds like Android compatibility will not be captured entirely by the Maven/compiler language version targeting options.)

    Overall, I'd like to see JTS be as useful as possible while at the same time letting the project leverage as many Java features as possible.

  11. snodnipper commented on Jan 15, 2018

    @snodnipper

    @jnh5y - elegantly no. Typically, one would build with the Android gradle build tools, which have all kinds of lint checks. There is the android-maven-plugin but I haven't used that for years.

    Practically, 1.7 should be fine and CI building/testing with the Android build tools would give feedback without everyone having to install the Android SDK. 1.8 syntax can be ok too but clearly there are API chunks missing for many devices - where the app would terminate.

    okhttp is an example of a maven project with Android artifacts.

    We use CircleCI for feedback ourselves, our search repo is an (old) example.

  12. dr-jts commented on Jan 15, 2018

    @dr-jts
    Contributor

    So is the TLDR: target JTS to build on 1.7 ?

    If so, that seems reasonable to me.

  13. added a commit that references this issue on Mar 27, 2018
    e4561a7
  14. dbaston commented on Aug 28, 2018

    @dbaston
    ContributorAuthor

    Given that JTS now uses interface default methods (for example, here) it seems like the target is now 1.8.

  15. karussell commented on Nov 1, 2018

    @karussell

    Staying at Java 1.7 would help us with Android support - see graphhopper/graphhopper#1469

  16. dr-jts commented on Nov 1, 2018

    @dr-jts
    Contributor

    Traditionally JTS has tried to stay at older Java versions to help with this very issue (and also to minimize issues in porting new Java language features).

    The use of interface default methods definitely made the additions to the Coordinate code easier, though. Is there another option for this that would preserve Java 7 compatibility?

    Thoughts @jodygarnett @jnh5y ?

  17. jnh5y commented on Nov 2, 2018

    @jnh5y
    Contributor

    If the default interface methods are the only hang-up, I could imagine going back to pick up Java 7 support. That said, @jodygarnett and I were just at a code sprint focusing on Java 11 support for GeoServer.:)

    Are there any other Java 8 features we are using?

  18. dr-jts commented on Nov 2, 2018

    @dr-jts
    Contributor

    No other Java8 dependencies t that I know of.

    Would keeping JTS at Java7 be a problem for Java11 support?

  19. jnh5y commented on Nov 2, 2018

    @jnh5y
    Contributor

    I don't think there would be any particular issues supporting all the versions. If there are things that come up, we may be able to maintain a few versions/branches for some period of time...

  20. jnh5y commented on Nov 2, 2018

    @jnh5y
    Contributor

    (I was more commenting out loud. It seems like Android and Oracle may push/pull libraries in different directions.)

  21. dbaston commented on Dec 26, 2019

    @dbaston
    ContributorAuthor

    Would it be reasonable to specify the compile version at 1.8 in the root pom.xml for now (to fix the build failure described in #276) and then update the version to 1.7 at a later date if the associated code changes are made?

  22. dbaston commented on Dec 26, 2019

    @dbaston
    ContributorAuthor

    Would it be reasonable to specify the compile version at 1.8 in the root pom.xml for now

    Looks like this was done at d13f230. Probably this issue can be closed then?

  23. dsmiley commented on Aug 1, 2020

    @dsmiley

    For posterity: Java 1.8 is the version JTS uses as of v 1.17. I see it in the release notes too (good). It seems to have come about accidentally but it's just as well to upgrade out of that old version.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions