Community
Participate
Working Groups
In CModelBuilder, there are a few blocks of code like this which handle template parameters: ... } else if (element instanceof StructureTemplate) { // set the template parameters StructureTemplateDeclaration classTemplate = (StructureTemplateDeclaration) element; classTemplate.setTemplateParameterTypes(parameterTypes); } ... The problem here is that an instanceof check is done for StructureTemplate, but the object is casted to StructureTemplateDeclaration, which isn't in a subclass of StructureTemplate. I'll post a patch shortly.
This branch actually never gets executed because the overall structure looks like this: if (element instanceof StructureTemplate) { StructureTemplate template = (StructureTemplate) element; ... } else if (element instanceof StructureTemplate) { StructureTemplateDeclaration template = (StructureTemplateDeclaration) element; ... } So the danger here isn't a potential ClassCastException. It just drops template parameters for template declarations in the model.
Created attachment 67096 [details] Proposed patch This patch fixes the instanceof checks so that template parameters get set on StructureTemplateDeclarations.
Applied to the cdt_3_1 branch. Thanks Jay.
Janees please verify.