Skip to content

Commit 0f50b62

Browse files
committed
[T3CMS] Apply cleanups
1 parent 2441b8d commit 0f50b62

File tree

18 files changed

+60
-98
lines changed

18 files changed

+60
-98
lines changed

typo3-cms/src/main/java/com/cedricziel/idea/typo3/codeInspection/quickfix/CreateInjectorQuickFix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
public class CreateInjectorQuickFix implements LocalQuickFix {
3232

33-
private SmartPsiElementPointer element;
33+
private final SmartPsiElementPointer<PhpDocTag> element;
3434

3535
public CreateInjectorQuickFix(@NotNull PhpDocTag element) {
3636
this.element = SmartPointerManager.getInstance(element.getProject()).createSmartPsiElementPointer(element);

typo3-cms/src/main/java/com/cedricziel/idea/typo3/container/CoreServiceParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
public class CoreServiceParser {
2121

22-
private HashMap<String, ArrayList<TYPO3ServiceDefinition>> serviceMap;
22+
private final HashMap<String, ArrayList<TYPO3ServiceDefinition>> serviceMap;
2323

2424
public CoreServiceParser() {
2525
this.serviceMap = new HashMap<>();

typo3-cms/src/main/java/com/cedricziel/idea/typo3/domain/TYPO3ServiceDefinition.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.jetbrains.annotations.NotNull;
44

55
import java.io.Serializable;
6+
import java.util.Objects;
67

78
public class TYPO3ServiceDefinition implements Serializable {
89

@@ -129,18 +130,18 @@ public boolean equals(Object o) {
129130
TYPO3ServiceDefinition that = (TYPO3ServiceDefinition) o;
130131

131132
if (!id.equals(that.id)) return false;
132-
if (extensionName != null ? !extensionName.equals(that.extensionName) : that.extensionName != null)
133+
if (!Objects.equals(extensionName, that.extensionName))
133134
return false;
134-
if (className != null ? !className.equals(that.className) : that.className != null) return false;
135-
if (title != null ? !title.equals(that.title) : that.title != null) return false;
136-
if (description != null ? !description.equals(that.description) : that.description != null) return false;
137-
if (subType != null ? !subType.equals(that.subType) : that.subType != null) return false;
138-
if (available != null ? !available.equals(that.available) : that.available != null) return false;
139-
if (priority != null ? !priority.equals(that.priority) : that.priority != null) return false;
140-
if (quality != null ? !quality.equals(that.quality) : that.quality != null) return false;
141-
if (os != null ? !os.equals(that.os) : that.os != null) return false;
142-
if (exec != null ? !exec.equals(that.exec) : that.exec != null) return false;
143-
return signature != null ? signature.equals(that.signature) : that.signature == null;
135+
if (!Objects.equals(className, that.className)) return false;
136+
if (!Objects.equals(title, that.title)) return false;
137+
if (!Objects.equals(description, that.description)) return false;
138+
if (!Objects.equals(subType, that.subType)) return false;
139+
if (!Objects.equals(available, that.available)) return false;
140+
if (!Objects.equals(priority, that.priority)) return false;
141+
if (!Objects.equals(quality, that.quality)) return false;
142+
if (!Objects.equals(os, that.os)) return false;
143+
if (!Objects.equals(exec, that.exec)) return false;
144+
return Objects.equals(signature, that.signature);
144145
}
145146

146147
@Override

typo3-cms/src/main/java/com/cedricziel/idea/typo3/domain/factory/ExtensionDefinitionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private static boolean isValidPackageType(String composerPackageType) {
134134
* Guesses an extension key from the composer package name.
135135
*
136136
* @param packageName The package name to analyze
137-
* @return
137+
* @return The extension key
138138
*/
139139
private static String extensionKeyFromPackageName(String packageName) {
140140

typo3-cms/src/main/java/com/cedricziel/idea/typo3/extbase/ExtbaseUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
public class ExtbaseUtils {
1919
public static final String EXTBASE_ABSTRACT_ENTITY_FQN = "TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity";
2020

21-
public static String EXTBASE_QUERY_INTERFACE_FQN = "TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface";
21+
public static final String EXTBASE_QUERY_INTERFACE_FQN = "TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface";
2222

23-
public static String[] EXTBASE_QUERY_BUILDER_METHODS = {
23+
public static final String[] EXTBASE_QUERY_BUILDER_METHODS = {
2424
"equals",
2525
"like",
2626
"contains",

typo3-cms/src/main/java/com/cedricziel/idea/typo3/icons/IconStub.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.intellij.psi.PsiElement;
55

66
import java.io.Serializable;
7+
import java.util.Objects;
78

89
public class IconStub implements IconInterface, Serializable {
910

@@ -77,10 +78,10 @@ public boolean equals(Object o) {
7778
IconStub iconStub = (IconStub) o;
7879

7980
if (!identifier.equals(iconStub.identifier)) return false;
80-
if (extension != null ? !extension.equals(iconStub.extension) : iconStub.extension != null) return false;
81-
if (filename != null ? !filename.equals(iconStub.filename) : iconStub.filename != null) return false;
82-
if (provider != null ? !provider.equals(iconStub.provider) : iconStub.provider != null) return false;
83-
if (source != null ? !source.equals(iconStub.source) : iconStub.source != null) return false;
81+
if (!Objects.equals(extension, iconStub.extension)) return false;
82+
if (!Objects.equals(filename, iconStub.filename)) return false;
83+
if (!Objects.equals(provider, iconStub.provider)) return false;
84+
if (!Objects.equals(source, iconStub.source)) return false;
8485
return textRange.equals(iconStub.textRange);
8586
}
8687

typo3-cms/src/main/java/com/cedricziel/idea/typo3/index/ExtensionNameStubIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
public class ExtensionNameStubIndex extends FileBasedIndexExtension<String, String> {
1515

16-
private static ObjectStreamDataExternalizer<String> EXTERNALIZER = new ObjectStreamDataExternalizer<>();
16+
private static final ObjectStreamDataExternalizer<String> EXTERNALIZER = new ObjectStreamDataExternalizer<>();
1717

1818
public static final ID<String, String> KEY = ID.create("com.cedricziel.idea.typo3.index.extension_name");
1919

typo3-cms/src/main/java/com/cedricziel/idea/typo3/index/extbase/ControllerActionIndex.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.cedricziel.idea.typo3.extbase.controller.StubControllerAction;
44
import com.cedricziel.idea.typo3.index.externalizer.ObjectStreamDataExternalizer;
5+
import com.cedricziel.idea.typo3.util.ExtbaseUtility;
56
import com.cedricziel.idea.typo3.util.ExtensionUtility;
67
import com.intellij.psi.PsiElement;
78
import com.intellij.psi.PsiRecursiveElementVisitor;
@@ -15,13 +16,11 @@
1516
import gnu.trove.THashMap;
1617
import org.jetbrains.annotations.NotNull;
1718

18-
import java.util.ArrayList;
19-
import java.util.List;
2019
import java.util.Map;
2120

2221
public class ControllerActionIndex extends FileBasedIndexExtension<String, StubControllerAction> {
2322

24-
public static ID<String, StubControllerAction> KEY = ID.create("com.cedricziel.idea.typo3.extbase.controller_action");
23+
public static final ID<String, StubControllerAction> KEY = ID.create("com.cedricziel.idea.typo3.extbase.controller_action");
2524

2625
@NotNull
2726
@Override
@@ -78,7 +77,7 @@ public boolean dependsOnFileContent() {
7877
}
7978

8079
static class ControllerActionRecursiveVisitor extends PsiRecursiveElementVisitor {
81-
Map<String, StubControllerAction> map;
80+
final Map<String, StubControllerAction> map;
8281

8382
ControllerActionRecursiveVisitor() {
8483
this.map = new THashMap<>();
@@ -106,7 +105,7 @@ public void visitElement(@NotNull PsiElement element) {
106105
return;
107106
}
108107

109-
if (!isActionController(containingClass)) {
108+
if (!ExtbaseUtility.isActionController(containingClass)) {
110109
super.visitElement(element);
111110

112111
return;
@@ -123,15 +122,5 @@ public void visitElement(@NotNull PsiElement element) {
123122

124123
super.visitElement(element);
125124
}
126-
127-
private boolean isActionController(@NotNull PhpClass containingClass) {
128-
List<String> fqns = new ArrayList<>();
129-
130-
if (containingClass.getSuperFQN() != null) {
131-
fqns.add(containingClass.getSuperFQN());
132-
}
133-
134-
return fqns.contains("\\TYPO3\\CMS\\Extbase\\Mvc\\Controller\\ActionController");
135-
}
136125
}
137126
}

typo3-cms/src/main/java/com/cedricziel/idea/typo3/psi/visitor/CoreIconParserVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
public class CoreIconParserVisitor extends PsiRecursiveElementVisitor {
1616

17-
private Map<String, IconStub> map;
17+
private final Map<String, IconStub> map;
1818

1919
public CoreIconParserVisitor() {
2020
this.map = new HashMap<>();

typo3-cms/src/main/java/com/cedricziel/idea/typo3/psi/visitor/CoreServiceDefinitionParserVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
public class CoreServiceDefinitionParserVisitor extends PsiRecursiveElementVisitor {
1818

19-
private Map<String, ArrayList<TYPO3ServiceDefinition>> map;
19+
private final Map<String, ArrayList<TYPO3ServiceDefinition>> map;
2020

2121
public CoreServiceDefinitionParserVisitor(Map<String, ArrayList<TYPO3ServiceDefinition>> map) {
2222
this.map = map;

0 commit comments

Comments
 (0)