-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Formats codebase #2531
Formats codebase #2531
Conversation
* @see #fromJson(String, Class) | ||
* @see #fromJson(Reader, TypeToken) | ||
*/ | ||
public <T> T fromJson(Reader json, Class<T> classOfT) throws JsonSyntaxException, JsonIOException { | ||
public <T> T fromJson(Reader json, Class<T> classOfT) |
Check notice
Code scanning / CodeQL
Confusing overloading of methods Note
fromJson
List<TypeAdapterFactory> factories = | ||
new ArrayList<>(this.factories.size() + this.hierarchyFactories.size() + 3); |
Check notice
Code scanning / CodeQL
Possible confusion of local and field Note
create
factories
@SuppressWarnings("deprecation") // superclass constructor | ||
public JsonObject() { | ||
} | ||
public JsonObject() {} |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note
JsonElement.JsonElement
// 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 Warning
date
this
} 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 Warning
date
this
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.
Thanks!
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:jar
passes without errors