-
Notifications
You must be signed in to change notification settings - Fork 343
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
replace deprecated Constructor based initialization of primitive type… #488
replace deprecated Constructor based initialization of primitive type… #488
Conversation
// Verify.setLocalAttribute("v", 4200); | ||
// | ||
// // explicit | ||
// Integer o = Integer.valueOf(v); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the first half of the test still works? If we can keep the part with the explicit cast, that would be preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicit means Integer in = new Integer ()
?
// int attr = Verify.getLocalAttribute("j"); | ||
// assert attr == 4200; | ||
// | ||
// // semi autoboxed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the part above works, we can start comment out this part.
I think it is nicer to use /*
here, akin to the commented-out part below. Definitely not //
in addition to /*
.
With /*
.../*
, we clearly mark two blocks of code as being parts of the test that do not (or do no longer) work. With //
, we lose that information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, none of the Assertion works.
Pavel taught me that Local Variable
and Local Attribute
are different entities in JPF.
Constructor type initialisation passes the value of Local Variables
to Local Attributes
but in case of new method it doesn't.
There are two assert statements and none of them work. Pavel suggested that
this might be due to Local Variables and Local Attributes miscommunication
in new method.
…On Fri, 2 Aug, 2024, 12:27 pm cyrille-artho, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In src/tests/gov/nasa/jpf/test/mc/basic/AttrsTest.java
<#488 (comment)>
:
> +
+
+
+
+ // Constructor based initialization is deprecated in Java 17. So we have to replace with "WrapperClass.valueOf(...)" based initialization.
+ // This below test has been commented out because we have an error when we replace the old constructor type initialization of Wrapper Class of primitive type int with "WrapperClass.valueOf(..)."
+ // Example : { Integer o = new Integer(v) } works but { Integer o = Integer.valueOf(v) } don't.
+
+// @SuppressWarnings("deprecation")
+// @test public void testInteger() {
+// if (verifyNoPropertyViolation()) {
+// int v = 42;
+// Verify.setLocalAttribute("v", 4200);
+//
+// // explicit
+// Integer o = Integer.valueOf(v);
I thought that the first half of the test still works? If we can keep the
part with the explicit cast, that would be preferable.
------------------------------
In src/tests/gov/nasa/jpf/test/mc/basic/AttrsTest.java
<#488 (comment)>
:
> + // This below test has been commented out because we have an error when we replace the old constructor type initialization of Wrapper Class of primitive type int with "WrapperClass.valueOf(..)."
+ // Example : { Integer o = new Integer(v) } works but { Integer o = Integer.valueOf(v) } don't.
+
+// @SuppressWarnings("deprecation")
+// @test public void testInteger() {
+// if (verifyNoPropertyViolation()) {
+// int v = 42;
+// Verify.setLocalAttribute("v", 4200);
+//
+// // explicit
+// Integer o = Integer.valueOf(v);
+// int j = o.intValue();
+// int attr = Verify.getLocalAttribute("j");
+// assert attr == 4200;
+//
+// // semi autoboxed
If the part above works, we can start comment out this part.
I think it is nicer to use /* here, akin to the commented-out part below.
Definitely not // in addition to /*.
With /*.../*, we clearly mark two blocks of code as being parts of the
test that do not (or do no longer) work. With //, we lose that
information.
—
Reply to this email directly, view it on GitHub
<#488 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASVOVF7M6N4U6NFK6NUBUWDZPMUVXAVCNFSM6AAAAABL3GS4H6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEMJUHAYDCMJRHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I see. In this case, please modify this PR to first retain the problematic test as is (with no code changes, keeping the code that produces compiler warnings). |
…'s Wrapper Class with WrapperClass.valueOf(value)
f6dc122
to
a64a935
Compare
Made those changes, please review |
Great, thanks! |
…'s Wrapper Class with WrapperClass.valueOf(value)