Bug 559356 - PDE builders should require PDE nature
Summary: PDE builders should require PDE nature
Status: NEW
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.15   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-21 03:28 EST by Carsten Pfeiffer CLA
Modified: 2024-01-02 06:12 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Pfeiffer CLA 2020-01-21 03:28:39 EST
If you have a workspace without any PDE projects, but with a project using one of the PDE builders (ExtensionPointSchemaBuilder, FeatureConsistencyChecker, ManifestConsistencyChecker, UpdateSiteBuilder, DSBuilder), you may get unexpected expections during workspace building:

java.lang.IllegalArgumentException: Attempted to beginRule: MultiRule[] does not match outer scope rule: R/

(from org.eclipse.core.internal.jobs.ThreadJob.illegalPush())

This happens because the builders return an empty MultiRule in getRule() and org.eclipse.core.internal.resources.Resource.isConflicting() has this code:

if (rule instanceof MultiRule) {
	MultiRule multi = (MultiRule) rule;
	ISchedulingRule[] children = multi.getChildren();
	for (int i = 0; i < children.length; i++)
		if (isConflicting(children[i]))
			return true;
	return false;
}

So the MultiRule without children is deemed not conflicting with the outer workspaceroot rule, causing the Assert.

The only question is whether Resource.isConflicting() should be fixed or the creation of the MultiRule in the builders or whether the builders should fail or abort much earlier, because the project lacks the PDE nature.
Comment 1 Julian Honnen CLA 2020-01-21 05:08:20 EST
Is there a reason that you are using PDE builders in non-PDE projects?

In bug 550557 comment 16 this was defined as an invalid configuration.
Comment 2 Carsten Pfeiffer CLA 2020-01-21 05:19:48 EST
Sorry, I didn't explicitly mention it. It is a misconfiguration of course. 

But this issue is hard to debug since the error message has no trace to the source of the problem. You basically have to search the source code of eclipse internals and all installed builders to check for possibly empty MultiRules.

So from my point of view it would be sufficient to fail hard or show/log a helpful error message pinpointing the problem.
Comment 3 Julian Honnen CLA 2020-01-21 06:49:21 EST
(In reply to Carsten Pfeiffer from comment #2)
> So from my point of view it would be sufficient to fail hard or show/log a
> helpful error message pinpointing the problem.
Sounds good!

We could link the PDE builders to the corresponding PDE nature, so that BuildManager removes them automatically from non-PDE projects.

We need to check that a builder is only used by a single nature though.
Comment 4 Eclipse Genie CLA 2022-01-11 01:49:44 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Eclipse Genie CLA 2024-01-02 06:12:34 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.