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

Bug 321891

Summary: Missing import-package quick fix
Product: [Eclipse Project] PDE Reporter: Tim deBoer <deboer>
Component: UIAssignee: Ankur Sharma <ankur_sharma>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, darin.eclipse
Version: 3.6   
Target Milestone: 3.7 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Project showing missing quick fix
none
Patch none

Description Tim deBoer CLA 2010-08-05 11:10:32 EDT
Created attachment 175951 [details]
Project showing missing quick fix

PDE has lots of validation errors and quick fixes. When a problem is due to missing dependencies in the manifest and PDE knows which bundle the missing package is from, there are usually two (or more) quick fixes:
 - add an import-package (listed first, as per the best practise)
 - add a require-bundle

Unfortunately, we've found one case where the first quick-fix is missing. This has caused some of our testers to chose the require-bundle option, which caused problems later on (import-package was a better option, and works more often in our runtime).

I've attached a project that shows this issue. It is a bit contrived, but I was trying to simplify a more complex testcase. I think I've determined that this issue only appears when the missing dependency is a package from a bundle you are already importing a different package from (i.e. the bundle is already in the PDE classpath container).

To see the issue, open BrokenClass.java and look at the compile errors on lines 3 and 8. The quick fix for line 3 has both options, but the quick fix for line 8 only shows require-bundle.
Comment 1 Ankur Sharma CLA 2010-08-10 05:56:43 EDT
Created attachment 176218 [details]
Patch

Tested with 

package test;

import org.eclipse.core.resources.IWorkspace;

public class BrokenClass {
	protected void brokenMethod() {
		IWorkspace w = null;
	}	
	
	public IWorkspace tryMethod(IWorkspace wrkspc) {
		//does nothing
		return null;
	}
}
Comment 2 Ankur Sharma CLA 2010-08-10 07:13:51 EDT
Fixed in HEAD
Comment 3 Tim deBoer CLA 2010-09-02 11:52:06 EDT
Hi,
Can you confirm that this only went into 3.7? I had built a temporary workaround on top of 3.6 to 'fix' this, so I just want to know if I can remove that in 3.6.1 or need to track it for 3.7.
Comment 4 Curtis Windatt CLA 2010-09-02 12:01:05 EDT
This was fixed in code from HEAD during M2.  It is available in recent 3.7 I Builds and will be available in the 3.7 M2 release.  The code was never backported to 3.6.x.