Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private int compareTo(FlowComment other) {
}
if (thisOrder == null && otherOrder == null) {
int compareLines = Integer.compare(line, other.line);
return compareLines != 0 ? compareLines : Integer.compare(startColumn, other.startColumn);
return compareLines == 0 ? Integer.compare(startColumn, other.startColumn) : compareLines;
}
throw new AssertionError("Mixed explicit and implicit order in same flow." + System.lineSeparator() + this + System.lineSeparator() + other);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static int findEndOfMarkdownQuote(String javadoc, int startPosition) {
matcher.region(startPosition, javadoc.length());
if (matcher.lookingAt()) {
boolean closingQuotesFound = matcher.find(startPosition + 3);
return !closingQuotesFound ? -1 : matcher.end();
return closingQuotesFound ? matcher.end() : -1;
} else {
int closingQuotePosition = javadoc.indexOf("`", startPosition + 1);
return closingQuotePosition == -1 ? -1 : (closingQuotePosition + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ private static String toSymbolicPermissions(String value) {
StringBuilder sb = new StringBuilder();
for (char digit : value.substring(1).toCharArray()) {
int bits = digit - '0';
sb.append((bits & 4) != 0 ? 'r' : '-')
.append((bits & 2) != 0 ? 'w' : '-')
.append((bits & 1) != 0 ? 'x' : '-');
sb.append((bits & 4) == 0 ? '-' : 'r')
.append((bits & 2) == 0 ? '-' : 'w')
.append((bits & 1) == 0 ? '-' : 'x');
}
return sb.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void visitNode(Tree tree) {
int types = ((CompilationUnitTree) tree).types().size();
if (types > 1) {
context.addIssue(
-1, OneClassInterfacePerFileCheck.this, "There are " + types + " top-level types in this file; move all but one of them to other files.", types - 1);
-1, this, "There are " + types + " top-level types in this file; move all but one of them to other files.", types - 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ExecutionTime(String file, long analysisTime, long lengthInBytes) {

private static final Comparator<ExecutionTime> ORDER_BY_ANALYSIS_TIME_DESCENDING_AND_FILE_ASCENDING = (a, b) -> {
int compare = Long.compare(b.analysisTime, a.analysisTime);
return compare != 0 ? compare : a.file.compareTo(b.file);
return compare == 0 ? a.file.compareTo(b.file) : compare;
};

private final LinkedList<ExecutionTime> recordedOrderedExecutionTime = new LinkedList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ static JavaTree.CompilationUnitTreeImpl convert(String version, String unitName,
.filter(IS_UNDEFINED_TYPE_ERROR)
.map(i -> new JProblem(
i.getMessage(),
(i.getID() & IProblem.PreviewFeatureUsed) != 0 ? JProblem.Type.PREVIEW_FEATURE_USED : JProblem.Type.UNDEFINED_TYPE))
(i.getID() & IProblem.PreviewFeatureUsed) == 0 ? JProblem.Type.UNDEFINED_TYPE : JProblem.Type.PREVIEW_FEATURE_USED))
.collect(Collectors.toSet());

JParser converter = new JParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private static long getTimeAttributeInMS(String value) throws XMLStreamException
// hardcoded to Locale.ENGLISH see http://jira.codehaus.org/browse/SONAR-602
try {
Double time = ParsingUtils.parseNumber(value, Locale.ENGLISH);
return !Double.isNaN(time) ? (long) ParsingUtils.scaleValue(time * 1000, 3) : 0L;
return Double.isNaN(time) ? 0L : (long) ParsingUtils.scaleValue(time * 1000, 3);
} catch (ParseException e) {
throw new XMLStreamException(e);
}
Expand Down
Loading