Skip to content

Commit 19d2559

Browse files
author
Hélios GILLES
committed
Run org.openrewrite.java.migrate.UpgradeToJava21
1 parent 010545f commit 19d2559

95 files changed

Lines changed: 259 additions & 232 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

org.moreunit.build/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</modules>
2525

2626
<properties>
27+
<maven.compiler.release>21</maven.compiler.release>
2728
<tycho-version>5.0.2</tycho-version>
2829
<exec-maven-version>3.5.0</exec-maven-version>
2930
<surefire-version>3.5.3</surefire-version>

org.moreunit.core.test/test/org/moreunit/core/resources/InMemoryPath.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public String getBaseName()
4646
if(isEmpty())
4747
return "";
4848

49-
return segments.isEmpty() ? "/" : segments.get(segments.size() - 1);
49+
return segments.isEmpty() ? "/" : segments.getLast();
5050
}
5151

5252
@Override
@@ -76,7 +76,7 @@ public String getExtension()
7676
@Override
7777
public String getProjectName()
7878
{
79-
return segments.isEmpty() ? "" : segments.get(0);
79+
return segments.isEmpty() ? "" : segments.getFirst();
8080
}
8181

8282
@Override

org.moreunit.core.test/test/org/moreunit/core/resources/ResourcesTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ public void workspace_should_be_traversable_from_top_to_bottom_ignoring_resource
5252

5353
assertContainsFolders(projects.get(0), "folderA", "folderB", "folderC", "folderD");
5454
assertContainsFiles(projects.get(0), none());
55-
assertContainsFolders(projects.get(0).getFolder("folderA"), "subfolderA1", "subfolderA2");
56-
assertContainsFiles(projects.get(0).getFolder("folderA").getFolder("subfolderA2").getFolder("subsubfolderA"), "fileA2A");
57-
assertThat(projects.get(0).getFolder("folderB").listFiles()).isEmpty();
58-
assertThat(projects.get(0).getFolder("folderB").listFolders()).isEmpty();
55+
assertContainsFolders(projects.getFirst().getFolder("folderA"), "subfolderA1", "subfolderA2");
56+
assertContainsFiles(projects.getFirst().getFolder("folderA").getFolder("subfolderA2").getFolder("subsubfolderA"), "fileA2A");
57+
assertThat(projects.getFirst().getFolder("folderB").listFiles()).isEmpty();
58+
assertThat(projects.getFirst().getFolder("folderB").listFolders()).isEmpty();
5959

6060
assertContainsFolders(projects.get(1), "folderZ");
6161
assertContainsFiles(projects.get(1), "fileAtProjectRoot");

org.moreunit.core/src/org/moreunit/core/commands/ExecutionContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public IEvaluationContext getApplicationContext()
4040
public IEditorPart getActiveEditorPart()
4141
{
4242
Object editor = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_NAME);
43-
if(editor instanceof IEditorPart)
43+
if(editor instanceof IEditorPart part)
4444
{
45-
return (IEditorPart) editor;
45+
return part;
4646
}
4747
return null;
4848
}

org.moreunit.core/src/org/moreunit/core/commands/Selection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public Selection(ExecutionContext context)
2525
public SelectedSrcFile getUniqueSrcFile()
2626
{
2727
Object firstElement = getUniqueSelectedElement();
28-
if(firstElement instanceof IAdaptable)
28+
if(firstElement instanceof IAdaptable adaptable)
2929
{
30-
IFile file = toFile((IAdaptable) firstElement);
30+
IFile file = toFile(adaptable);
3131
if(file != null)
3232
return SelectedSrcFile.fromSelection(toSrcFile(file), executionContext);
3333
}

org.moreunit.core/src/org/moreunit/core/languages/Language.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ else if(! extension.equals(other.extension))
7474
@Override
7575
public String toString()
7676
{
77-
return String.format("%s[.%s]", label, extension);
77+
return "%s[.%s]".formatted(label, extension);
7878
}
7979
}

org.moreunit.core/src/org/moreunit/core/matching/DoesNotMatchConfigurationException.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package org.moreunit.core.matching;
22

3+
import java.io.Serial;
4+
5+
36
import org.moreunit.core.resources.Path;
47

58
public class DoesNotMatchConfigurationException extends Exception
69
{
10+
@Serial
711
private static final long serialVersionUID = - 8002049690736157605L;
812

913
private final Path path;

org.moreunit.core/src/org/moreunit/core/matching/FileNameEvaluation.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ private String removeQuotes(String str)
132132
@Override
133133
public String toString()
134134
{
135-
return String.format("%s(%s\t%s%s\t%s%s\t%s%s\t%s%s)", //
136-
getClass().getSimpleName(), StringConstants.NEWLINE, //
137-
evaluatedFileName, StringConstants.NEWLINE, //
138-
(testFile ? "test file" : "src file"), StringConstants.NEWLINE, //
139-
preferredCorrespondingFileName, StringConstants.NEWLINE, //
140-
preferredCorrespondingFilePatterns, StringConstants.NEWLINE, //
141-
otherCorrespondingFilePatterns, StringConstants.NEWLINE);
135+
return "%s(%s\t%s%s\t%s%s\t%s%s\t%s%s)".formatted( //
136+
getClass().getSimpleName(), StringConstants.NEWLINE, //
137+
evaluatedFileName, StringConstants.NEWLINE, //
138+
(testFile ? "test file" : "src file"), StringConstants.NEWLINE, //
139+
preferredCorrespondingFileName, StringConstants.NEWLINE, //
140+
preferredCorrespondingFilePatterns, StringConstants.NEWLINE, //
141+
otherCorrespondingFilePatterns, StringConstants.NEWLINE);
142142
}
143143
}

org.moreunit.core/src/org/moreunit/core/matching/MatchingFile.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ public String getFileToCreate()
7676
@Override
7777
public String toString()
7878
{
79-
return String.format("%s(%s)", getClass().getSimpleName(), (isSearchCancelled() ? //
80-
"search cancelled" : //
81-
(isFound() ? //
82-
"found: " + file : //
83-
"to create: " + srcFolderToCreate + "/" + fileToCreate)));
79+
return "%s(%s)".formatted(getClass().getSimpleName(), (isSearchCancelled() ? //
80+
"search cancelled" : //
81+
(isFound() ? //
82+
"found: " + file : //
83+
"to create: " + srcFolderToCreate + "/" + fileToCreate)));
8484
}
8585
}

org.moreunit.core/src/org/moreunit/core/matching/NameTokenizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private List<String> getCombinationsFromEnd(List<String> tokens)
125125
combination.insert(0, separator);
126126
combination.insert(0, token);
127127
}
128-
combinations.add(0, combination.toString());
128+
combinations.addFirst(combination.toString());
129129
}
130130

131131
return combinations;

0 commit comments

Comments
 (0)