Bug 146869 - "optional" not really working?
Summary: "optional" not really working?
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.2.2   Edit
Assignee: Branko Tripkovic CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 157481 162523 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-13 12:59 EDT by Helmut J. Haigermoser CLA
Modified: 2007-01-12 15:36 EST (History)
8 users (show)

See Also:


Attachments
update site (1.96 KB, application/octet-stream)
2006-10-06 15:01 EDT, DJ Houghton CLA
no flags Details
update site (2.95 KB, application/octet-stream)
2006-10-06 16:00 EDT, DJ Houghton CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Helmut J. Haigermoser CLA 2006-06-13 12:59:46 EDT
A feature can include other features, so says the feature.xml description.
In this include-statement an option, "optional=true/false(default)" is
mentioned, I tried that one like this: In a plain eclipse installation,
if I remove the directory "features/org.eclipse.jdt.source..." and
add an "optional" to the reference of this feature in the "sdk"-feature,
an error is reported by the UM. Is this bug or feature?
Comment 1 Anli Shundi CLA 2006-06-13 13:46:07 EDT
Seems that the problem is in IncludedFeatureReference

line 84:

	public IncludedFeatureReferenceModel(IFeatureReference featureReference) {
		super((FeatureReferenceModel)featureReference);
		isOptional(false);

That line ignores the value of isOptional.  WHY ?!
Comment 2 Anli Shundi CLA 2006-06-15 14:46:15 EDT
Any update on this?  The line above should instead be along the lines of:

if (featureReference instanceof IIncludedFeatureReference)
  isOptional( ((IIncludedFeatureReference)featureReference).isOptional() );
else
  isOptional(false);//?! may this happen?
Comment 3 Branko Tripkovic CLA 2006-06-15 14:49:17 EDT
will be fixed for 3.2.1
Comment 4 Andrew Niefer CLA 2006-09-21 10:17:38 EDT
*** Bug 157481 has been marked as a duplicate of this bug. ***
Comment 5 DJ Houghton CLA 2006-10-06 12:46:47 EDT
When you apply the patch in comment #2, update manager allows you to continue in the wizard and select your feature. After a couple of pages you are prompted with a list of optional feature which you can de-select and proceed with the installation of your original feature.

When Eclipse is restarted and you go to Help -> About -> Plug-in Details your new plug-ins are listed. When you go to Help -> About -> Feature Details your new feature is NOT listed.

So it looks like the real fix for this problem is not only limited to this one class.
Comment 6 DJ Houghton CLA 2006-10-06 15:01:06 EDT
Created attachment 51572 [details]
update site

Sample update site that includes a feature with a reference to an optional (missing) feature.
Comment 7 DJ Houghton CLA 2006-10-06 16:00:35 EDT
Created attachment 51577 [details]
update site

Ignore my comment previously related to the Help -> About details. Update manager only adds features to this list which are considered to have branding. (that is, they have a bundle with the same identifier)

Attached is a new update site which still exhibits the original problem, but the resulting features (when installed with the patch) appear in Help -> About.
Comment 8 DJ Houghton CLA 2006-12-06 14:23:30 EST
Branko, is the code change described in comment #2 all that is needed to fix this bug?

KevinH, please add your +1 as a PMC representative if you approve for fixing in the 3.2 maintenance stream.
Comment 9 Branko Tripkovic CLA 2006-12-13 18:31:32 EST
this is in 3.2.2 stream and we have published a patch for 3.2.1.
Comment 10 Dejan Glozic CLA 2006-12-13 19:01:35 EST
Branko, can you also put in HEAD and version/release into 3.3 M4?
Comment 11 Branko Tripkovic CLA 2006-12-14 11:23:31 EST
in the head
Comment 12 Branko Tripkovic CLA 2007-01-12 15:36:20 EST
*** Bug 162523 has been marked as a duplicate of this bug. ***