mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Cosmetics.
This commit is contained in:
parent
0152c28c22
commit
8ce322ad37
6 changed files with 31 additions and 30 deletions
|
@ -8,7 +8,6 @@
|
|||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.parser.util;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
@ -24,7 +23,7 @@ public class HashTable implements Cloneable {
|
|||
return currEntry == -1;
|
||||
}
|
||||
|
||||
final public int size() {
|
||||
public final int size() {
|
||||
return currEntry + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil;
|
|||
* For safe usage in index bindings, all fields need to be final or volatile.
|
||||
*/
|
||||
public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializationScope {
|
||||
final private ICPPClassSpecialization specialClass;
|
||||
private final ICPPClassSpecialization specialClass;
|
||||
private volatile ICPPBase[] fBases; // Used by the pdom bindings, needs to be volatile.
|
||||
|
||||
public AbstractCPPClassSpecializationScope(ICPPClassSpecialization specialization) {
|
||||
|
@ -79,7 +79,8 @@ public class AbstractCPPClassSpecializationScope implements ICPPClassSpecializat
|
|||
|
||||
ICPPClassType specialized = specialClass.getSpecializedBinding();
|
||||
IScope classScope = specialized.getCompositeScope();
|
||||
IBinding[] bindings = classScope != null ? classScope.getBindings(new ScopeLookupData(name, resolve, false)) : null;
|
||||
IBinding[] bindings = classScope != null ?
|
||||
classScope.getBindings(new ScopeLookupData(name, resolve, false)) : null;
|
||||
|
||||
if (bindings == null)
|
||||
return null;
|
||||
|
|
|
@ -87,7 +87,7 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements ICPPClass
|
|||
while (parent instanceof IASTName)
|
||||
parent = parent.getParent();
|
||||
if (parent instanceof ICPPASTCompositeTypeSpecifier) {
|
||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier)parent;
|
||||
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) parent;
|
||||
return compSpec.getScope();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ final class Chunk {
|
|||
void read() throws CoreException {
|
||||
try {
|
||||
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
||||
fDatabase.read(buf, (long) fSequenceNumber*Database.CHUNK_SIZE);
|
||||
fDatabase.read(buf, (long) fSequenceNumber * Database.CHUNK_SIZE);
|
||||
} catch (IOException e) {
|
||||
throw new CoreException(new DBStatus(e));
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ final class Chunk {
|
|||
void flush() throws CoreException {
|
||||
try {
|
||||
final ByteBuffer buf= ByteBuffer.wrap(fBuffer);
|
||||
fDatabase.write(buf, (long) fSequenceNumber*Database.CHUNK_SIZE);
|
||||
fDatabase.write(buf, (long) fSequenceNumber * Database.CHUNK_SIZE);
|
||||
} catch (IOException e) {
|
||||
throw new CoreException(new DBStatus(e));
|
||||
}
|
||||
|
|
|
@ -14,14 +14,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.db;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
@ -32,6 +24,14 @@ import java.nio.channels.ClosedChannelException;
|
|||
import java.nio.channels.FileChannel;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
import com.ibm.icu.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Database encapsulates access to a flat binary format file with a memory-manager-like API for
|
||||
* obtaining and releasing areas of storage (memory).
|
||||
|
@ -668,7 +668,7 @@ public class Database {
|
|||
public void giveUpExclusiveLock(final boolean flush) throws CoreException {
|
||||
if (fExclusiveLock) {
|
||||
try {
|
||||
ArrayList<Chunk> dirtyChunks= new ArrayList<Chunk>();
|
||||
ArrayList<Chunk> dirtyChunks= new ArrayList<>();
|
||||
synchronized (fCache) {
|
||||
for (int i= 1; i < fChunksUsed; i++) {
|
||||
Chunk chunk= fChunks[i];
|
||||
|
@ -716,7 +716,7 @@ public class Database {
|
|||
}
|
||||
|
||||
// Be careful as other readers may access chunks concurrently.
|
||||
ArrayList<Chunk> dirtyChunks= new ArrayList<Chunk>();
|
||||
ArrayList<Chunk> dirtyChunks= new ArrayList<>();
|
||||
synchronized (fCache) {
|
||||
for (int i= 1; i < fChunksUsed ; i++) {
|
||||
Chunk chunk= fChunks[i];
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Bryan Wilkinson (QNX)
|
||||
* Sergey Prigogin (Google)
|
||||
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
||||
* Doug Schaefer (QNX) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Ferguson (Symbian)
|
||||
* Bryan Wilkinson (QNX)
|
||||
* Sergey Prigogin (Google)
|
||||
* Jens Elmenthaler - http://bugs.eclipse.org/173458 (camel case completion)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
|
||||
|
||||
|
@ -60,6 +60,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
||||
private static final class PopulateMap implements IPDOMVisitor {
|
||||
private final CharArrayMap<List<PDOMBinding>> fResult;
|
||||
|
||||
private PopulateMap(CharArrayMap<List<PDOMBinding>> result) {
|
||||
fResult = result;
|
||||
}
|
||||
|
@ -71,7 +72,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
|||
final char[] nchars = binding.getNameCharArray();
|
||||
List<PDOMBinding> list= fResult.get(nchars);
|
||||
if (list == null) {
|
||||
list= new ArrayList<PDOMBinding>();
|
||||
list= new ArrayList<>();
|
||||
fResult.put(nchars, list);
|
||||
}
|
||||
list.add(binding);
|
||||
|
@ -126,7 +127,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
|||
try {
|
||||
final char[] nameChars = name.getSimpleID();
|
||||
if (CharArrayUtils.equals(fBinding.getNameCharArray(), nameChars)) {
|
||||
//9.2 ... The class-name is also inserted into the scope of the class itself
|
||||
// 9.2 ... The class-name is also inserted into the scope of the class itself
|
||||
return getClassNameBinding();
|
||||
}
|
||||
|
||||
|
@ -165,7 +166,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
|||
}
|
||||
return fBinding.getConstructors();
|
||||
}
|
||||
return new IBinding[] {getClassNameBinding()};
|
||||
return new IBinding[] { getClassNameBinding() };
|
||||
}
|
||||
return getBindingsViaCache(fBinding, nameChars, IndexFilter.CPP_DECLARED_OR_IMPLICIT_NO_INSTANCE);
|
||||
}
|
||||
|
@ -244,8 +245,8 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
|||
CharArrayMap<List<PDOMBinding>> map= cached == null ? null : cached.get();
|
||||
|
||||
if (map == null) {
|
||||
// there is no cache, build it:
|
||||
map= new CharArrayMap<List<PDOMBinding>>();
|
||||
// There is no cache, build it:
|
||||
map= new CharArrayMap<>();
|
||||
IPDOMVisitor visitor= new PopulateMap(map);
|
||||
visitor.visit(ct);
|
||||
ct.acceptUncached(visitor);
|
||||
|
@ -256,7 +257,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
|||
|
||||
@Override
|
||||
public IBinding[] find(String name) {
|
||||
return CPPSemantics.findBindings( this, name, false );
|
||||
return CPPSemantics.findBindings(this, name, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -271,7 +272,7 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
|||
acceptViaCache(fBinding, methods, false);
|
||||
return methods.getMethods();
|
||||
} catch (CoreException e) {
|
||||
return new ICPPMethod[0];
|
||||
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue