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 262359 - Netbeans hides compiler errors, lists them out of order
Summary: Netbeans hides compiler errors, lists them out of order
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Windows 10 x64
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-08 05:16 UTC by _ gtzabari
Modified: 2016-06-23 15:25 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2016-06-08 05:16:47 UTC
Product Version: NetBeans IDE Dev (Build 201606020002)
Java: 1.8.0_92; Java HotSpot(TM) 64-Bit Server VM 25.92-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_92-b14
System: Windows 10 version 10.0 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev

1. Create a new Maven project containing the following code:

--------
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
import java.util.function.Supplier;
import java.util.stream.Collector;

public class Main {

    public static class Parent<T, A, R> {

        private final Supplier<A> supplier = null;
    }

    public static class Child<T, A extends List<T>, R extends List<T>>
            extends Parent<T, A, R> {

        public void run() {
            BiConsumer<A, T> accumulator = (list, element) -> {
                list.add(element);
            };
            BinaryOperator<A> combiner = (left, right) -> {
                left.addAll(right);
                return left;
            };

            Collector.of(supplier, accumulator, combiner);
        }
    }
}
--------

2. Netbeans highlights the last line with a compiler error.
3. When the mouse hovers over the compiler error, the following tooltip is displayed:

--------
no suitable method found for of(Supplier<A#1>,BiConsumer<A#2,T#1>,BinaryOperator<A#2>)
<followed by 20 confusing lines>
--------

4. But in fact, javac reports the following errors:

--------
Main.java:[28,26] supplier has private access in com.mycompany.misleadinggenericerror.Main.Parent

Main.java:[28,22] no suitable method found for of(java.util.function.Supplier<A>,java.util.function.BiConsumer<A,T>,java.util.function.BinaryOperator<A>)
<followed by 20 confusing lines>
--------

5. The second error message is extremely cryptic and leads to hours of confusion. The first error message is perfectly clear.

The fact that Netbeans lists the second error message and completely omits the first is extremely bad. Prioritizing accordingly.
Comment 1 Dusan Balek 2016-06-08 14:12:30 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/f035804f74f1
Comment 2 _ gtzabari 2016-06-13 16:22:12 UTC
Dusan,

This bug was marked as fixed last week but it doesn't seem to have made it into 201606130002 (today's build). Is something blocking the merge?
Comment 3 _ gtzabari 2016-06-21 05:33:21 UTC
In build 201606200002, I get the right error message if I hover over "supplier" but if I hover over the method invocation "Collector.of()" or any of the subsequent arguments I still get the wrong error message.

I am expecting users to get the same (first) message regardless of which element they are hovering over.
Comment 4 Dusan Balek 2016-06-23 15:01:52 UTC
Unfortunately, this is as designed behaviour. Error messages are displayed when mouse hovers over their spans. The error message 'supplier has private access in com.mycompany.misleadinggenericerror.Main.Parent' is related to the usage of the 'supplier' identifier and its span is defined from the beginning to the end of the identifier. On the other hand, the message 'no suitable method found ...' is related to the corresponding method invocation and spans over it.
Comment 5 _ gtzabari 2016-06-23 15:25:18 UTC
Good point. I filed #262550 to cover this point. Feel free to provide more details (and/or ideas) if you have any.