Formats codebase - #2531
Conversation
| @@ -1143,13 +1205,13 @@ public <T> T fromJson(Reader json, Class<T> classOfT) throws JsonSyntaxException | |||
| * non-generic objects, use {@link #fromJson(Reader, Class)} instead. If you have the JSON in a | |||
| * String form instead of a {@link Reader}, use {@link #fromJson(String, Type)} instead. | |||
| * | |||
Check notice
Code scanning / CodeQL
Confusing overloading of methods
| List<TypeAdapterFactory> factories = | ||
| new ArrayList<>(this.factories.size() + this.hierarchyFactories.size() + 3); |
Check notice
Code scanning / CodeQL
Possible confusion of local and field
| @SuppressWarnings("deprecation") // superclass constructor | ||
| public JsonObject() { | ||
| } | ||
| public JsonObject() {} |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation
| // if the value has no time component (and no time zone), we are done | ||
| boolean hasT = checkOffset(date, offset, 'T'); | ||
|
|
||
| if (!hasT && (date.length() <= offset)) { |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null
| } else { | ||
| throw new IndexOutOfBoundsException("Invalid time zone indicator '" + timezoneIndicator+"'"); | ||
| // second and milliseconds can be optional | ||
| if (date.length() > offset) { |
Check warning
Code scanning / CodeQL
Dereferenced variable may be null
|
For anyone who wants to verify that these changes are legit, do the following:
You should obtain a state nearly identical to what this PR includes. The only changes are in 26 files were comments were modified (I assume because the Spotless plugin / Google Formatter did not properly wrap them). @MaicolAntali, just for clarification, you edited those comments, right? |
|
FWIW the check I used was to import this change into Google's build system, which does not include timestamps in jar files. Then compile before and after with |
Exactly, What I have done:
Original: // Lorem Ipsum is simply dummy text of the printing and typesetting industry.
// Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
// when an unknown printer took a galley of type and scrambled it to make a type specimen book. Edited by spotless: // Lorem Ipsum is simply dummy text of the printing and
// typesetting industry.
// Lorem Ipsum has been the industry's standard dummy text ever since the
// 1500s,
// when an unknown printer took a galley of type and scrambled it to make a type specimen book. Committed: // Lorem Ipsum is simply dummy text of the printing and
// typesetting industry. Lorem Ipsum has been the industry's
// standard dummy text ever since the 1500s, when an
// unknown printer took a ... |
|
Thanks for the confirmation from you both and thanks @MaicolAntali for your dedication with this by manually improving the comment formatting!
Thanks for the hint. It looks like locally you can achieve this using the following Maven command: I only tried this on the changes I obtained locally by running |
* Formats `.java` files * Formats `.md` files
Purpose
Reformat the Gson codebase to follow the Google Java Style Guide
Checklist
null@since $next-version$(
$next-version$is a special placeholder which is automatically replaced during release)TestCase)mvn clean verify javadoc:jarpasses without errors