Bug 101610 - Code assist not offered without transitive dependency
Summary: Code assist not offered without transitive dependency
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4.1   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 234020 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-24 06:02 EDT by David Saff CLA
Modified: 2010-01-05 10:35 EST (History)
5 users (show)

See Also:
philippe_mulet: pmc_approved+


Attachments
Proposed fix (9.18 KB, patch)
2008-05-28 10:16 EDT, David Audel CLA
no flags Details | Diff
Modified jar for regression tests (2.18 KB, application/java-archive)
2008-05-28 10:17 EDT, David Audel CLA
no flags Details
Updated patch (9.40 KB, patch)
2008-07-08 09:18 EDT, David Audel CLA
no flags Details | Diff
Proposed fix for 3.4.1 (9.02 KB, patch)
2008-07-08 10:14 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Saff CLA 2005-06-24 06:02:28 EDT
Against I20050623-2000.

Create a new plug-in project.  Do _not_ allow Eclipse to generate a Plugin
class, and do not use a template.

Add the single dependency org.eclipse.ui.workbench to the new plug-in, and
create this class:

package foo;

import org.eclipse.ui.PlatformUI;

public class Foo {
	private void bar() {
		PlatformUI.getWorkbench().
	}
}

Invoke code assist after the dot.  Nothing at all is reported.  However,
completing the expression with "close();" does compile.

The problem appears to be that by not depending on org.eclipse.core.runtime, the
new plug-in can't see the superinterface IAdaptable of IWorkbench.  But this
doesn't appear to be a problem for the compiler.
Comment 1 David Audel CLA 2008-05-28 09:04:21 EDT
*** Bug 234020 has been marked as a duplicate of this bug. ***
Comment 2 David Audel CLA 2008-05-28 10:16:50 EDT
Created attachment 102371 [details]
Proposed fix

Some super classes of the completed receiver are not on the classpath so when completion proposals inference try to resolve super classes then a problem is detected. In proposals inference this.lookupEnvironment.unitBeingCompleted is null so an AbortCompilation is thrown when problem is detected and proposals inference is stopped.

To avoid this exception this.lookupEnvironment.unitBeingCompleted must be set to the compilation unit which contains the completion node.
Comment 3 David Audel CLA 2008-05-28 10:17:38 EDT
Created attachment 102375 [details]
Modified jar for regression tests
Comment 4 David Audel CLA 2008-05-28 10:19:42 EDT
Philippe, Frederic, Jerome, please approve/review for RC3
Comment 5 David Audel CLA 2008-05-29 09:20:31 EDT
This bug is not a regression from 3.3 and we are late in 3.4 so even if the fix looks simple it's too risky to add it 3.4.
We should fix this bug in 3.4.1.
Comment 6 David Audel CLA 2008-07-08 09:18:20 EDT
Created attachment 106818 [details]
Updated patch
Comment 7 David Audel CLA 2008-07-08 09:29:52 EDT
Released for 3.5M1.

Tests added
  CompletionTests#testCompletionUnresolvedSuperclass()
  CompletionTests#testCompletionUnresolvedSuperinteface()

Tests updated
  CompletionTests#testCompletionUnresolvedFieldType()
  CompletionTests#testCompletionUnresolvedParameterType()
  CompletionTests#testCompletionUnresolvedReturnType()
Comment 8 David Audel CLA 2008-07-08 10:14:11 EDT
Created attachment 106823 [details]
Proposed fix for 3.4.1

this.lookupEnvironment.unitBeingCompleted is set to the completed compilation unit to avoid the AbortCompilation.
Comment 9 David Audel CLA 2008-07-08 10:15:55 EDT
Philippe - This is not a regression but the fix is simple and it will improve a lot the user experience when the classpath is incomplete. We should fix it for 3.4.1.
Comment 10 Philipe Mulet CLA 2008-07-09 05:21:40 EDT
+1 for 3.4.1
Comment 11 David Audel CLA 2008-07-09 05:27:49 EDT
Released for 3.4.1.
Comment 12 Olivier Thomann CLA 2008-08-06 12:14:23 EDT
Verified for 3.5M1 using I20080805-1307
Comment 13 Olivier Thomann CLA 2008-08-06 12:39:06 EDT
Closing as FIXED to be closed as VERIFIED during 3.4.1 verification pass.
Comment 14 Olivier Thomann CLA 2008-08-06 12:45:11 EDT
Reopen to close as RESOLVED/FIXED to be closed as VERIFIED during 3.4.1
verification pass.
Comment 15 Olivier Thomann CLA 2008-08-06 12:45:30 EDT
Fixed.
Comment 16 Frederic Fusier CLA 2008-08-28 12:09:06 EDT
Verified for 3.4.1 using build M20080827-2000.