Bug 455328 - Methods with return type not on classpath are filtered out in content assist resp. marked as missing
Summary: Methods with return type not on classpath are filtered out in content assist ...
Status: ASSIGNED
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.6.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-16 08:14 EST by Joerg Reichert CLA
Modified: 2016-06-10 05:56 EDT (History)
1 user (show)

See Also:


Attachments
example project (3.61 KB, application/zip)
2014-12-16 08:14 EST, Joerg Reichert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joerg Reichert CLA 2014-12-16 08:14:02 EST
Created attachment 249463 [details]
example project

Given: plug-in project

import org.eclipse.ui.console.TextConsole

class Test {
	
   def static void main(String[] args) {
      val TextConsole textConsole = null
      textConsole.
   }
}

TextConsole has got a method getDocument, but it isn't offered in content assist and if write it down manually, it is marked as error, as it reportedly doesn't exist.

I eventually guessed it could have something to do with the return type IDocument whose containing plug-in org.eclipse.jface.text wasn't yet listed as dependency in the MANIFEST file. 

When adding this dependency and save the MANIFEST file, the error marker goes away in the package explorer but remains in the still open Xtend editor. Also the CA still doesn't contain the now available type. 

Only closing and reopening the editor makes the getDocument method reference valid.

If I write down the code accordingly in a Java class, an error marker is shown stating

"The method getDocument() from the type TextConsole refers to the missing type IDocument". And I also get offered a quickfix for adding the missing dependency to org.eclipse.jface.text.

So here Xtend's editor behavior differs noteably from a Eclipse JDT editor.
Comment 1 Sebastian Zarnekow CLA 2015-02-23 02:51:28 EST
Should be fixed with 2.7.x

I'll test-drive the fix with the attached project.
Comment 2 Sebastian Zarnekow CLA 2015-02-23 04:08:52 EST
Observed behavior:

Java proposes #getDocument in CA, but when selected, it flags the method with an error that IDocument is not on the classpath.

Xtend doesn't propose #getDocument in CA list in the first place.

To address that issue, we'd have to enable binding recovery in the JdtBasedTypeFactory. That's unfortunately out of scope for 2.8 since the code currently expects complete bindings and binding recovery will yield incomplete bindings. To risky, but tentatively scheduled for 2.9 to improve user experience.