8000 Java8 migration explicit type can be replaced with <> · Koc/idea-php-symfony2-plugin@0d00786 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d00786

Browse files
committed
Java8 migration explicit type can be replaced with <>
1 parent ec29a95 commit 0d00786

14 files changed

+36
-36
lines changed

src/fr/adrienbrault/idea/symfony2plugin/codeInspection/InspectionUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public StringBuilder getStringBuilder() {
5454
if(vars.size() > 0) {
5555

5656
// add dollar char for vars
57-
List<String> varsDollar = new ArrayList<String>();
57+
List<String> varsDollar = new ArrayList<>();
5858
for(String var: vars) {
5959
varsDollar.add("$" + var);
6060
}

src/fr/adrienbrault/idea/symfony2plugin/completion/command/ConsoleHelperGotoCompletionRegistrar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public MyGotoCompletionProvider(PsiElement element) {
6262
@Override
6363
public Collection<LookupElement> getLookupElements() {
6464

65-
Collection<LookupElement> lookupElements = new ArrayList<LookupElement>();
65+
Collection<LookupElement> lookupElements = new ArrayList<>();
6666

6767
for (Map.Entry<String, String> entry : CommandUtil.getCommandHelper(getProject()).entrySet()) {
6868
lookupElements.add(LookupElementBuilder.create(entry.getKey()).withTypeText(entry.getValue(), true));
@@ -90,7 +90,7 @@ public Collection<PsiElement> getPsiTargets(PsiElement psiElement) {
9090
return Collections.emptyList();
9191
}
9292

93-
return new HashSet<PsiElement>(PhpElementsUtil.getClassesInterface(getProject(), commandHelper.get(value)));
93+
return new HashSet<>(PhpElementsUtil.getClassesInterface(getProject(), commandHelper.get(value)));
9494
}
9595
}
9696
}

src/fr/adrienbrault/idea/symfony2plugin/config/component/ParameterReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public ResolveResult[] multiResolve(boolean incompleteCode) {
3535
@Override
3636
public Object[] getVariants() {
3737

38-
List<LookupElement> results = new ArrayList<LookupElement>();
38+
List<LookupElement> results = new ArrayList<>();
3939

4040
for(Map.Entry<String, ContainerParameter> entry: ContainerCollectionResolver.getParameters(getElement().getProject()).entrySet()) {
4141
results.add(new ParameterLookupElement(entry.getValue()));

src/fr/adrienbrault/idea/symfony2plugin/config/doctrine/DoctrineStaticTypeLookupBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public ArrayList<LookupElement> ListToElements(List<String> items) {
6363

6464
public ArrayList<LookupElement> ListToAnnotationsElements(List<String> items) {
6565

66-
ArrayList<LookupElement> lookups = new ArrayList<LookupElement>();
66+
ArrayList<LookupElement> lookups = new ArrayList<>();
6767

6868
for (String item : items) {
6969
if(item.startsWith("@")) {
@@ -79,7 +79,7 @@ public ArrayList<LookupElement> ListToAnnotationsElements(List<String> items) {
7979

8080
public ArrayList<LookupElement> ListToYmlElements(List<String> items) {
8181

82-
ArrayList<LookupElement> lookups = new ArrayList<LookupElement>();
82+
ArrayList<LookupElement> lookups = new ArrayList<>();
8383

8484
for (String answer : items) {
8585
lookups.add(new DoctrineTypeLookup(answer));

src/fr/adrienbrault/idea/symfony2plugin/dic/registrar/DicGotoCompletionRegistrar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public ParameterContributor(StringLiteralExpression element) {
6868
@NotNull
6969
@Override
7070
public Collection<LookupElement> getLookupElements() {
71-
Collection<LookupElement> results = new ArrayList<LookupElement>();
71+
Collection<LookupElement> results = new ArrayList<>();
7272

7373
for(Map.Entry<String, ContainerParameter> entry: ContainerCollectionResolver.getParameters(getElement().getProject()).entrySet()) {
7474
results.add(new ParameterLookupElement(entry.getValue()));

src/fr/adrienbrault/idea/symfony2plugin/doctrine/metadata/DoctrineXmlGotoCompletionRegistrar.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public Collection<PsiElement> getPsiTargets(PsiElement element) {
6767
return Collections.emptyList();
6868
}
6969

70-
Collection<PsiElement> classes = new ArrayList<PsiElement>();
70+
Collection<PsiElement> classes = new ArrayList<>();
7171
for (PhpClass phpClass : DoctrineMetadataUtil.getClassInsideScope(element, value)) {
7272
classes.add(phpClass);
7373
}

src/fr/adrienbrault/idea/symfony2plugin/doctrine/metadata/driver/DoctrinePhpMappingDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public DoctrineMetadataModel getMetadata(@NotNull DoctrineMappingDriverArguments
3131
return null;
3232
}
3333

34-
Collection<DoctrineModelField> fields = new ArrayList<DoctrineModelField>();
34+
Collection<DoctrineModelField> fields = new ArrayList<>();
3535
DoctrineMetadataModel model = new DoctrineMetadataModel(fields);
3636

3737
for (PhpClass phpClass : PhpElementsUtil.getClassesInterface(args.getProject(), args.getClassName())) {

src/fr/adrienbrault/idea/symfony2plugin/doctrine/metadata/lookup/DoctrineRepositoryLookupElement.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static DoctrineRepositoryLookupElement create(@NotNull PhpClass phpClass)
4646
}
4747

4848
public static Collection<DoctrineRepositoryLookupElement> create(@NotNull Collection<PhpClass> phpClasses) {
49-
Collection<DoctrineRepositoryLookupElement> elements = new ArrayList<DoctrineRepositoryLookupElement>();
49+
Collection<DoctrineRepositoryLookupElement> elements = new ArrayList<>();
5050
for(PhpClass phpClass: phpClasses) {
5151
String presentableFQN = phpClass.getPresentableFQN();
5252
if(presentableFQN == null) {

src/fr/adrienbrault/idea/symfony2plugin/form/dict/FormExtensionServiceParser.java

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

1212
public class FormExtensionServiceParser extends AbstractServiceParser {
1313

14-
protected Map<String, String> formExtensions = new ConcurrentHashMap<String, String>();
14+
protected Map<String, String> formExtensions = new ConcurrentHashMap<>();
1515

1616
@Override
1717
public String getXPathFilter() {

src/fr/adrienbrault/idea/symfony2plugin/form/dict/FormOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class FormOption {
1313
private final FormClass formClass;
1414

1515
@NotNull
16-
private final Collection<FormOptionEnum> optionEnum = new HashSet<FormOptionEnum>();
16+
private final Collection<FormOptionEnum> optionEnum = new HashSet<>();
1717

1818
public FormOption(@NotNull String option, @NotNull FormClass formClass) {
1919
this.option = option;

src/fr/adrienbrault/idea/symfony2plugin/form/dict/FormTypeMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public FormTypeMap(Map<String, String> map) {
1919
}
2020

2121
public FormTypeMap() {
22-
this.map = new HashMap<String, String>();
22+
this.map = new HashMap<>();
2323
}
2424

2525
public Map<String, String> getMap() {

src/fr/adrienbrault/idea/symfony2plugin/form/util/FormOptionsUtil.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public String fun(String s) {
4747
}
4848
});
4949

50-
Collection<FormClass> extendedTypeClasses = new ArrayList<FormClass>();
50+
Collection<FormClass> extendedTypeClasses = new ArrayList<>();
5151
for(PhpClass phpClass: getFormTypeExtensionClassNames(project)) {
5252
String formExtendedType = FormUtil.getFormExtendedType(phpClass);
5353
if(formExtendedType != null && formTypeNamesList.contains(formExtendedType)) {
@@ -61,7 +61,7 @@ public String fun(String s) {
6161
@NotNull
6262
private static Set<PhpClass> getFormTypeExtensionClassNames(@NotNull Project project) {
6363

64-
Set<PhpClass> phpClasses = new HashSet<PhpClass>();
64+
Set<PhpClass> phpClasses = new HashSet<>();
6565

6666
// @TODO: should be same as interface?
6767
for (String s : ServiceXmlParserFactory.getInstance(project, FormExtensionServiceParser.class).getFormExtensions().keySet()) {
@@ -86,7 +86,7 @@ private static Set<PhpClass> getFormTypeExtensionClassNames(@NotNull Project pro
8686
public static Map<String, FormOption> getFormExtensionKeys(@NotNull Project project, @NotNull String... formTypeNames) {
8787

8888
Collection<FormClass> typeClasses = FormOptionsUtil.getExtendedTypeClasses(project, formTypeNames);
89-
Map<String, FormOption> extensionClassMap = new HashMap<String, FormOption>();
89+
Map<String, FormOption> extensionClassMap = new HashMap<>();
9090

9191
for(FormClass extensionClass: typeClasses) {
9292
extensionClassMap.putAll(getDefaultOptions(project, extensionClass.getPhpClass(), extensionClass));
@@ -101,10 +101,10 @@ public static Map<String, FormOption> getFormExtensionKeys(@NotNull Project proj
101101
*/
102102
public static Set<String> getFormViewVars(Project project, String... formTypeNames) {
103103

104-
Set<String> stringSet = new HashSet<String>();
104+
Set<String> stringSet = new HashSet<>();
105105

106-
Set<String> uniqueClass = new HashSet<String>();
107-
List<PhpClass> phpClasses = new ArrayList<PhpClass>();
106+
Set<String> uniqueClass = new HashSet<>();
107+
List<PhpClass> phpClasses = new ArrayList<>();
108108

109109
// attach core form phpclass
110110
// @TODO: add formtype itself
@@ -202,9 +202,9 @@ private static void getFormViewVarsAttachKeys(Set<String> stringSet, FieldRefere
202202

203203
@Deprecated
204204
public static Map<String, String> getFormDefaultKeys(@NotNull Project project, @NotNull String formTypeName) {
205-
final Map<String, String> items = new HashMap<String, String>();
205+
final Map<String, String> items = new HashMap<>();
206206

207-
getFormDefaultKeys(project, formTypeName, new HashMap<String, String>(), new FormUtil.FormTypeCollector(project).collect(), 0, new FormOptionVisitor() {
207+
getFormDefaultKeys(project, formTypeName, new HashMap<>(), new FormUtil.FormTypeCollector(project).collect(), 0, new FormOptionVisitor() {
208208
@Override
209209
public void visit(@NotNull PsiElement psiElement, @NotNull String option, @NotNull FormClass formClass, @NotNull FormOptionEnum optionEnum) {
210210
String presentableFQN = formClass.getPhpClass().getPresentableFQN();
@@ -218,7 +218,7 @@ public void visit(@NotNull PsiElement psiElement, @NotNull String option, @NotNu
218218
}
219219

220220
public static void visitFormOptions(@NotNull Project project, @NotNull String formTypeName, @NotNull FormOptionVisitor visitor) {
221-
visitFormOptions(project, formTypeName, new HashMap<String, String>(), new FormUtil.FormTypeCollector(project).collect(), 0, visitor);
221+
visitFormOptions(project, formTypeName, new HashMap<>(), new FormUtil.FormTypeCollector(project).collect(), 0, visitor);
222222
}
223223

224224
private static Map<String, String> visitFormOptions(Project project, String formTypeName, HashMap<String, String> defaultValues, FormUtil.FormTypeCollector collector, int depth, @NotNull FormOptionVisitor visitor) {
@@ -245,7 +245,7 @@ private static Map<String, String> visitFormOptions(Project project, String form
245245
}
246246

247247
public static void getFormDefaultKeys(@NotNull Project project, @NotNull String formTypeName, @NotNull FormOptionVisitor visitor) {
248-
getFormDefaultKeys(project, formTypeName, new HashMap<String, String>(), new FormUtil.FormTypeCollector(project).collect(), 0, visitor);
248+
getFormDefaultKeys(project, formTypeName, new HashMap<>(), new FormUtil.FormTypeCollector(project).collect(), 0, visitor);
249249
}
250250

251251
private static Map<String, String> getFormDefaultKeys(Project project, String formTypeName, HashMap<String, String> defaultValues, FormUtil.FormTypeCollector collector, int depth, @NotNull FormOptionVisitor visitor) {
@@ -270,7 +270,7 @@ private static Map<String, String> getFormDefaultKeys(Project project, String fo
270270

271271
@NotNull
272272
private static Map<String, FormOption> getDefaultOptions(@NotNull Project project, @NotNull PhpClass phpClass, @NotNull FormClass formClass) {
273-
final Map<String, FormOption> options = new HashMap<String, FormOption>();
273+
final Map<String, FormOption> options = new HashMap<>();
274274

275275
getDefaultOptions(project, phpClass, formClass, new FormOptionVisitor() {
276276
@Override
@@ -389,7 +389,7 @@ public static Collection<PsiElement> getFormExtensionsKeysTargets(StringLiteralE
389389
}
390390

391391
public static Collection<LookupElement> getFormExtensionKeysLookupElements(Project project, String... formTypes) {
392-
Collection<LookupElement> lookupElements = new ArrayList<LookupElement>();
392+
Collection<LookupElement> lookupElements = new ArrayList<>();
393393

394394
for(FormOption formOption: FormOptionsUtil.getFormExtensionKeys(project, formTypes).values()) {
395395
lookupElements.add(FormOptionsUtil.getOptionLookupElement(formOption));
@@ -407,7 +407,7 @@ public static Collection<PsiElement> getDefaultOptionTargets(@NotNull StringLite
407407
return Collections.emptySet();
408408
}
409409

410-
final Collection<PsiElement> psiElements = new ArrayList<PsiElement>();
410+
final Collection<PsiElement> psiElements = new ArrayList<>();
411411

412412
FormOptionsUtil.getFormDefaultKeys(element.getProject(), formType, new FormOptionVisitor() {
413413
@Override
@@ -423,7 +423,7 @@ public void visit(@NotNull PsiElement psiElement, @NotNull String option, @NotNu
423423

424424
@NotNull
425425
public static Collection<LookupElement> getDefaultOptionLookupElements(@NotNull Project project, @NotNull String formType) {
426-
Collection<LookupElement> lookupElements = new ArrayList<LookupElement>();
426+
Collection<LookupElement> lookupElements = new ArrayList<>();
427427
FormOptionsUtil.getFormDefaultKeys(project, formType, new FormOptionLookupVisitor(lookupElements));
428428
return lookupElements;
429429
}

src/fr/adrienbrault/idea/symfony2plugin/stubs/ContainerCollectionResolver.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
public class ContainerCollectionResolver {
2929

3030
private static final Key<CachedValue<Map<String, List<ServiceSerializable>>>> SERVICE_CONTAINER_INDEX = new Key<>("SYMFONY_SERVICE_CONTAINER_INDEX");
31-
private static final Key<CachedValue<Map<String, List<String>>>> SERVICE_PARAMETER_INDEX = new Key<CachedValue<Map<String, List<String>>>>("SERVICE_PARAMETER_INDEX");
31+
private static final Key<CachedValue<Map<String, List<String>>>> SERVICE_PARAMETER_INDEX = new Key<>("SERVICE_PARAMETER_INDEX");
3232

33-
private static final Key<CachedValue<Set<String>>> SERVICE_CONTAINER_INDEX_NAMES = new Key<CachedValue<Set<String>>>("SYMFONY_SERVICE_CONTAINER_INDEX_NAMES");
34-
private static final Key<CachedValue<Set<String>>> SERVICE_PARAMETER_INDEX_NAMES = new Key<CachedValue<Set<String>>>("SERVICE_PARAMETER_INDEX_NAMES");
33+
private static final Key<CachedValue<Set<String>>> SERVICE_CONTAINER_INDEX_NAMES = new Key<>("SYMFONY_SERVICE_CONTAINER_INDEX_NAMES");
34+
private static final Key<CachedValue<Set<String>>> SERVICE_PARAMETER_INDEX_NAMES = new Key<>("SERVICE_PARAMETER_INDEX_NAMES");
3535

3636
private static final ExtensionPointName<fr.adrienbrault.idea.symfony2plugin.extension.ServiceCollector> EXTENSIONS = new ExtensionPointName<>(
3737
"fr.adrienbrault.idea.symfony2plugin.extension.ServiceCollector"
@@ -168,12 +168,12 @@ public Map<String, ContainerService> getServices() {
168168
services.put(entry.getKey(), new ContainerService(entry.getKey(), entry.getValue()));
169169
}
170170

171-
Collection<ServiceInterface> aliases = new ArrayList<ServiceInterface>();
171+
Collection<ServiceInterface> aliases = new ArrayList<>();
172172
Collection<ServiceInterface> decorated = new ArrayList<>();
173173

174174
// Extension points
175175
ServiceCollectorParameter.Service parameter = null;
176-
Collection<ServiceInterface> exps = new ArrayList<ServiceInterface>();
176+
Collection<ServiceInterface> exps = new ArrayList<>();
177177
for (fr.adrienbrault.idea.symfony2plugin.extension.ServiceCollector collectorEx : EXTENSIONS.getExtensions()) {
178178
if(parameter == null) {
179179
parameter = new ServiceCollectorParameter.Service(project, exps);
@@ -307,7 +307,7 @@ public Set<String> convertClassNameToServices(@NotNull String fqnClassName) {
307307

308308
private Set<String> getNames() {
309309

310-
Set<String> serviceNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
310+
Set<String> serviceNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
311311

312312
// local filesystem
313313
serviceNames.addAll(ServiceXmlParserFactory.getInstance(project, XmlServiceParser.class).getServiceMap().getMap().keySet());

src/fr/adrienbrault/idea/symfony2plugin/util/DocHashTagReferenceContributor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @No
4343

4444
ArrayList<PhpDocParamTag> phpDocParamTags = docTagHashing.getPhpDocParamTags();
4545

46-
ArrayList<PsiReference> psiReferences = new ArrayList<PsiReference>();
46+
ArrayList<PsiReference> psiReferences = new ArrayList<>();
4747

4848
int i = 0;
4949
for(PhpDocParamTag phpDocParamTag: phpDocParamTags) {
@@ -145,7 +145,7 @@ public class DocTagHashing {
145145
private PsiElement psiElement;
146146
private ArrayList<PhpDocParamTag> phpDocParamTags;
147147

148-
private ArrayList<Parameter[]> parameters = new ArrayList<Parameter[]>();
148+
private ArrayList<Parameter[]> parameters = new ArrayList<>();
149149
private ParameterList parameterList;
150150

151151
public DocTagHashing(PsiElement psiElement) {
@@ -198,7 +198,7 @@ public boolean isValid() {
198198
return false;
199199
}
200200

201-
this.phpDocParamTags = new ArrayList<PhpDocParamTag>();
201+
this.phpDocParamTags = new ArrayList<>();
202202
Method[] implementedMethods = PhpElementsUtil.getImplementedMethods(method);
203203

204204
for(Method implementedMethod: implementedMethods) {

0 commit comments

Comments
 (0)
0