Skip to content

Commit 4dc5176

Browse files
cmagliefacchinm
authored andcommitted
Fix some linter suggestions
1 parent 745cb01 commit 4dc5176

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

app/src/cc/arduino/contributions/libraries/ui/MultiLibraryInstallDialog.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ enum Result {
6262
ALL, NONE, CANCEL
6363
}
6464

65-
Result result = Result.CANCEL;
65+
private Result result = Result.CANCEL;
6666

6767
public MultiLibraryInstallDialog(Window parent, ContributedLibrary lib,
6868
List<ContributedLibrary> dependencies) {

arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndex.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
import java.util.Optional;
3939
import java.util.stream.Collectors;
4040

41+
import cc.arduino.contributions.VersionComparator;
42+
4143
public abstract class LibrariesIndex {
4244

4345
public abstract List<ContributedLibrary> getLibraries();
@@ -121,11 +123,8 @@ public boolean resolveDependeciesOf(List<ContributedLibrary> solution,
121123
for (ContributedLibraryDependency dep : requirements) {
122124

123125
// If the current solution already contains this dependency, skip over
124-
boolean alreadyInSolution = false;
125-
for (ContributedLibrary c : solution) {
126-
if (c.getName().equals(dep.getName()))
127-
alreadyInSolution = true;
128-
}
126+
boolean alreadyInSolution = solution.stream()
127+
.anyMatch(l -> l.getName().equals(dep.getName()));
129128
if (alreadyInSolution)
130129
continue;
131130

@@ -146,7 +145,7 @@ public boolean resolveDependeciesOf(List<ContributedLibrary> solution,
146145
selected = installed.get();
147146
} else {
148147
// otherwise pick the latest version
149-
selected = possibleDeps.stream().reduce((a, b) -> b.isBefore(a) ? a : b).get();
148+
selected = possibleDeps.stream().reduce(VersionComparator::max).get();
150149
}
151150

152151
// Add dependency to the solution and process recursively

arduino-core/src/cc/arduino/contributions/libraries/UnavailableContributedLibrary.java

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public String getCategory() {
7373

7474
@Override
7575
public void setCategory(String category) {
76+
// Empty
7677
}
7778

7879
@Override

0 commit comments

Comments
 (0)