-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecated constructor calls with primitive argument - Xlint warnings #47
Comments
These deprecation warnings are mainly due to the use of the Number constructor on the primitive types. We could change those to use the static method valueOf instead. However there seems to have cases where the Number constructor is used intendedly. So for instance in the BoxObjectCacheTest: Just want to make sure that there will be no other side effects once we made the changes. The other workaround is to simply disable |
Hi Gayan,
This is indeed a special case.
I think it's safe to convert all the normal cases and use
@SuppressWarnings("deprecation")
for the rare cases where bypassing the Integer cache is intentional.
With the annotation, we don't have to turn off the warning globally and
still get to see and fix the other instances of deprecated methods.
Gayan Weerakutti wrote:
… These deprecation warnings are mainly due to the use of the Number
constructor on the primitive types. We could change those to use the static
method valueOf instead. However there seems to have cases where the Number
constructor is used intendedly.
So for instance in the BoxObjectCacheTest:
https://github.com/javapathfinder/jpf-core/blob/master/src/tests/gov/nasa/jpf/test/java/lang/BoxObjectCacheTest.java#L137
Just want to make sure that there will be no other side effects once we
made the changes.
The other workaround is to simply disable |Xlint:deprecation|. But in that
case we won't gain the performance benefits claimed by |valueOf|.
@cyrille-artho <https://github.com/cyrille-artho> @Octarine-J
<https://github.com/Octarine-J>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#47 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AG9eR-553nrxOL3LD8F1n_7MIKtAOseXks5tz_eLgaJpZM4UFqKh>.
--
Regards,
Cyrille Artho - http://artho.com/
Always think of something new; this helps you forget your last rotten idea.
-- Seth Frankel
|
Explicit manual boxing (i.e. wrapping of primitive values in objects) is unnecessary under Java 5 and newer, and can be safely removed. Issue: javapathfinder#47
Explicit manual boxing (i.e. wrapping of primitive values in objects) is unnecessary under Java 5 and newer, and can be safely removed. Issue: javapathfinder#47
Explicit manual boxing (i.e. wrapping of primitive values in objects) is unnecessary under Java 5 and newer, and can be safely removed. Issue: javapathfinder#47
Instantiating a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument is deprecated. It is recommended that we use the more efficient static method valueOf() (introduced in Java 5) instead, which caches objects for values between -128 and 127 inclusive. However in JPF, there are few cases where the use of Number constructor is intentional (So to bypass the caching). This commit suppress warnings from appearing in such cases. Issue: javapathfinder#47
Explicit manual boxing (i.e. wrapping of primitive values in objects) is unnecessary under Java 5 and newer, and can be safely removed. Issue: javapathfinder#47
Explicit manual boxing (i.e. wrapping of primitive values in objects) is unnecessary under Java 5 and newer, and can be safely removed. Issue: javapathfinder#47
Explicit manual boxing (i.e. wrapping of primitive values in objects) is unnecessary under Java 5 and newer, and can be safely removed. Issue: javapathfinder#47
Instantiating a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument is deprecated. It is recommended that we use the more efficient static method valueOf() (introduced in Java 5) instead, which caches objects for values between -128 and 127 inclusive. However in JPF, there are few cases where the use of Number constructor is intentional (So to bypass the caching). This commit suppress warnings from appearing in such cases. Issue: javapathfinder#47
…gument (#58) * Remove explicit manual boxing in main, peers, and tests Explicit manual boxing (i.e. wrapping of primitive values in objects) is unnecessary under Java 5 and newer, and can be safely removed. Issue: #47 * Suppress warnings in which Number constructor is used intentionally Instantiating a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument is deprecated. It is recommended that we use the more efficient static method valueOf() (introduced in Java 5) instead, which caches objects for values between -128 and 127 inclusive. However in JPF, there are few cases where the use of Number constructor is intentional (So to bypass the caching). This commit suppress warnings from appearing in such cases. Issue: #47
Good work. There are still a few open cases in "tests", so I've reopened this issue. |
Replace attempts to instantiate a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument, with more efficient static method valueOf() (introduced in Java 5), which will cache objects for values between -128 and 127 inclusive. We can't use assertEquals(42, obj.i); in gov.nasa.jpf.test.vm.reflection.ConstructorTest#testConstructorCallInteger as both assertEquals (Object, Object) and assertEquals (int, int) in TestJPF match (Ambiguous method call) Issue: javapathfinder#47
Replace attempts to instantiate a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument, with more efficient static method valueOf() (introduced in Java 5), which will cache objects for values between -128 and 127 inclusive. We can't use assertEquals(42, obj.i); in gov.nasa.jpf.test.vm.reflection.ConstructorTest#testConstructorCallInteger as both assertEquals (Object, Object) and assertEquals (int, int) in TestJPF match (Ambiguous method call) Issue: javapathfinder#47
Replace attempts to instantiate a new Long, Integer, Short or Byte object from a primitive long, integer, short or byte argument, with more efficient static method valueOf() (introduced in Java 5), which will cache objects for values between -128 and 127 inclusive. We can't use assertEquals(42, obj.i); in gov.nasa.jpf.test.vm.reflection.ConstructorTest#testConstructorCallInteger as both assertEquals (Object, Object) and assertEquals (int, int) in TestJPF match (Ambiguous method call) Issue: javapathfinder#47
This is a fixup for the commit ddd3c52 Issue: javapathfinder#47
This type of warning has now been eliminated for entire jpf-core. |
Double (double) is deprecated. It is suggested that we use the static factory #valueOf(double), as it is likely to yield significantly better space and time performance. This is a fixup for issue: javapathfinder#47 This is a follow-up to the PR: javapathfinder#59
Double (double) is deprecated. It is suggested that we use the static factory #valueOf(double), as it is likely to yield significantly better space and time performance. This is a fixup for issue: javapathfinder#47 This is a follow-up to the PR: javapathfinder#59
Double (double) is deprecated. It is suggested that we use the static factory #valueOf(double), as it is likely to yield significantly better space and time performance. This is a fixup for issue: javapathfinder#47 This is a follow-up to the PR: javapathfinder#59
Several deprecation warnings are showing up on the build logs when compiled with JDK 9 and later.
https://travis-ci.org/javapathfinder/jpf-core/builds/379204138#L2431
The text was updated successfully, but these errors were encountered: