1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Reducing compiler warnings.

This commit is contained in:
Markus Schorn 2012-01-02 13:38:43 +01:00
parent 1b67403176
commit 934ea4b7b8
5 changed files with 17 additions and 9 deletions

View file

@ -20,7 +20,7 @@ import java.util.List;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public class CharArrayObjectMap <T> extends CharTable { public class CharArrayObjectMap <T> extends CharTable {
public static final CharArrayObjectMap<Object> EMPTY_MAP = new CharArrayObjectMap<Object>(0) { public static final CharArrayObjectMap<?> EMPTY_MAP = new CharArrayObjectMap<Object>(0) {
@Override @Override
public Object clone() { return this; } public Object clone() { return this; }
@Override @Override

View file

@ -77,6 +77,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
super(physicalNode); super(physicalNode);
} }
@Override
public EScopeKind getKind() { public EScopeKind getKind() {
return EScopeKind.eClassType; return EScopeKind.eClassType;
} }
@ -270,6 +271,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
return true; return true;
} }
@Override
public ICPPConstructor[] getConstructors() { public ICPPConstructor[] getConstructors() {
return getConstructors(null, true); return getConstructors(null, true);
} }
@ -277,7 +279,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
private ICPPConstructor[] getConstructors(IASTName forName, boolean forceResolve) { private ICPPConstructor[] getConstructors(IASTName forName, boolean forceResolve) {
populateCache(); populateCache();
final CharArrayObjectMap nameMap = bindings; final CharArrayObjectMap<Object> nameMap = bindings;
if (nameMap == null) if (nameMap == null)
return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY; return ICPPConstructor.EMPTY_CONSTRUCTOR_ARRAY;
@ -365,6 +367,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getClassType() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getClassType()
*/ */
@Override
public ICPPClassType getClassType() { public ICPPClassType getClassType() {
ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) getPhysicalNode(); ICPPASTCompositeTypeSpecifier compSpec = (ICPPASTCompositeTypeSpecifier) getPhysicalNode();
final IASTName name = compSpec.getName(); final IASTName name = compSpec.getName();
@ -378,6 +381,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getImplicitMethods() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope#getImplicitMethods()
*/ */
@Override
public ICPPMethod[] getImplicitMethods() { public ICPPMethod[] getImplicitMethods() {
if (implicits == null) if (implicits == null)
return ICPPMethod.EMPTY_CPPMETHOD_ARRAY; return ICPPMethod.EMPTY_CPPMETHOD_ARRAY;

View file

@ -38,7 +38,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
*/ */
public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope { public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
private CharArrayObjectMap labels = CharArrayObjectMap.EMPTY_MAP; private CharArrayObjectMap<IBinding> labels = CharArrayObjectMap.emptyMap();
/** /**
* @param physicalNode * @param physicalNode
@ -47,6 +47,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
super(physicalNode); super(physicalNode);
} }
@Override
public EScopeKind getKind() { public EScopeKind getKind() {
return EScopeKind.eLocal; return EScopeKind.eLocal;
} }
@ -61,7 +62,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
return; return;
if (labels == CharArrayObjectMap.EMPTY_MAP) if (labels == CharArrayObjectMap.EMPTY_MAP)
labels = new CharArrayObjectMap(2); labels = new CharArrayObjectMap<IBinding>(2);
labels.put(binding.getNameCharArray(), binding); labels.put(binding.getNameCharArray(), binding);
} }
@ -70,7 +71,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[]) * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getBinding(int, char[])
*/ */
public IBinding getBinding(IASTName name) { public IBinding getBinding(IASTName name) {
return (IBinding) labels.get(name.getLookupKey()); return labels.get(name.getLookupKey());
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -84,7 +85,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
for (int i = 0; i < labels.size(); i++) { for (int i = 0; i < labels.size(); i++) {
char[] key = labels.keyAt(i); char[] key = labels.keyAt(i);
if (CharArrayUtils.equals(key, n)) { if (CharArrayUtils.equals(key, n)) {
bindings.add((IBinding) labels.get(key)); bindings.add(labels.get(key));
} }
} }
@ -108,6 +109,7 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope#getBodyScope() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope#getBodyScope()
*/ */
@Override
public IScope getBodyScope() { public IScope getBodyScope() {
IASTFunctionDeclarator fnDtor = (IASTFunctionDeclarator) getPhysicalNode(); IASTFunctionDeclarator fnDtor = (IASTFunctionDeclarator) getPhysicalNode();
IASTNode parent = fnDtor.getParent(); IASTNode parent = fnDtor.getParent();

View file

@ -320,7 +320,9 @@ class BaseClassLookup {
return; return;
fCollected= true; fCollected= true;
data.foundItems = CPPSemantics.mergePrefixResults((CharArrayObjectMap) data.foundItems, fBindings, true); @SuppressWarnings("unchecked")
final CharArrayObjectMap<Object> resultMap = (CharArrayObjectMap<Object>) data.foundItems;
data.foundItems = CPPSemantics.mergePrefixResults(resultMap, fBindings, true);
for (int i= 0; i < fChildren.size(); i++) { for (int i= 0; i < fChildren.size(); i++) {
BaseClassLookup child = fChildren.get(i); BaseClassLookup child = fChildren.get(i);
child.collectResultForContentAssist(data); child.collectResultForContentAssist(data);

View file

@ -341,7 +341,7 @@ public class LookupData {
if (foundItems instanceof Object[]) if (foundItems instanceof Object[])
return ((Object[]) foundItems).length != 0; return ((Object[]) foundItems).length != 0;
if (foundItems instanceof CharArrayObjectMap) if (foundItems instanceof CharArrayObjectMap)
return ((CharArrayObjectMap) foundItems).size() != 0; return ((CharArrayObjectMap<?>) foundItems).size() != 0;
return false; return false;
} }