From 9822ba56d8fb248df252acda23d79aeb1133cdee Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Tue, 29 Jan 2013 04:22:24 -0500 Subject: Bug 399363 - ClassCastException in CPPBaseClause.getBaseClassType() Change-Id: Ia7f168648b739334982b7e0728250fbb663bd1c5 Reviewed-on: https://git.eclipse.org/r/9994 Reviewed-by: Sergey Prigogin IP-Clean: Sergey Prigogin Tested-by: Sergey Prigogin --- .../cdt/internal/core/dom/parser/cpp/CPPBaseClause.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java index 5d45beba891..21c80c020a4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPBaseClause.java @@ -1,14 +1,15 @@ /******************************************************************************* - * Copyright (c) 2004, 2010 IBM Corporation and others. + * Copyright (c) 2004, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Andrew Niefer (IBM Corporation) - initial API and implementation - * Bryan Wilkinson (QNX) - * Markus Schorn (Wind River Systems) + * Andrew Niefer (IBM Corporation) - initial API and implementation + * Bryan Wilkinson (QNX) + * Markus Schorn (Wind River Systems) + * Nathan Ridge *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.parser.cpp; @@ -47,8 +48,10 @@ public class CPPBaseClause implements ICPPBase, ICPPInternalBase { public IType getBaseClassType() { if (baseClass == null) { IBinding b = base.getName().resolveBinding(); - if (b instanceof IProblemBinding || ! (b instanceof IType)) { + if (b instanceof IProblemBinding) { baseClass = new CPPClassType.CPPClassTypeProblem(base.getName(), ((IProblemBinding) b).getID()); + } else if (!(b instanceof IType)) { + baseClass = new CPPClassType.CPPClassTypeProblem(base.getName(), ISemanticProblem.BINDING_NO_CLASS); } else { baseClass= (IType) b; IType check= getNestedType(baseClass, TDEF); -- cgit v1.2.3