Skip to content

Commit c433457

Browse files
authored
Merge pull request #2074 from Haehnchen/feature/java-language
java language level feature migration
2 parents 4f55627 + e897370 commit c433457

File tree

112 files changed

+465
-584
lines changed

Some content is hidden

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

112 files changed

+465
-584
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ tasks {
7272
version.set(properties("pluginVersion"))
7373
sinceBuild.set(properties("pluginSinceBuild"))
7474
untilBuild.set(properties("pluginUntilBuild"))
75-
changeNotes.set(file("src/main/resources/META-INF/change-notes.html").readText().replace("<html>", "").replace("</html>", ""));
75+
changeNotes.set(file("src/main/resources/META-INF/change-notes.html").readText().replace("<html>", "").replace("</html>", ""))
7676

7777
// Get the latest available change notes from the changelog file
7878
// changeNotes.set(provider {

src/main/java/fr/adrienbrault/idea/symfony2plugin/Symfony2ProjectComponent.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import fr.adrienbrault.idea.symfony2plugin.extension.PluginConfigurationExtension;
1212
import fr.adrienbrault.idea.symfony2plugin.extension.ServiceContainerLoader;
1313
import fr.adrienbrault.idea.symfony2plugin.extension.ServiceContainerLoaderParameter;
14-
import fr.adrienbrault.idea.symfony2plugin.routing.RouteHelper;
1514
import fr.adrienbrault.idea.symfony2plugin.util.IdeHelper;
1615
import fr.adrienbrault.idea.symfony2plugin.util.ProjectUtil;
1716
import fr.adrienbrault.idea.symfony2plugin.util.service.ServiceXmlParserFactory;

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/ServiceActionUtil.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ public static Set<String> getPossibleServices(@NotNull PhpClass phpClass, @NotNu
157157
matchedContainer.sort(new SymfonyCreateService.ContainerServicePriorityNameComparator());
158158

159159
matchedContainer.sort((o1, o2) ->
160-
((Integer)ServiceContainerUtil.getServiceUsage(phpClass.getProject(), o2.getName()))
161-
.compareTo(ServiceContainerUtil.getServiceUsage(phpClass.getProject(), o1.getName()))
160+
Integer.compare(ServiceContainerUtil.getServiceUsage(phpClass.getProject(), o2.getName()), ServiceContainerUtil.getServiceUsage(phpClass.getProject(), o1.getName()))
162161
);
163162

164163
return matchedContainer.stream()

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/bundle/NewBundleCommandAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ protected void run(@NotNull Result result) throws Throwable {
3737
PsiElement bundleFile = null;
3838
try {
3939

40-
bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, "command", "Command\\" + finalClassName, new HashMap<String, String>() {{
40+
bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, "command", "Command\\" + finalClassName, new HashMap<>() {{
4141
String name = phpClass.getName();
42-
if(name.endsWith("Bundle")) {
42+
if (name.endsWith("Bundle")) {
4343
name = name.substring(0, name.length() - "Bundle".length());
4444
}
4545
put("name", StringUtils.underscore(name) + ":" + StringUtils.underscore(finalClassName));

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/bundle/NewBundleFormAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected void run(@NotNull Result result) throws Throwable {
3838
PsiElement bundleFile = null;
3939
try {
4040

41-
bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, fileTemplate, "Form\\" + className, new HashMap<String, String>() {{
41+
bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, fileTemplate, "Form\\" + className, new HashMap<>() {{
4242
put("name", fr.adrienbrault.idea.symfony2plugin.util.StringUtils.underscore(phpClass.getName() + className));
4343
}});
4444

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/bundle/NewBundleTwigExtensionAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected void run(@NotNull Result result) throws Throwable {
3636
}
3737

3838
final String finalName = name;
39-
bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, "twig_extension", "Twig\\Extension\\" + className, new HashMap<String, String>() {{
39+
bundleFile = PhpBundleFileFactory.createBundleFile(phpClass, "twig_extension", "Twig\\Extension\\" + className, new HashMap<>() {{
4040
put("name", fr.adrienbrault.idea.symfony2plugin.util.StringUtils.underscore(finalName));
4141
}});
4242

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/ui/ServiceArgumentSelectionDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public boolean isCellEditable(ServiceParameter modelParameter) {
206206
public TableCellEditor getEditor(ServiceParameter modelParameter) {
207207

208208
Set<String> sorted = modelParameter.getPossibleServices();
209-
ComboBox comboBox = new ComboBox(sorted.toArray(new String[sorted.size()] ), 200);
209+
ComboBox comboBox = new ComboBox(sorted.toArray(new String[0]), 200);
210210
comboBox.setEditable(true);
211211

212212
return new DefaultCellEditor(comboBox);

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/ui/ServiceBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private List<String> getParameters(List<MethodParameter.MethodModelParameter> me
9898
List<String> methodCalls = new ArrayList<>();
9999

100100
// sort by indexes parameter
101-
methodModelParameters.sort((o1, o2) -> ((Integer) o1.getIndex()).compareTo(o2.getIndex()));
101+
methodModelParameters.sort(Comparator.comparingInt(MethodParameter.MethodModelParameter::getIndex));
102102

103103
for(MethodParameter.MethodModelParameter methodModelParameter: methodModelParameters) {
104104

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/ui/SymfonyCreateService.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,11 @@ private void updateTask() {
380380
method.getName();
381381
}
382382

383-
modelParameters.sort((o1, o2) -> {
384-
int i = o1.getName().compareTo(o2.getName());
385-
if (i != 0) {
386-
return i;
387-
}
388-
389-
return Integer.valueOf(o1.getIndex()).compareTo(o2.getIndex());
390-
});
383+
modelParameters.sort(
384+
Comparator
385+
.comparing(MethodParameter.MethodModelParameter::getName)
386+
.thenComparingInt(MethodParameter.MethodModelParameter::getIndex)
387+
);
391388

392389
while(this.modelList.getRowCount() > 0) {
393390
this.modelList.removeRow(0);
@@ -466,7 +463,7 @@ public boolean isCellEditable(MethodParameter.MethodModelParameter modelParamete
466463
public TableCellEditor getEditor(MethodParameter.MethodModelParameter modelParameter) {
467464

468465
Set<String> sorted = modelParameter.getPossibleServices();
469-
ComboBox comboBox = new ComboBox(sorted.toArray(new String[sorted.size()] ), 200);
466+
ComboBox comboBox = new ComboBox(sorted.toArray(new String[0]), 200);
470467
comboBox.setEditable(true);
471468

472469
return new DefaultCellEditor(comboBox);

src/main/java/fr/adrienbrault/idea/symfony2plugin/asset/AssetGoToDeclarationHandler.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public PsiElement[] getGotoDeclarationTargets(PsiElement psiElement, int i, Edit
4646
}
4747
}
4848

49-
return psiElements.toArray(new PsiElement[psiElements.size()]);
49+
return psiElements.toArray(new PsiElement[0]);
5050
}
5151

5252
private String[] findValidAssetFilter(PsiElement psiElement) {
@@ -72,14 +72,11 @@ private String[] getFileExtensionFilterIfValidTag(PsiElement psiElement) {
7272
continue;
7373
}
7474

75-
switch (tag) {
76-
case "stylesheets":
77-
return TwigUtil.CSS_FILES_EXTENSIONS;
78-
case "javascripts":
79-
return TwigUtil.JS_FILES_EXTENSIONS;
80-
default:
81-
return null;
82-
}
75+
return switch (tag) {
76+
case "stylesheets" -> TwigUtil.CSS_FILES_EXTENSIONS;
77+
case "javascripts" -> TwigUtil.JS_FILES_EXTENSIONS;
78+
default -> null;
79+
};
8380
}
8481

8582
return null;

0 commit comments

Comments
 (0)