Skip to content

Is it time for Java8+ support? #614

Closed
@johnjaylward

Description

@johnjaylward

Oracle itself has ended support for Java8 and many companies are starting to move off of 8 and onto at least 11 (the next [and current] LTS after 8). Oracle has the next LTS at 17 due Sept 2021.

Java 8 was released in 2014 and Java 11 in 2018. Java 6 was release first in 2006 and java 7 released in 2011. This puts us at requiring a fairly ancient version at this point. The last public release of Java6 was 2015 (6 years ago)

Some of the main reasons for us originally maintaining such an old version were:

  1. Use of Java6 in some embedded devices that could not be upgraded
  2. Requirement of Java6 APIs by Android.

I think at this time we can probably just drop the "embedded" limitation. Many of those devices are extremely old, and older versions of the library should be usable in those environments.

For Android, I did some digging, and it looks like Java 8 is still the "best" supported version, but Java 11 is supported through a "desugaring" tool that Android provides

It appears that for now, bumping from Java 6 to 8 (or better 11) is a good move. Android also appears to be moving away from "java" as a language and instead to Kotlin. This may mean that if we switch to a higher language version (12+), Android may not support some newer APIs included in the new version (like the addition of java.time in Java 8)

I think moving to at least Java 8 (preferably Java 11) would be beneficial in supporting the following options:

  • Introduced with Java 7

    1. try-with-resources
    2. Multi-catch exceptions
    3. Type inference syntactic sugar
    4. Value literal syntactic sugar
  • Introduced with Java 8 (LTS until 2022-03)

    1. Lambda support
    2. Optional support (feature requests Java8 Optional? #177, Support for Java 8 optionals #409)
    3. Method references
    4. New Date/Time classes (possibly adding new opt/get functions for them?)
    5. Improved type inference syntactic sugar
    6. New stream classes
    7. Performance improvements with HashMap key collisions
  • Introduced in Java 9

    1. Modules (Feature requests Add Automatic-Module-Name to package #431, I would like to strictly name the module #451, No modules support #478, Make use of module-info.java #513) (Bug Not Working At All for java bean serialization. #480 - not working in modularized project)
  • Introduced in Java 10

    1. Improved type inference syntactic sugar
  • Introduced in Java 11 (LTS until 2023-09)

    1. Improves Lambda local variable support
    2. Improved bytecode output for nested classes : No more $Outer$Inner.class generation and removal of synthetic accessors for nested elements (This should improve our performance of the JSONObject.NULL object)
  • Introduced with Java 12

    1. Switch Expressions and Pattern Matching
    2. Pattern Matching of instanceof
    3. Better GC performance for some use-cases
  • Introduced with Java 13

    1. Text Blocks -> could be helpful for simplifying the look/feel of test data in test cases
    2. Improvements for Switch expressions from Java 12
    3. More GC improvements
  • Introduced with Java 14

    1. Records -> We should ensure that our Bean->JSONObject code works for this new type
      1. There are new reflection points to make working with Records easy
    2. Better NPE messages, although we hopefully don't have anything that generates these
  • Introduced with Java 15

    1. New "sealed" classes... not sure this is actually useful to us.
    2. New "hidden" classes, again not sure if this has any actual use for us
  • Introduced with Java 16

    1. "Primitive Classes" -> Value based classes that act as primitives (i.e. Integer class would be treated as int primitive as far as the compiler/JVM are concerned). This would reduce boxing efforts when working with wrapper classes
  • Introduced with Java 17 (LTS until 2026-09 or later, date subject to change)

    1. Nothing really new here not mentioned above to v12. Some of the items above are still labeled "incubator" or "preview" and are not fully supported in the LTS ("primitive classes" is one example)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions