Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 259958

Summary: Project specific compile option missing-packages not read
Product: [Eclipse Project] PDE Reporter: Gunnar Wagenknecht <gunnar>
Component: UIAssignee: Vikas Chandra <Vikas.Chandra>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ben.abernathy, daniel_megert, psuzzi, richardfearn, Vikas.Chandra
Version: 3.5Flags: Vikas.Chandra: review+
daniel_megert: review-
Target Milestone: 4.7 M2   
Hardware: PC   
OS: Windows Vista   
See Also: https://git.eclipse.org/r/69069
https://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=58c840600e0b33276fc3e351b57cec0614588b17
https://git.eclipse.org/r/72405
https://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=1470b7c7056bd80c8c283fd937bc0ae07bc453cd
Whiteboard:
Bug Depends on:    
Bug Blocks: 492526    
Attachments:
Description Flags
video showing the issue solved
none
reverted patch
none
Fix
none
Image describing the current and past options which control the error in manifest file
none
Fix with updated license year none

Description Gunnar Wagenknecht CLA 2009-01-05 10:30:52 EST
Eclipse SDK
Version: 3.5.0
Build id: I20081211-1908

I have a plug-in project (bundle "A") which exports packages from another plug-in (bundle "B"). It depends on that plug-in and re-exports it.

Require-Bundle: bundle.b;visibility:=reexport,
 ...

Bundle "B" exports the package as split-package. Bundle "A" collects all split packages together and exports them as single package. However, there is no actual code in bundle "A". It just collects the packages.

I have two issues currently.

(a) PDE flags all experted packages in bundle "A" as missing. IHMO this is incorrect. The packages are on the build path. They are just not defined in bundle "A" directly. Note, although PDE flags this as an error, it works fine at runtime, i.e. everything resolves correctly.

(b) After I set the project specific compiler option "Missing exported packages" to "Ignore" (compilers.p.missing-packages=2), the missing packages are still flagged as errors in the bundle manifest (even after several cleans and a restart).

This bug exists to address issue (b). I'll file a separate issue for (a).
Comment 1 Gunnar Wagenknecht CLA 2009-01-05 10:32:52 EST
(In reply to comment #0)
> I'll file a separate issue for (a).

Filed as bug 259959.

Comment 2 Richard Fearn CLA 2015-05-12 10:01:52 EDT
Looks like the PDE code is using the wrong flag.

Changing the setting for "Missing exported packages" in the preferences page changes the value of compilers.p.missing-packages in .settings/org.eclipse.pde.prefs.

This flag is referred to in the Java code as P_MISSING_EXPORT_PKGS:

  https://git.eclipse.org/c/pde/eclipse.pde.ui.git/tree/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/CompilerFlags.java#n66

However if a missing package is found, the problem is reported using the P_UNRESOLVED_IMPORTS flag:

  https://git.eclipse.org/c/pde/eclipse.pde.ui.git/tree/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java#n844

That flag is the first one in the "Unresolved" section:

  https://git.eclipse.org/c/pde/eclipse.pde.ui.git/tree/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java#n550

i.e. "Unresolved dependencies". And indeed, changing that flag does affect how missing imports are treated.
Comment 3 Richard Fearn CLA 2015-05-12 10:05:03 EDT
(In reply to Richard Fearn from comment #2)
> That flag is the first one in the "Unresolved" section:

Oops - should have said "Usage" section.
Comment 5 Eclipse Genie CLA 2016-03-22 15:06:17 EDT
New Gerrit change created: https://git.eclipse.org/r/69069
Comment 6 Patrik Suzzi CLA 2016-03-22 15:18:15 EDT
Created attachment 260493 [details]
video showing the issue solved

Bug 259958 has now a pending patch. 
Pushing the patch to PDE for Neon would help JSDT developers.
Comment 7 Patrik Suzzi CLA 2016-04-07 16:52:39 EDT
Having a review for this change would be good.
Comment 8 Dani Megert CLA 2016-04-08 06:37:20 EDT
(In reply to Patrik Suzzi from comment #7)
> Having a review for this change would be good.

Vikas, please review for M7.
Comment 10 Vikas Chandra CLA 2016-04-19 05:25:08 EDT
Thanks Patrik
Comment 11 Vikas Chandra CLA 2016-04-27 05:30:34 EDT
verified on 

Version: Neon (4.6)
Build id: N20160419-2000

but by default in a new workspace, missing packages are set to ignore. Is this the correct behavior?
Comment 12 Vikas Chandra CLA 2016-05-09 07:52:21 EDT
CompilerFlags.P_MISSING_EXPORT_PKGS is for "This plug-in does not export all of its packages"

So this causes an issue which I spotted in verification  ( Bug 492526 - By default, missing packages are set to ignore and not to error or warning).

So  we should use CompilerFlags.P_UNRESOLVED_IMPORTS  for  "Package doesnt  exist in workspace" for time being( 4.6)

Ideally I would want another option for "Package doesnt  exist in workspace"  tracked by this bug).

Based on this I will recommend a revert for 4.6
Comment 13 Vikas Chandra CLA 2016-05-09 07:53:01 EDT
reopened based on previous comment.
Comment 14 Vikas Chandra CLA 2016-05-09 07:57:48 EDT
Dani,

can you give +1 for the revert for 4.6RC1?
Comment 15 Dani Megert CLA 2016-05-09 12:18:02 EDT
(In reply to Vikas Chandra from comment #12)
> CompilerFlags.P_MISSING_EXPORT_PKGS is for "This plug-in does not export all
> of its packages"
> 
> So this causes an issue which I spotted in verification  ( Bug 492526 - By
> default, missing packages are set to ignore and not to error or warning).
> 
> So  we should use CompilerFlags.P_UNRESOLVED_IMPORTS  for  "Package doesnt 
> exist in workspace" for time being( 4.6)
> 
> Ideally I would want another option for "Package doesnt  exist in workspace"
> tracked by this bug).
> 
> Based on this I will recommend a revert for 4.6

That was reported 2016-04-27. Why is this comment coming so late?
Comment 16 Dani Megert CLA 2016-05-10 03:13:38 EDT
(In reply to Vikas Chandra from comment #14)
> Dani,
> 
> can you give +1 for the revert for 4.6RC1?

Please provide the corresponding change for review.
Comment 17 Vikas Chandra CLA 2016-05-10 08:14:33 EDT
Created attachment 261592 [details]
reverted patch
Comment 18 Vikas Chandra CLA 2016-05-10 08:19:16 EDT
>>That was reported 2016-04-27. Why is this comment coming so late?

Initially it appeared as that the default setting needs to changed from ignore to error for this compiler setting. ( opened Bug 492526 for investigation in 4.6) However after changing the setting , not all package exported errors came up. That meant that even the missing package exports was used for something else.

In summary, roll back is better than current state but as I have written before, missing package export is a misleading option and probably we need another option for "package not present in current workspace".

So a rollback is warranted.
Comment 19 Eclipse Genie CLA 2016-05-10 08:23:35 EDT
New Gerrit change created: https://git.eclipse.org/r/72405
Comment 20 Eclipse Genie CLA 2016-05-10 08:24:49 EDT
New Gerrit change created: https://git.eclipse.org/r/72407
Comment 22 Eclipse Genie CLA 2016-05-10 08:26:08 EDT
New Gerrit change created: https://git.eclipse.org/r/72408
Comment 23 Vikas Chandra CLA 2016-08-08 05:57:49 EDT
Created attachment 263506 [details]
Fix
Comment 24 Vikas Chandra CLA 2016-08-08 06:07:18 EDT
Created attachment 263507 [details]
Image describing the current and past options which control the error in manifest file

The image is self-explanatory.
Comment 25 Vikas Chandra CLA 2016-08-08 06:13:56 EDT
Created attachment 263508 [details]
Fix with updated license year
Comment 26 Vikas Chandra CLA 2016-08-08 08:07:12 EDT
Dani, can you look at https://bugs.eclipse.org/bugs/attachment.cgi?id=263507
Comment 27 Dani Megert CLA 2016-08-11 11:50:37 EDT
(In reply to Vikas Chandra from comment #26)
> Dani, can you look at https://bugs.eclipse.org/bugs/attachment.cgi?id=263507

I'm fine renaming "Missing exported packages" to "Unexported package". However, adding a sub-option to unresolved dependencies is overkill.
Comment 28 Vikas Chandra CLA 2016-08-12 02:27:56 EDT
I have renamed "Missing exported packages" to "Unexported package"

The prime reason for this bug (comment#0 - section b) ) was the confusion "Missing exported packages" caused. It can easily be interpreted as Missing ( in the plugin ) exported packages. It was meant for some package ( at least 1)  was not exported but clearly  "Missing exported packages" is misleading.

With proposal of comment#25 and subsequent suggestion as per comment#27, this confusion should not happen anymore.

Fixed with this name change
http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=17bad3bf3a7a5e873b857338108f4486913344dc
Comment 29 Vikas Chandra CLA 2016-09-13 07:02:51 EDT
Verified on
Version: Oxygen (4.7)
Build id: I20160912-2000