Bug 197387 - "default" builder selection if no builder is specified with the tool-chain
Summary: "default" builder selection if no builder is specified with the tool-chain
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: cdt-build-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-21 01:57 EDT by Patrick McMichael CLA
Modified: 2020-09-04 15:17 EDT (History)
0 users

See Also:


Attachments
Simple proposed solution (983 bytes, patch)
2007-07-21 02:03 EDT, Patrick McMichael CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick McMichael CLA 2007-07-21 01:57:19 EDT
Build ID: I20070625-1500

Steps To Reproduce:
1.  Create a plugin that uses the CDT's managed builder extensions with a configuration/toolchain hierarchy
2.  In one of your base-class toolchains "forget" to assign a 
builder.
3.  Create a project with your new toolchain/builder configuration.
4.  Try to access the build properties of said project.


More information:
The error I get everytime is:

!ENTRY org.eclipse.jface 4 2 2007-07-21 01:14:16.468
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.cdt.managedbuilder.internal.core.Configuration.getBuilderForInternalBuilderEnablement(Configuration.java:2061)
	at org.eclipse.cdt.managedbuilder.internal.core.Configuration.canEnableInternalBuilder(Configuration.java:2036)
	at org.eclipse.cdt.managedbuilder.ui.properties.BuilderSettingsTab.updateButtons(BuilderSettingsTab.java:136)
	at org.eclipse.cdt.managedbuilder.ui.properties.BuilderSettingsTab.updateData(BuilderSettingsTab.java:275)
	at org.eclipse.cdt.ui.newui.AbstractCPropertyTab.setVisible(AbstractCPropertyTab.java:198)
	at org.eclipse.cdt.managedbuilder.ui.properties.BuilderSettingsTab.setVisible(BuilderSettingsTab.java:334)
	at org.eclipse.cdt.ui.newui.AbstractCPropertyTab.handleTabEvent(AbstractCPropertyTab.java:507)
Comment 1 Patrick McMichael CLA 2007-07-21 02:03:31 EDT
Created attachment 74289 [details]
Simple proposed solution

Attached is my proposed fix for this bug.

This is my first bug report, so please let me know if I've done something wrong.

-Patrick
Comment 2 Mikhail Sennikovsky CLA 2007-07-24 11:54:04 EDT
Actually the builder is a required element currently. How would the Build System decide which builder to use if there is no one specified?
So the problem you are seeing is caused by the buggy tool-chain definition.

Basically we could allow tool-chain definitions to NOT specify the builder. In this case the "default" builder could be chosen automatically.
This could be the "Internal Builder" for "managed" projects and "make" builder for "makefile" projects.

I'll update the bug summary to mostly reflect the problem as I'm seeing it and will mark the bug as "enhancement".

Thanks,
Mikhail
Comment 3 Patrick McMichael CLA 2007-07-25 08:33:21 EDT
(In reply to comment #2)
Mikhail, thanks very much for your reply.  Please forgive me for digging a bit deeper into this.

It does seem to me to be a bug when I get an ugly NullPointer exception.

I realize that toolchains are meant to have builders associated with them.  I also appreciate your willingness to amend that requirement, that is an excellent long-term solution to this "problem" (if it can be called that).  

What I was looking for though was more of a way for the CDT to protect itself from users who do not know/remember to put one in.  Should their projects throw a NullPointerException, or should the CDT degrade nicely.  The patch I submitted is just simply a null pointer check that should arguably be there already.

To your question "How would the Build System decide which builder to use if there is no one specified?" I would agree that would be a real issue if the toolchain in question here weren't an abstract base class one.  An abstract toolchain, at least, should be especially relieved of these requirements as it is guaranteed it will never be instantiated.

Just some things to consider,

Thanks again for your reply,

-Patrick
Comment 4 Patrick McMichael CLA 2007-07-25 08:35:44 EDT
Sorry, didn't mean to switch severity back to normal -- I'll let you do that if you see fit.

-Patrick