Enable and fix 'Statement unnecessarily nested within else clause' warnings

Change-Id: Ida6df4593fc2ab3c11581309b2b4a638229ea093
This commit is contained in:
David Pursehouse
2016-06-01 21:20:02 +09:00
parent b88b47d4b1
commit 323247227d
132 changed files with 542 additions and 724 deletions

View File

@@ -51,9 +51,8 @@ public class RelativeDateFormatter {
long seconds = round(ageMillis, SECOND_IN_MILLIS);
if (seconds == 1) {
return C.oneSecondAgo();
} else {
return M.secondsAgo(seconds);
}
return M.secondsAgo(seconds);
}
// minutes
@@ -61,9 +60,8 @@ public class RelativeDateFormatter {
long minutes = round(ageMillis, MINUTE_IN_MILLIS);
if (minutes == 1) {
return C.oneMinuteAgo();
} else {
return M.minutesAgo(minutes);
}
return M.minutesAgo(minutes);
}
// hours
@@ -71,9 +69,8 @@ public class RelativeDateFormatter {
long hours = round(ageMillis, HOUR_IN_MILLIS);
if (hours == 1) {
return C.oneHourAgo();
} else {
return M.hoursAgo(hours);
}
return M.hoursAgo(hours);
}
// up to 14 days use days
@@ -81,9 +78,8 @@ public class RelativeDateFormatter {
long days = round(ageMillis, DAY_IN_MILLIS);
if (days == 1) {
return C.oneDayAgo();
} else {
return M.daysAgo(days);
}
return M.daysAgo(days);
}
// up to 10 weeks use weeks
@@ -91,9 +87,8 @@ public class RelativeDateFormatter {
long weeks = round(ageMillis, WEEK_IN_MILLIS);
if (weeks == 1) {
return C.oneWeekAgo();
} else {
return M.weeksAgo(weeks);
}
return M.weeksAgo(weeks);
}
// months
@@ -101,9 +96,8 @@ public class RelativeDateFormatter {
long months = round(ageMillis, MONTH_IN_MILLIS);
if (months == 1) {
return C.oneMonthAgo();
} else {
return M.monthsAgo(months);
}
return M.monthsAgo(months);
}
// up to 5 years use "year, months" rounded to months
@@ -114,18 +108,16 @@ public class RelativeDateFormatter {
String monthLabel = (months > 1) ? C.months() : (months == 1 ? C.month() : "");
if (months == 0) {
return M.years0MonthsAgo(years, yearLabel);
} else {
return M.yearsMonthsAgo(years, yearLabel, months, monthLabel);
}
return M.yearsMonthsAgo(years, yearLabel, months, monthLabel);
}
// years
long years = round(ageMillis, YEAR_IN_MILLIS);
if (years == 1) {
return C.oneYearAgo();
} else {
return M.yearsAgo(years);
}
return M.yearsAgo(years);
}
private static long upperLimit(long unit) {

View File

@@ -208,9 +208,8 @@ public class ChangeInfo extends JavaScriptObject {
// more than one label is missing, so it's unclear which to quick
// approve, return -1
return -1;
} else {
ret = i;
}
ret = i;
continue;
case OK: // Label already applied.

View File

@@ -159,9 +159,8 @@ public class GitwebInfo extends JavaScriptObject {
private String encode(String segment) {
if (type().urlEncode()) {
return URL.encodeQueryString(type().replacePathSeparator(segment));
} else {
return segment;
}
return segment;
}
protected GitwebInfo() {