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 269553 - No compiler error when passing a Set where SortedSet would be required
Summary: No compiler error when passing a Set where SortedSet would be required
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.2
Hardware: PC Windows 10 x64
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-13 11:16 UTC by sebastianriemer
Modified: 2017-01-13 13:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
No compilaton error is shown for the given code while there should be one (120.41 KB, image/png)
2017-01-13 11:16 UTC, sebastianriemer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sebastianriemer 2017-01-13 11:16:01 UTC
Created attachment 163394 [details]
No compilaton error is shown for the given code while there should be one

Product Version: NetBeans IDE 8.2 (Build 201609300101)
Java: 1.8.0_112; Java HotSpot(TM) 64-Bit Server VM 25.112-b15
Runtime: Java(TM) SE Runtime Environment 1.8.0_112-b15
System: Windows 10 version 10.0 running on amd64; Cp1252; de_DE (nb)


Given the following program code:

    package sometest;
    import java.util.Collections;
    import java.util.SortedSet;

    public class SomeTest {
	public static void main(String[] args) {
	}

	public class TestClassA {
		public void setSomeSortedSet(SortedSet<Long> sortedSet) {
		}
	}

	public void doIt() {
		TestClassA instanceOfA = new TestClassA();
		long id = 1l;
		instanceOfA.setSomeSortedSet(Collections.singleton(id));
	}
    }

I would expect to receive a compiler error on line 17, but I don't. The whole file is marked with a red exclamation mark stating "Error parsing file". When compiled via Right-click on the project > "Build", I receive the compiler error.

Additional note:
I have had the same logic in a maven-based project, using the same JDK version and strangely when doing a manual build, I got "Build success", which clearly should not be possible? I am going to try to create a minimal code example for that case too.
Comment 1 sebastianriemer 2017-01-13 11:17:51 UTC
Pardon me, in the screenshot the compiler error would be expected on Line 20, the line containing "instanceOfA.setSomeSortedSet(Collections.singleton(id));"
Comment 2 Tomas Hurka 2017-01-13 11:24:38 UTC
Thanks for the report, but I don't quite understand, why you selected 'Component' 'Exceptions Reporter' for this bug report. Can you explain it?
Comment 3 sebastianriemer 2017-01-13 13:03:46 UTC
Oh I am sorry, to be honest I was quite lost when having to choose a right category for this issue. Please feel free to reassign whatever component seems right to you, as I have no clue.
Comment 4 Tomas Hurka 2017-01-13 13:26:33 UTC
(In reply to sebastianriemer from comment #3)
> Oh I am sorry, to be honest I was quite lost when having to choose a right
> category for this issue. Please feel free to reassign whatever component
> seems right to you, as I have no clue.
If you don't know the right component, please use 'Ide' as product and 'Code' as component as described here: <http://wiki.netbeans.org/IssuezillaFields>. Thanks.