diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationMap.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationMap.java index 9c18de4d38e..fa6484c90a1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationMap.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/LocationMap.java @@ -52,19 +52,19 @@ public class LocationMap implements ILocationResolver { private String fTranslationUnitPath; private IASTTranslationUnit fTranslationUnit; - private ArrayList fDirectives= new ArrayList(); - private ArrayList fProblems= new ArrayList(); - private ArrayList fComments= new ArrayList(); - private ArrayList fBuiltinMacros= new ArrayList(); - private ArrayList fMacroReferences= new ArrayList(); + private ArrayList fDirectives= new ArrayList<>(); + private ArrayList fProblems= new ArrayList<>(); + private ArrayList fComments= new ArrayList<>(); + private ArrayList fBuiltinMacros= new ArrayList<>(); + private ArrayList fMacroReferences= new ArrayList<>(); private LocationCtxFile fRootContext; private LocationCtx fCurrentContext; private int fLastChildInsertionOffset; - // stuff computed on demand + // Stuff computed on demand private IdentityHashMap fMacroDefinitionMap; - private List fSkippedFilesListeners= new ArrayList(); + private List fSkippedFilesListeners= new ArrayList<>(); public LocationMap(LexerOptions lexOptions) { fLexerOptions= lexOptions; @@ -516,7 +516,7 @@ public class LocationMap implements ILocationResolver { } LocationCtxFile ctx= floc.getLocationContext(); - ArrayList list= new ArrayList(); + ArrayList list= new ArrayList<>(); ctx.collectMacroExpansions(floc.getNodeOffset(), floc.getNodeLength(), list); return list.toArray(new IASTPreprocessorMacroExpansion[list.size()]); @@ -549,7 +549,7 @@ public class LocationMap implements ILocationResolver { @Override public IASTNodeLocation[] getLocations(int sequenceNumber, int length) { - ArrayList result= new ArrayList(); + ArrayList result= new ArrayList<>(); fRootContext.collectLocations(sequenceNumber, length, result); return result.toArray(new IASTNodeLocation[result.size()]); } @@ -561,7 +561,7 @@ public class LocationMap implements ILocationResolver { @Override public IASTImageLocation getImageLocation(int sequenceNumber, int length) { - ArrayList result= new ArrayList(); + ArrayList result= new ArrayList<>(); fRootContext.collectLocations(sequenceNumber, length, result); if (result.size() != 1) { return null; @@ -669,7 +669,7 @@ public class LocationMap implements ILocationResolver { public int getSequenceNumberForFileOffset(String filePath, int fileOffset) { LocationCtx ctx= fRootContext; if (filePath != null) { - ArrayDeque contexts= new ArrayDeque(); + ArrayDeque contexts= new ArrayDeque<>(); while (ctx != null) { if (ctx instanceof LocationCtxFile) { if (filePath.equals(ctx.getFilePath())) { @@ -708,7 +708,7 @@ public class LocationMap implements ILocationResolver { @Override public IASTPreprocessorMacroDefinition[] getMacroDefinitions() { - ArrayList result= new ArrayList(); + ArrayList result= new ArrayList<>(); for (ASTPreprocessorNode directive : fDirectives) { if (directive instanceof IASTPreprocessorMacroDefinition) { result.add((IASTPreprocessorMacroDefinition) directive); @@ -719,7 +719,7 @@ public class LocationMap implements ILocationResolver { @Override public IASTPreprocessorIncludeStatement[] getIncludeDirectives() { - ArrayList result= new ArrayList(); + ArrayList result= new ArrayList<>(); for (ASTPreprocessorNode directive : fDirectives) { if (directive instanceof IASTPreprocessorIncludeStatement) { result.add((IASTPreprocessorIncludeStatement) directive); @@ -761,7 +761,7 @@ public class LocationMap implements ILocationResolver { IASTPreprocessorMacroDefinition getMacroDefinition(IMacroBinding binding) { if (fMacroDefinitionMap == null) { - fMacroDefinitionMap= new IdentityHashMap(); + fMacroDefinitionMap= new IdentityHashMap<>(); for (int i = 0; i < fBuiltinMacros.size(); i++) { final IASTPreprocessorMacroDefinition def = fBuiltinMacros.get(i); final IASTName name = def.getName(); @@ -782,7 +782,7 @@ public class LocationMap implements ILocationResolver { @Override public IASTName[] getReferences(IMacroBinding binding) { - List result= new ArrayList(); + List result= new ArrayList<>(); for (IASTName name : fMacroReferences) { if (name.getBinding() == binding) { result.add(name); @@ -797,7 +797,7 @@ public class LocationMap implements ILocationResolver { public ASTPreprocessorName[] getNestedMacroReferences(ASTMacroExpansion expansion) { final IASTName explicitRef= expansion.getMacroReference(); - List result= new ArrayList(); + List result= new ArrayList<>(); for (ASTPreprocessorName name : fMacroReferences) { if (name.getParent() == expansion && name != explicitRef) { result.add(name); @@ -849,8 +849,8 @@ public class LocationMap implements ILocationResolver { ((ASTNode) fTranslationUnit).setLength(offset); if (sigMacros != null) { - ISignificantMacros sig = sigMacros.isEmpty() ? ISignificantMacros.NONE - : new SignificantMacros(sigMacros); + ISignificantMacros sig = sigMacros.isEmpty() ? + ISignificantMacros.NONE : new SignificantMacros(sigMacros); fTranslationUnit.setSignificantMacros(sig); } }