Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 259997 - Restrictions changed errors appear on manifest rather than changed type
Summary: Restrictions changed errors appear on manifest rather than changed type
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: API Tools (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-05 16:38 EST by Darin Wright CLA
Modified: 2009-02-18 11:44 EST (History)
2 users (show)

See Also:
Olivier_Thomann: review? (darin.eclipse)


Attachments
Image of editor with red squiggles at wrong places (24.31 KB, image/png)
2009-01-07 06:55 EST, Dani Megert CLA
no flags Details
Proposed fix (22.92 KB, patch)
2009-02-17 15:40 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2009-01-05 16:38:48 EST
Follow up from bug 240914, I found that added restrictions appear as errors in the MANIFEST file rather than on the types themselves. When a restriction has changed, I would expect the error to appear on the changed member.

For example:

Description	Resource	Path	Location	Type
Restrictions have been added for type org.eclipse.compare.patch.IFilePatchResult	MANIFEST.MF	org.eclipse.compare/META-INF	line 27	Compatibility Problem
Restrictions have been added for type org.eclipse.compare.patch.IHunk	MANIFEST.MF	org.eclipse.compare/META-INF	line 30	Compatibility Problem
Restrictions have been added for type org.eclipse.compare.patch.PatchConfiguration	MANIFEST.MF	org.eclipse.compare/META-INF	line 24	Compatibility Problem
Comment 1 Olivier Thomann CLA 2009-01-06 11:22:31 EST
The problem comes from the fact that we are reporting markers against the project that we are checking.
In this case the type has been moved to a new bundle in the workspace baseline. So we detect the restriction change when analyzing org.eclipse.compare, not org.eclipse.compare.core.

It is unclear if org.eclipse.compare.core is also from source in the workspace. We could have org.eclipse.compare from source and org.eclipse.compare.core from binary. In this case there is no better place to report the marker than the MANIFEST.MF file of the current bundle (i.e. org.eclipse.compare).

If org.eclipse.compare.core is from source, we could try to locate the error on the corresponding type.

Any thoughts?
Comment 2 Darin Wright CLA 2009-01-06 11:43:30 EST
Sounds like we should maintain the workspace relative path in order to create problems properly (rather than project relative, since we can analyze types outside the project). We need to investigate if "baseline-relative paths" work in the case for non-workspace (releng build) analysis.

Ideally, the problem would reside with the type/project where the problem resides.

In the workspace we should only create the problem marker if the corresponding project exists. In the releng analysis, we create the problem against the corresponding component.
Comment 3 Dani Megert CLA 2009-01-07 06:49:23 EST
Note that this bugs gives a strange/confusing result when opening the manifest (see attached image).
Comment 4 Dani Megert CLA 2009-01-07 06:55:13 EST
Created attachment 121792 [details]
Image of editor with red squiggles at wrong places
Comment 5 Olivier Thomann CLA 2009-01-12 10:47:58 EST
I am investigating this issue trying not to break existing filters.
Comment 6 Olivier Thomann CLA 2009-01-14 09:36:06 EST
When I investigated this issue, I discovered some new ones.
When we have a bundle that is split into two different bundles in the current stream, we have multiple issues.
Let's say we have:
A -> A' + B (re-exported through A')

If I compare A and A', I can find out that some types (in A) that have been moved to B have new restrictions.
This is exactly the case that we have with compare and compare.core.

Right now the logic is to compare bundle to bundle.
So when comparing A to A', no problem. We detect the right errors and we can report them on types in B if necessary.
However this leads to new issues like:
- where do you put the filters for these errors?
Filters should be reported against the corresponding project since they can be per project. So we should record the filters for these problems in B even if we are comparing A and A'.

This means we have to be able to retrieve the right api store in order to find out whether a problem is filtered or not.

Now the last issue I found. Incremental build of types in B or full build of B removes the problems against the types from B since B has no equivalent bundle in the reference baseline. I could not come up a good solution so far to be able to retrieve the types from A when rebuilding B.
B is a bundle on its own. So we should be able to rebuild it with a full build or an incremental build and still be able to "preserve" the errors detected when building A.

If you have any idea how this could be handled in a way that is not confusing for the users, please let me know.
I can fix where the errors are reported, but this doesn't solve all issues with this split bundle case.

Comment 7 Olivier Thomann CLA 2009-01-15 14:47:40 EST
So reporting the errors on the right types is not an issue, but incremental and full build of the new bundle (not present in the reference baseline) is the remaining issue.
Comment 8 Olivier Thomann CLA 2009-02-04 11:09:35 EST
After more thinking about this, I plan to do the following:
1) report restrictions errors against the compare bundle. From an API standpoint, changing the restrictions of some types that have been moved to the new compare.core bundle only affect users of the compare bundle. Users of the new bundle are not affected as they will use the types directly with the modified restrictions. So it doesn't make sense to report the error against the types defined inside the compare.core bundle.
2) This being said, I think we should report the errors against the project. I don't see a good reason to report these errors against the MANIFEST.MF file.

This will require changes in the way the api filters work. Right now it is not possible to add a filter for markers reported against the project. We should get rid of this limitation.

Now we still have an incremental build issue. When removing the added restriction on types inside compare.core, the markers on the compare project should be removed.
Same apply when adding more restrictions or making more changes to the types defined inside compare.core.

Any thought on this ?
Comment 9 Dani Megert CLA 2009-02-06 04:15:59 EST
I think logically the project is the right place but the advantage of putting it on the manifest is better support for quick fix and eventually you can give more context in the quick fix hover.
Comment 10 Olivier Thomann CLA 2009-02-06 09:45:57 EST
So you are suggesting that I should simply report the markers on the first line of the manifest ?
I discussed with Darin a way to get the incremental build working in this case. I'll try to get it done today.

The full build issue is not a problem because all markers are cleanup up. The incremental build is more tricky in this case.
This would be true for all types moved to a different bundle even if the target bundle exists in the reference baseline.

The major issue is that I cannot report these errors on the compare.core bundle in this case as users of the compare.core are not concerned with changes made the compare bundle. Restriction changes are only an issue in the context of the compare bundle, not compare.core.
Comment 11 Dani Megert CLA 2009-02-09 04:40:53 EST
>So you are suggesting that I should simply report the markers on the first line
>of the manifest ?
Yes.
Comment 12 Olivier Thomann CLA 2009-02-10 11:06:45 EST
Released for 3.5M6.
Darin, please verify.
Comment 13 Olivier Thomann CLA 2009-02-13 11:41:57 EST
Reopen. This is causing lots of side-effects.
Needs more investigation.
Comment 14 Olivier Thomann CLA 2009-02-13 21:23:39 EST
Released for 3.5M6.

Darin, please verify. I'll reassess this fix with regards to bug 233643. At least the side-effects seen in bug 264842 are fixed.
Comment 15 Olivier Thomann CLA 2009-02-17 15:39:23 EST
Reopen.
Comment 16 Olivier Thomann CLA 2009-02-17 15:40:04 EST
Created attachment 125940 [details]
Proposed fix

Darin, please give it a try before I release.
Comment 17 Darin Wright CLA 2009-02-17 16:13:10 EST
I found incremental build not working as expected. For example, if I remove #getLabel() from IHunk, no error appears in incremental build, but full build does find the problem (for org.eclipse.compare).
Comment 18 Darin Wright CLA 2009-02-17 16:15:41 EST
Similarly, fixing the problem did not make the issue go away on org.eclipse.compare (incremental biuld).
Comment 19 Olivier Thomann CLA 2009-02-18 10:54:07 EST
(In reply to comment #17)
> I found incremental build not working as expected. For example, if I remove
> #getLabel() from IHunk, no error appears in incremental build, but full build
> does find the problem (for org.eclipse.compare).
It works fine for me. In both ways, adding or removing the method works.
I get an error reported against org.eclipse.compare.
Comment 20 Olivier Thomann CLA 2009-02-18 11:37:47 EST
Released for 3.5M6.
Darin, please verify.
Comment 21 Darin Wright CLA 2009-02-18 11:44:52 EST
Verified this works in my target workspace (I could not revalidate in the host due to a p2 bug).