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 267256 - Generics capture incorrectly flagged as invalid
Summary: Generics capture incorrectly flagged as invalid
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-22 17:59 UTC by mclaborn
Modified: 2016-09-13 08:13 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (849.59 KB, text/plain)
2016-07-22 17:59 UTC, mclaborn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mclaborn 2016-07-22 17:59:54 UTC
Product Version = NetBeans IDE Dev (Build 201607210002)
Operating System = Linux version 4.4.0-31-generic running on amd64
Java; VM; Vendor = 1.8.0_102
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.102-b14

Reproducibility: Happens every time

In the code snippet below, the last line is flagged as an error in the Java editor in this build.  The error is 

Error: incompatible types: ArrayList<CAP#1> cannot be converted to ArrayList<IOrderItem>
  where CAP#1 is a fresh type-variable:
    CAP#1 extends IOrderItem from capture of ? extends IOrderItem

No error is reported during a clean + build.
This was not a problem in NB 8.1
Comment 1 mclaborn 2016-07-22 17:59:56 UTC
Created attachment 161386 [details]
IDE log
Comment 2 mclaborn 2016-07-24 16:29:31 UTC
Oops - here is the code snippet.

  public DialogSelectShipWeek(OE2 a_owner, Customer a_customer, Collection<? extends IOrderItem> a_items) {
    super(a_owner, true);
    ArrayList<IOrderItem> items = new ArrayList<>(a_items);
Comment 3 Dusan Balek 2016-09-12 14:29:53 UTC
Unfortunately, I cannot reproduce the problem in the current dev build. If you are still able to reproduce the problem, could you please create a simple test project and attach it to the issue? Thanks.
Comment 4 FrantaM 2016-09-13 08:13:49 UTC
https://github.com/FrantaM/bug267256

The line is flagged as error only if project's Source/Binary format is set to 1.7.