json_simple uses deprecated-for-removal primitive constructors

Issue #219 resolved
Mitch Dusina created an issue

OpenJDK documentation. Eventually these constructors will be removed/made private and client code using that version of the JDK will fail to compile.

There appears to only be two affected classes. I’ve linked to the first instance in each one (but there’re more than just one).

This doesn’t appear to be fixed upstream yet. So perhaps treat this as a tracking bug to merge fixes when they become available (unless you maintain local patches).

Comments (6)

  1. Brian Campbell repo owner

    Thanks for raising this Mitch, I was blissfully unaware. (I do now see JSONParser.java uses or overrides a deprecated API that is marked for removal. etc output from the build).

    For better or worse, no relation with the original json-simple code has been maintained. So these changes should probably just be made here in this project. As I understand it, those changes amount to using valueOf(...) rather than the constructors?

  2. Mitch Dusina reporter

    Yeah (sorry for not sending a pull request, until this morning I didn’t have a Bitbucket account).

    • JSONParser: new Integer(...) -> Integer.valueOf(...)
    • Yylex: new Character(yycharat(0)) -> yycharat(0) (although before and after, this leaks one character of potentially sensitive JSON in an exception message)

  3. Brian Campbell

    No need to apologize. I should probably apologize for not having moved away from Bitbucket :/ Anyway, I’ll make those changes. Thanks again for raising this.

  4. Log in to comment