Skip to content
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

Refactor language level migration #459

Merged
merged 3 commits into from
Apr 15, 2019

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Apr 11, 2019

This PR makes 3 changes as reported via Android Studio inspection:

  • Removing redundant information from type brackets
  • Replacing large if statement with switch statement

we should prefer a switch statement for longer conditional branches (3+) as it reads better
@fractalwrench fractalwrench changed the base branch from master to inspection-fixes April 11, 2019 09:52
@fractalwrench fractalwrench force-pushed the refactor-language-level-migration branch from c342193 to f6bb473 Compare April 11, 2019 15:49
Copy link
Contributor

@simonbowring simonbowring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, few minor comments

reader.endObject();
} else {
reader.skipValue();
switch (name) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could just do switch (reader.nextName()) { as the name variable is only used once

handled = reader.nextInt();
} else {
reader.skipValue();
switch (name) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

reader.beginObject();
while (reader.hasNext()) {
String eventName = reader.nextName();
switch (eventName) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@fractalwrench fractalwrench merged commit bf2f6d1 into inspection-fixes Apr 15, 2019
@fractalwrench fractalwrench deleted the refactor-language-level-migration branch April 15, 2019 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants