mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 18:55:38 +02:00
Fixed an NPE.
Change-Id: If2455671e50e99a662d469febc8e5babf7fc24e3
This commit is contained in:
parent
cfd51db02b
commit
ef33d0d299
1 changed files with 24 additions and 20 deletions
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
@ -125,30 +126,33 @@ public class OverrideIndicatorManager implements ICReconcilingListener {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
IASTDeclarator decl = ASTQueries.findInnermostDeclarator(declarator);
|
IASTDeclarator decl = ASTQueries.findInnermostDeclarator(declarator);
|
||||||
IBinding binding = decl.getName().resolveBinding();
|
IASTName name = decl.getName();
|
||||||
if (binding instanceof ICPPMethod) {
|
if (name != null) {
|
||||||
ICPPMethod method = (ICPPMethod) binding;
|
IBinding binding = name.resolveBinding();
|
||||||
try {
|
if (binding instanceof ICPPMethod) {
|
||||||
ICPPMethod overriddenMethod = testForOverride(method, declarator);
|
ICPPMethod method = (ICPPMethod) binding;
|
||||||
if (overriddenMethod != null) {
|
try {
|
||||||
try {
|
ICPPMethod overriddenMethod = testForOverride(method, declarator);
|
||||||
ICElementHandle baseDeclaration = IndexUI.findAnyDeclaration(index, null, overriddenMethod);
|
if (overriddenMethod != null) {
|
||||||
if (baseDeclaration == null) {
|
try {
|
||||||
ICElementHandle[] allDefinitions = IndexUI.findAllDefinitions(index, overriddenMethod);
|
ICElementHandle baseDeclaration = IndexUI.findAnyDeclaration(index, null, overriddenMethod);
|
||||||
if (allDefinitions.length > 0) {
|
if (baseDeclaration == null) {
|
||||||
baseDeclaration = allDefinitions[0];
|
ICElementHandle[] allDefinitions = IndexUI.findAllDefinitions(index, overriddenMethod);
|
||||||
|
if (allDefinitions.length > 0) {
|
||||||
|
baseDeclaration = allDefinitions[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OverrideIndicator indicator = new OverrideIndicator(annotationKind, annotationMessage, baseDeclaration);
|
||||||
|
|
||||||
|
IASTFileLocation fileLocation = declarator.getFileLocation();
|
||||||
|
Position position = new Position(fileLocation.getNodeOffset(), fileLocation.getNodeLength());
|
||||||
|
annotationMap.put(indicator, position);
|
||||||
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
OverrideIndicator indicator = new OverrideIndicator(annotationKind, annotationMessage, baseDeclaration);
|
|
||||||
|
|
||||||
IASTFileLocation fileLocation = declarator.getFileLocation();
|
|
||||||
Position position = new Position(fileLocation.getNodeOffset(), fileLocation.getNodeLength());
|
|
||||||
annotationMap.put(indicator, position);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
}
|
||||||
|
} catch (DOMException e) {
|
||||||
}
|
}
|
||||||
} catch (DOMException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue