Bug 511476 - Tool Chain Editor: Unable to change tool for a single file
Summary: Tool Chain Editor: Unable to change tool for a single file
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build-managed (show other bugs)
Version: 9.2.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-01 09:51 EST by Xavier Raynaud CLA
Modified: 2020-09-04 15:23 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier Raynaud CLA 2017-02-01 09:51:39 EST
To reproduce:

1/ Create a managed-make project.
2/ Select a single C file
3/ Open properties
4/ Select C/C++ Build => Tool Chain Editor
5/ Change tool in "select tool"

=> A dialog box opens with "Internal Error", displaying the following stack trace:

!ENTRY org.eclipse.cdt.ui 4 4 2017-02-01 15:42:23.359
!MESSAGE Internal error
!STACK 0
java.lang.ClassCastException: [Lorg.eclipse.cdt.managedbuilder.core.ITool; cannot be cast to [Lorg.eclipse.cdt.managedbuilder.internal.core.Tool;
	at org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolListModification.<init>(ToolListModification.java:408)
	at org.eclipse.cdt.managedbuilder.internal.tcmodification.FileInfoModification.<init>(FileInfoModification.java:37)
	at org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolChainModificationManager.createModification(ToolChainModificationManager.java:111)
	at org.eclipse.cdt.managedbuilder.ui.properties.ToolChainEditTab.performApply(ToolChainEditTab.java:484)
	at org.eclipse.cdt.ui.newui.AbstractCPropertyTab.handleTabEvent(AbstractCPropertyTab.java:553)
	at org.eclipse.cdt.ui.newui.AbstractPage.forEach(AbstractPage.java:1062)



Explanation of the error:
 - org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration.getTools() returns an array of ITool.
 - org.eclipse.cdt.managedbuilder.internal.tcmodification.ToolListModification() brutally casts this array into an array of Tool.


Note: when doing the same thing for a Folder, it works. Because implementation of FolderInfo.class returns an array of Tool.