1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2014-05-13 12:06:39 -07:00
parent 08f5b7e52a
commit cc65236de5
5 changed files with 50 additions and 35 deletions

View file

@ -297,8 +297,8 @@ public class PDOM extends PlatformObject implements IPDOM {
}
public static class ChangeEvent {
public Set<IIndexFileLocation> fClearedFiles= new HashSet<IIndexFileLocation>();
public Set<IIndexFileLocation> fFilesWritten= new HashSet<IIndexFileLocation>();
public Set<IIndexFileLocation> fClearedFiles= new HashSet<>();
public Set<IIndexFileLocation> fFilesWritten= new HashSet<>();
private boolean fCleared;
private boolean fReloaded;
private boolean fNewFiles;
@ -356,11 +356,11 @@ public class PDOM extends PlatformObject implements IPDOM {
private PDOMTagIndex tagIndex;
private BTree indexOfDefectiveFiles;
private BTree indexOfFiledWithUnresolvedIncludes;
private final Map<Integer, PDOMLinkage> fLinkageIDCache = new HashMap<Integer, PDOMLinkage>();
private final Map<Integer, PDOMLinkage> fLinkageIDCache = new HashMap<>();
private File fPath;
private final IIndexLocationConverter locationConverter;
private final Map<String, IPDOMLinkageFactory> fPDOMLinkageFactoryCache;
private final HashMap<Object, Object> fResultCache= new HashMap<Object, Object>();
private final HashMap<Object, Object> fResultCache= new HashMap<>();
private List<IListener> listeners;
protected ChangeEvent fEvent= new ChangeEvent();
@ -375,7 +375,7 @@ public class PDOM extends PlatformObject implements IPDOM {
loadDatabase(dbPath, cache);
this.locationConverter = locationConverter;
if (sDEBUG_LOCKS) {
fLockDebugging= new HashMap<Thread, DebugLockInfo>();
fLockDebugging= new HashMap<>();
System.out.println("Debugging PDOM Locks"); //$NON-NLS-1$
}
}
@ -452,7 +452,7 @@ public class PDOM extends PlatformObject implements IPDOM {
@Override
public void addListener(IListener listener) {
if (listeners == null)
listeners = new LinkedList<IListener>();
listeners = new LinkedList<>();
listeners.add(listener);
}
@ -562,7 +562,7 @@ public class PDOM extends PlatformObject implements IPDOM {
}
private IIndexFragmentFile[] getFiles(BTree index) throws CoreException {
final List<PDOMFile> files = new ArrayList<PDOMFile>();
final List<PDOMFile> files = new ArrayList<>();
index.accept(new IBTreeVisitor() {
@Override
public int compare(long record) throws CoreException {
@ -647,9 +647,9 @@ public class PDOM extends PlatformObject implements IPDOM {
private final Pattern[] pattern;
private final IProgressMonitor monitor;
private final ArrayList<PDOMNamedNode> currentPath= new ArrayList<PDOMNamedNode>();
private final ArrayList<BitSet> matchStack= new ArrayList<BitSet>();
private final List<PDOMNamedNode> bindings = new ArrayList<PDOMNamedNode>();
private final ArrayList<PDOMNamedNode> currentPath= new ArrayList<>();
private final ArrayList<BitSet> matchStack= new ArrayList<>();
private final List<PDOMNamedNode> bindings = new ArrayList<>();
private final boolean isFullyQualified;
private BitSet matchesUpToLevel;
private final IndexFilter filter;
@ -845,7 +845,7 @@ public class PDOM extends PlatformObject implements IPDOM {
}
}
List<IIndexFragmentBinding> result= new ArrayList<IIndexFragmentBinding>();
List<IIndexFragmentBinding> result= new ArrayList<>();
for (PDOMLinkage linkage : getLinkageList()) {
if (filter.acceptLinkage(linkage)) {
try {
@ -1093,7 +1093,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return fLinkageIDCache.get(linkage.getLinkageID());
}
private ThreadLocal<IBinding> inProgress = new ThreadLocal<IBinding>();
private ThreadLocal<IBinding> inProgress = new ThreadLocal<>();
@Override
public IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException {
@ -1144,7 +1144,7 @@ public class PDOM extends PlatformObject implements IPDOM {
@Override
public IIndexFragmentName[] findNames(IBinding binding, int options) throws CoreException {
ArrayList<IIndexFragmentName> names= new ArrayList<IIndexFragmentName>();
ArrayList<IIndexFragmentName> names= new ArrayList<>();
IIndexFragmentBinding myBinding= adaptBinding(binding);
if (myBinding instanceof PDOMBinding) {
PDOMBinding pdomBinding = (PDOMBinding) myBinding;
@ -1235,7 +1235,7 @@ public class PDOM extends PlatformObject implements IPDOM {
public IIndexFragmentInclude[] findIncludedBy(IIndexFragmentFile file) throws CoreException {
PDOMFile pdomFile= adaptFile(file);
if (pdomFile != null) {
List<PDOMInclude> result = new ArrayList<PDOMInclude>();
List<PDOMInclude> result = new ArrayList<>();
for (PDOMInclude i= pdomFile.getFirstIncludedBy(); i != null; i= i.getNextInIncludedBy()) {
if (i.getIncludedBy().getTimestamp() > 0) {
result.add(i);
@ -1273,7 +1273,7 @@ public class PDOM extends PlatformObject implements IPDOM {
}
private IIndexFragmentBinding[] findBindingsForPrefixOrContentAssist(char[] prefix, boolean filescope, boolean isContentAssist, boolean caseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
ArrayList<IIndexFragmentBinding> result= new ArrayList<IIndexFragmentBinding>();
ArrayList<IIndexFragmentBinding> result= new ArrayList<>();
for (PDOMLinkage linkage : getLinkageList()) {
if (filter.acceptLinkage(linkage)) {
PDOMBinding[] bindings;
@ -1306,7 +1306,7 @@ public class PDOM extends PlatformObject implements IPDOM {
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope,
boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
ArrayList<IIndexFragmentBinding> result= new ArrayList<IIndexFragmentBinding>();
ArrayList<IIndexFragmentBinding> result= new ArrayList<>();
try {
for (PDOMLinkage linkage : getLinkageList()) {
if (filter.acceptLinkage(linkage)) {
@ -1345,7 +1345,7 @@ public class PDOM extends PlatformObject implements IPDOM {
}
public IIndexFragmentBinding[] findMacroContainers(char[] prefix, boolean isPrefix, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException {
ArrayList<IIndexFragmentBinding> result= new ArrayList<IIndexFragmentBinding>();
ArrayList<IIndexFragmentBinding> result= new ArrayList<>();
try {
for (PDOMLinkage linkage : getLinkageList()) {
if (filter.acceptLinkage(linkage)) {
@ -1363,7 +1363,7 @@ public class PDOM extends PlatformObject implements IPDOM {
@Override
public IIndexMacro[] findMacros(char[] prefix, boolean isPrefix, boolean isCaseSensitive,
IndexFilter filter, IProgressMonitor monitor) throws CoreException {
ArrayList<IIndexMacro> result= new ArrayList<IIndexMacro>();
ArrayList<IIndexMacro> result= new ArrayList<>();
try {
for (PDOMLinkage linkage : getLinkageList()) {
if (filter.acceptLinkage(linkage)) {
@ -1623,7 +1623,7 @@ public class PDOM extends PlatformObject implements IPDOM {
static class DebugLockInfo {
int fReadLocks;
int fWriteLocks;
List<StackTraceElement[]> fTraces= new ArrayList<StackTraceElement[]>();
List<StackTraceElement[]> fTraces= new ArrayList<>();
public int addTrace() {
fTraces.add(Thread.currentThread().getStackTrace());

View file

@ -130,9 +130,9 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation {
// Delete from the binding chain
PDOMMacro prevName = getPrevInContainer();
PDOMMacro nextName = getNextInContainer();
if (prevName != null)
if (prevName != null) {
prevName.setNextInContainer(nextName);
else {
} else {
PDOMMacroContainer container= getContainer();
container.setFirstDefinition(nextName);
if (nextName == null && container.isOrphaned()) {
@ -218,7 +218,7 @@ public class PDOMMacro implements IIndexMacro, IPDOMBinding, IASTFileLocation {
try {
IString plist= getParamListInDB();
if (plist != null) {
List<char[]> paramList = new ArrayList<char[]>();
List<char[]> paramList = new ArrayList<>();
final char[] cplist= plist.getChars();
final int end = cplist.length;
int from= 0;

View file

@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IIndexFile;
import org.eclipse.cdt.core.index.IIndexMacro;
@ -21,9 +24,6 @@ import org.eclipse.cdt.internal.core.index.IIndexScope;
import org.eclipse.cdt.internal.core.pdom.db.Database;
import org.eclipse.core.runtime.CoreException;
import java.util.ArrayList;
import java.util.List;
/**
* A container collecting definitions and references for macros.
* @since 5.0
@ -99,7 +99,7 @@ public class PDOMMacroContainer extends PDOMNamedNode implements IIndexMacroCont
public IIndexMacro[] getDefinitions() throws CoreException {
PDOMMacro macro;
List<PDOMMacro> macros= new ArrayList<PDOMMacro>();
List<PDOMMacro> macros= new ArrayList<>();
for (macro= getFirstDefinition(); macro != null; macro= macro.getNextInContainer()) {
macros.add(macro);
}

View file

@ -33,18 +33,22 @@ class PDOMMacroDefinitionName implements IIndexFragmentName {
public boolean couldBePolymorphicMethodCall() throws CoreException {
return false;
}
@Override
public IIndexName[] getEnclosedNames() throws CoreException {
return IIndexName.EMPTY_ARRAY;
}
@Override
public IIndexName getEnclosingDefinition() throws CoreException {
return null;
}
@Override
public IIndexFile getFile() throws CoreException {
return fMacro.getFile();
}
@Override
public int getNodeLength() {
return fMacro.getNodeLength();
@ -53,34 +57,42 @@ class PDOMMacroDefinitionName implements IIndexFragmentName {
public int getNodeOffset() {
return fMacro.getNodeOffset();
}
@Override
public boolean isBaseSpecifier() throws CoreException {
return false;
}
@Override
public boolean isReadAccess() throws CoreException {
return false;
}
@Override
public boolean isWriteAccess() throws CoreException {
return false;
}
@Override
public IASTFileLocation getFileLocation() {
return fMacro;
}
@Override
public boolean isDeclaration() {
return false;
}
@Override
public boolean isDefinition() {
return true;
}
@Override
public boolean isReference() {
return false;
}
@Override
public boolean isInlineNamespaceDefinition() {
return false;
@ -91,6 +103,7 @@ class PDOMMacroDefinitionName implements IIndexFragmentName {
public char[] toCharArray() {
return fMacro.getNameCharArray();
}
@Override
public String toString() {
return new String(getSimpleID());
@ -100,10 +113,12 @@ class PDOMMacroDefinitionName implements IIndexFragmentName {
public char[] getSimpleID() {
return fMacro.getNameCharArray();
}
@Override
public IIndexFragmentBinding getBinding() {
return fMacro;
}
@Override
public IIndexFragment getIndexFragment() {
return fMacro.getFragment();