Coder Social home page Coder Social logo

Comments (4)

jdereg avatar jdereg commented on August 26, 2024

I believe there are uses of the 'diamond operator' used that may stop the
source from being compiled:

List<String> names = new ArrayList<>()

I have no problem with you forking the json-io repo, and modifying the
source there to be JDK 1.6 compliant. Then feel free to share the link to
your repo as the 1.6 json-io. I'd hope that you would keep it up-to-date
with changes to the Cedar Software json-io. I don't plan to move to JDK
1.8 until 1.7 is sunsetted. Even then, I will try to hold off. Lambda
functions would be the main enticement to move to JDK 1.8.

On Thu, Apr 23, 2015 at 1:53 PM, SlimerDude [email protected]
wrote:

Assuming the lib doesn't use any newer Java features, could the source be
recompiled so it's compatible with older versions of Java?

Being a JDK 1.6 user I currently get:

Unsupported major.minor version 51.0

This SO question
http://stackoverflow.com/questions/10382929/how-to-fix-unsupported-major-minor-version-51-0-error
explains a bit more if you're unsure.

I know I can do it myself, but it's always nice not having to build from
source.


Reply to this email directly or view it on GitHub
#38.

from json-io.

SlimerDude avatar SlimerDude commented on August 26, 2024

Generics were introduced in Java 1.5, so diamond operators shouldn't be a problem.

To produce backwards compatible class files shouldn't take much more than setting the target option in the compiler. Here's a link on how to set it in the Maven .pom file.

from json-io.

jdereg avatar jdereg commented on August 26, 2024

The diamond operator (on the RHS) support was not added (as I understand
it) until Java 1.7. Please try it and see if you can compile the example
line I sent.

On Sat, Apr 25, 2015 at 8:14 AM, SlimerDude [email protected]
wrote:

Generics were introduced in Java 1.5, so diamond operators shouldn't be
a problem.

To produce backwards compatible class files shouldn't take much more than
setting the target option in the compiler. Here's a link on how to set it
in the Maven .pom file
http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
.


Reply to this email directly or view it on GitHub
#38 (comment).

from json-io.

SlimerDude avatar SlimerDude commented on August 26, 2024

With regards to the line:

List<String> names = new ArrayList<>()

while the syntax is Java 1.7, the JDK can still compile it to Java 1.5 / 1.6 compatible byte code resulting in a class file usable by all (the purpose of the said target compiler option).

But on further inspection of the source code, I see you're using java.lang.ReflectiveOperationException in MetaUtils which was only introduced in Java 1.7 - so obviously those references won't resolve in earlier JDKs.

Oh well - I was only after a quick one-liner for pretty printing JSON. Hope you don't mind but I've gone with the usual GSON...

from json-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.