-
Notifications
You must be signed in to change notification settings - Fork 579
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 'org.json:json' lib with 'com.google.code.gson' lib #1437
Changes from 6 commits
77aa961
70116ab
35eacab
31c5edf
8e888d4
ce58c45
b923c88
540b592
c2b3405
e41d5e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,13 @@ | |
|
||
import edu.umd.cs.findbugs.BugRankCategory; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import org.json.JSONString; | ||
|
||
/** | ||
* An enum representing {@code level} property. | ||
* | ||
* @see <a href="https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/sarif-v2.1.0-cs01.html#_Toc16012604">3.27.10 level property</a> | ||
*/ | ||
enum Level implements JSONString { | ||
enum Level { | ||
/** | ||
* The rule specified by ruleId was evaluated and a problem was found. | ||
*/ | ||
|
@@ -27,9 +26,8 @@ enum Level implements JSONString { | |
*/ | ||
NONE; | ||
|
||
@Override | ||
public String toJSONString() { | ||
return String.format("\"%s\"", name().toLowerCase()); | ||
public String toJsonString() { | ||
return name().toLowerCase(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this method? The old one was provided to configure the org.json's serializer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added SerializedName annotation to the enum. Its useful if we use Gson toJson/fromJson methods to serialize/deserialize objects. Current we create/setup JsonObject instead serializing object. e.g.
I think after POJO classes are introduced we should be able to use object serialization/deserialization and not need this method anymore There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also tried |
||
} | ||
|
||
@NonNull | ||
|
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.
Is are any reason to prefer
String.valueOf( ... )
overorganization.toString()
? If so, I want to make the intention clear.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.
Fixed.
organization was declared as Object it should be String