1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Use diamond operator.

This commit is contained in:
Sergey Prigogin 2014-04-08 17:38:52 -07:00
parent e333b0030e
commit 441d546d25

View file

@ -146,7 +146,7 @@ public class IncludeOrganizer {
this.name = name; this.name = name;
this.declaration = null; this.declaration = null;
this.type = DeclarationType.NAMESPACE; this.type = DeclarationType.NAMESPACE;
this.children = new ArrayList<ForwardDeclarationNode>(); this.children = new ArrayList<>();
} }
/** /**
@ -214,8 +214,7 @@ public class IncludeOrganizer {
// Use a map instead of a set to be able to retrieve existing elements using equal elements. // Use a map instead of a set to be able to retrieve existing elements using equal elements.
// Maps each element to itself. // Maps each element to itself.
Map<IncludePrototype, IncludePrototype> includePrototypes = Map<IncludePrototype, IncludePrototype> includePrototypes = new HashMap<>();
new HashMap<IncludePrototype, IncludePrototype>();
// Put the new includes into includePrototypes. // Put the new includes into includePrototypes.
for (IPath header : fContext.getHeadersToInclude()) { for (IPath header : fContext.getHeadersToInclude()) {
IncludeGroupStyle style = fContext.getIncludeStyle(header); IncludeGroupStyle style = fContext.getIncludeStyle(header);
@ -258,7 +257,7 @@ public class IncludeOrganizer {
int position = allowReordering ? groupingStyle.getOrder() : 0; int position = allowReordering ? groupingStyle.getOrder() : 0;
List<IncludePrototype> prototypes = groupedPrototypes[position]; List<IncludePrototype> prototypes = groupedPrototypes[position];
if (prototypes == null) { if (prototypes == null) {
prototypes = new ArrayList<IncludePrototype>(); prototypes = new ArrayList<>();
groupedPrototypes[position] = prototypes; groupedPrototypes[position] = prototypes;
} }
prototypes.add(prototype); prototypes.add(prototype);
@ -280,7 +279,7 @@ public class IncludeOrganizer {
} }
} }
List<String> includeDirectives = new ArrayList<String>(); List<String> includeDirectives = new ArrayList<>();
IncludeGroupStyle previousStyle = null; IncludeGroupStyle previousStyle = null;
for (List<IncludePrototype> prototypes : groupedPrototypes) { for (List<IncludePrototype> prototypes : groupedPrototypes) {
if (prototypes != null && !prototypes.isEmpty()) { if (prototypes != null && !prototypes.isEmpty()) {
@ -469,7 +468,7 @@ public class IncludeOrganizer {
} }
// Consider the namespace(s) of the binding. // Consider the namespace(s) of the binding.
List<String> namespaces = new ArrayList<String>(); List<String> namespaces = new ArrayList<>();
try { try {
IScope scope = binding.getScope(); IScope scope = binding.getScope();
while (scope != null && scope.getKind() == EScopeKind.eNamespace) { while (scope != null && scope.getKind() == EScopeKind.eNamespace) {
@ -693,7 +692,7 @@ public class IncludeOrganizer {
private static int skipStandaloneCommentBlock(String contents, int offset, int endOffset, private static int skipStandaloneCommentBlock(String contents, int offset, int endOffset,
IASTComment[] comments, NodeCommentMap commentMap) { IASTComment[] comments, NodeCommentMap commentMap) {
Map<IASTComment, IASTNode> inverseLeadingMap = new HashMap<IASTComment, IASTNode>(); Map<IASTComment, IASTNode> inverseLeadingMap = new HashMap<>();
for (Map.Entry<IASTNode, List<IASTComment>> entry : commentMap.getLeadingMap().entrySet()) { for (Map.Entry<IASTNode, List<IASTComment>> entry : commentMap.getLeadingMap().entrySet()) {
IASTNode node = entry.getKey(); IASTNode node = entry.getKey();
if (getNodeOffset(node) <= endOffset) { if (getNodeOffset(node) <= endOffset) {
@ -702,7 +701,7 @@ public class IncludeOrganizer {
} }
} }
} }
Map<IASTComment, IASTNode> inverseFreestandingMap = new HashMap<IASTComment, IASTNode>(); Map<IASTComment, IASTNode> inverseFreestandingMap = new HashMap<>();
for (Map.Entry<IASTNode, List<IASTComment>> entry : commentMap.getFreestandingMap().entrySet()) { for (Map.Entry<IASTNode, List<IASTComment>> entry : commentMap.getFreestandingMap().entrySet()) {
IASTNode node = entry.getKey(); IASTNode node = entry.getKey();
if (getNodeEndOffset(node) < endOffset) { if (getNodeEndOffset(node) < endOffset) {
@ -749,10 +748,10 @@ public class IncludeOrganizer {
private Set<IBinding> removeBindingsDefinedInIncludedHeaders(IASTTranslationUnit ast, private Set<IBinding> removeBindingsDefinedInIncludedHeaders(IASTTranslationUnit ast,
Set<IBinding> bindings, IIndexFileSet reachableHeaders) throws CoreException { Set<IBinding> bindings, IIndexFileSet reachableHeaders) throws CoreException {
Set<IBinding> filteredBindings = new HashSet<IBinding>(bindings); Set<IBinding> filteredBindings = new HashSet<>(bindings);
List<InclusionRequest> requests = createInclusionRequests(ast, bindings, true, reachableHeaders); List<InclusionRequest> requests = createInclusionRequests(ast, bindings, true, reachableHeaders);
Set<IPath> allIncludedHeaders = new HashSet<IPath>(); Set<IPath> allIncludedHeaders = new HashSet<>();
allIncludedHeaders.addAll(fContext.getHeadersAlreadyIncluded()); allIncludedHeaders.addAll(fContext.getHeadersAlreadyIncluded());
allIncludedHeaders.addAll(fContext.getHeadersToInclude()); allIncludedHeaders.addAll(fContext.getHeadersToInclude());