mmj2 icon indicating copy to clipboard operation
mmj2 copied to clipboard

Deprecated methods

Open billh0420 opened this issue 4 years ago • 5 comments

There are several places where deprecated methods are being used.

For example: "final Double d = new Double(value);"

The suggested correction is: "final Double d = Double.valueOf(value);"

I am willing to make these changes and submit a pull request from my fork. Is this worthwhile doing? Will it be accepted? Thanks.

Other examples:

"this.put(key, new Integer(value));"

"this.put(index, new Long(value));"

billh0420 avatar Jan 07 '21 17:01 billh0420

Try not to use anything that doesn't work on JDK 1.5, but otherwise this should be fine.

digama0 avatar Jan 08 '21 00:01 digama0

The Installation instructions say "We recommend JDK version 11 (at least) to run." Should it be backward compatible to JDK 1.5?

In Eclipse IDE, there is a preference to set "compiler compliance level" to 1.5, 11, or 14 and things in between. Is this the setting I should change?

billh0420 avatar Jan 08 '21 01:01 billh0420

It is definitely supported on at least JDK 9, and JDK 5 is from memory (certainly not before that, because we use generics, and in fact I think we use the diamond operator new T<>() which was only introduced in JDK 6, and lambdas from JDK 8). So actually I probably want to say JDK 8. Most accurately, you should ensure that you aren't bumping the minimum supported version, whatever it is (and I guess you can play with that compliance setting to get eclipse to tell you what it is for sure). The JDK 11 mention you found is the latest tested version, not the minimum supported version.

digama0 avatar Jan 08 '21 02:01 digama0

These deprecated methods appear in "lib/JSON-java/org" which doesn't seem to be a real part of mmj2. Therefore, I will not make any modifications to them.

billh0420 avatar Jan 08 '21 04:01 billh0420

As for the java version, I encounter warnings and unwanted behavior of mmj2 with JDK >= 9 and I have to downgrade to JDK 8 (see thread https://groups.google.com/g/metamath/c/WFoQTXy17lU/m/cm4tqs6yDQAJ), so I'm not sure why the installation instructions (https://github.com/digama0/mmj2/blob/master/INSTALL.md) recommend JDK >= 11.

benjub avatar Jan 08 '21 10:01 benjub