This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 255232 - Code completion: Shows proposals, where return type is not compatible - using them leads to compile errors
Summary: Code completion: Shows proposals, where return type is not compatible - using...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-11 17:18 UTC by markiewb
Modified: 2015-09-14 16:16 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Shows some examples of this issue (150.53 KB, image/png)
2015-09-11 17:18 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2015-09-11 17:18:55 UTC
Created attachment 156114 [details]
Shows some examples of this issue

See the code

//| marks the caret, where to start CC
/*a*/java.util.List<String> list=| 
/*b*/System.out.println(|);
/*c*/System.out.println("foo="+|);

Case A:
-------
ACTUAL:
for /*a*/+/*b*/ methods with return type 'void' are proposed, using them leads to compile errors
EXPECTED 
for /*a*/+/*b*/ methods with return type 'void' are NOT proposed

Case B:
-------
ACTUAL:
for /*a*/ methods with return type 'int|long|boolean|short' (primitive types) are proposed, using them leads to compile errors (it is a dead end)

EXPECTED:
those are not proposed (but take care: they are still allowed when the target type is String [/*c*/] or is an Object [/*b*/])

Case C:
-------
ACTUAL:
for /*a*/+/*b*/+/*c*/ keywords like 'boolean|int|double|true|false|...' are proposed, using them leads to compile errors
EXPECTED 
those are not proposed (but take care: sometimes true/false are allowed [if the targettype is Boolean or Object)



See also the screenshot


Product Version: NetBeans IDE 8.1 Beta (Build 201507231027)
Java: 1.8.0_60-ea; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-ea-b25
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Dusan Balek 2015-09-14 16:16:02 UTC
This is as designed behaviour. Code completion by default shows all items that are accessible in the given scope. 'Type compatible' items are shown at the top of the code completion list visually separated from the rest of the items in the list.