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 270498 - com.sun.tools.javac.comp.Infer$InferenceException at com.sun.tools.javac.comp.Infer.<init>
Summary: com.sun.tools.javac.comp.Infer$InferenceException at com.sun.tools.javac.comp...
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-26 21:34 UTC by theshadow27
Modified: 2018-02-07 21:17 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 227009


Attachments
stacktrace (5.46 KB, text/plain)
2017-04-26 21:34 UTC, theshadow27
Details
stacktrace (5.46 KB, text/plain)
2017-04-26 21:52 UTC, theshadow27
Details
Testcase demonstrating issue (Issue270498.java) (1.84 KB, text/plain)
2017-04-26 21:57 UTC, theshadow27
Details
stacktrace (5.46 KB, text/plain)
2017-04-26 21:58 UTC, theshadow27
Details
stacktrace (5.46 KB, text/plain)
2017-07-07 09:13 UTC, Exceptions Reporter
Details
stacktrace (4.75 KB, text/plain)
2017-07-08 02:22 UTC, Exceptions Reporter
Details
stacktrace (4.22 KB, text/plain)
2017-11-29 16:20 UTC, everflux
Details

Note You need to log in before you can comment on or make changes to this bug.
Description theshadow27 2017-04-26 21:34:29 UTC
Build: NetBeans IDE 8.2 (Build 201609300101)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.121-b13, Java(TM) SE Runtime Environment, 1.8.0_121-b13
OS: Windows 7

User Comments:
GUEST: N/A

theshadow27: Editing a Stream.flatMap functional expression




Stacktrace: 
com.sun.tools.javac.comp.Infer$InferenceException
   at com.sun.tools.javac.comp.Infer.<init>(Infer.java:112)
   at com.sun.tools.javac.comp.Infer.instance(Infer.java:99)
   at com.sun.tools.javac.comp.Check.<init>(Check.java:121)
   at com.sun.tools.javac.comp.Check.instance(Check.java:105)
   at com.sun.tools.javac.comp.DeferredAttr.<init>(DeferredAttr.java:105)
   at com.sun.tools.javac.comp.DeferredAttr.instance(DeferredAttr.java:97)
Comment 1 theshadow27 2017-04-26 21:34:31 UTC
Created attachment 164192 [details]
stacktrace
Comment 2 theshadow27 2017-04-26 21:40:45 UTC
exact code being edited was: 

private void buildKeyTable(Collection<Processor<K,V>> processors){
        final long when = time();
        processors.stream().flatMap((p) -> {
            InitialSnapshot snap = new InitialSnapshot(when, p);
            p.accept(snap);
            return snap.getKeys()###CURSOR HERE###;
        }).forEach((snap) -> {
            snap.getKeys().forEach((k)->key(k).needsUpdate(when));
        });
    }

I had changed processors.stream().map(... to processors.stream().flatMap(...
in anticipation of writing "return snap.getKeys().stream()" instead of "return snap;" that the generator had produced 

This was automatically refactored from a for(final Processor<K,V> p : processors) {...} using the gutter hint:

------------ From --------------
    private void buildKeyTable(Collection<Processor<K,V>> processors){
        final long when = time();
        for(final Processor<K,V> p : processors){
            InitialSnapshot snap = new InitialSnapshot(when, p);
            p.accept(snap);
            snap.getKeys().forEach((k)->key(k).needsUpdate(when));
        }
    }

------------- To -------------- 

    private void buildKeyTable(Collection<Processor<K,V>> processors){
        final long when = time();
        processors.stream().map((p) -> {
            InitialSnapshot snap = new InitialSnapshot(when, p);
            p.accept(snap);
            return snap;
        }).forEachOrdered((snap) -> {
            snap.getKeys().forEach((k)->key(k).needsUpdate(when));
        });
    }

------------- Mod 1 -------------
   private void buildKeyTable(Collection<Processor<K,V>> processors){
        final long when = time();
        processors.stream().flatMap((p) -> {
            InitialSnapshot snap = new InitialSnapshot(when, p);
            p.accept(snap);
            return snap;
        }).forEach((snap) -> {
            snap.getKeys().forEach((k)->key(k).needsUpdate(when));
        });
    }
// produces all sorts of syntax errors

---------------- To cause exception --------------

(See first version of method including cursor)
Comment 3 theshadow27 2017-04-26 21:52:13 UTC
Created attachment 164193 [details]
stacktrace

Working on test case, this is repeatable
Comment 4 theshadow27 2017-04-26 21:57:06 UTC
Created attachment 164194 [details]
Testcase demonstrating issue (Issue270498.java)

Please find a test case demonstrating to reproduce the Exception attached. It seems to be repeatable. 

Product Version: NetBeans IDE 8.2 (Build 201609300101)
Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 1
Java: 1.8.0_121; Java HotSpot(TM) 64-Bit Server VM 25.121-b13
Runtime: Java(TM) SE Runtime Environment 1.8.0_121-b13
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\Admin\AppData\Roaming\NetBeans\8.2
Cache directory: C:\Users\Admin\AppData\Local\NetBeans\Cache\8.2
Comment 5 theshadow27 2017-04-26 21:58:13 UTC
Created attachment 164195 [details]
stacktrace

Repeatable
Comment 6 Exceptions Reporter 2017-07-07 09:13:35 UTC
Created attachment 164716 [details]
stacktrace

I don't know why and I think sending for you is better
Comment 7 Exceptions Reporter 2017-07-08 02:22:36 UTC
Created attachment 164723 [details]
stacktrace

It's better when sending this error!
Comment 8 everflux 2017-11-29 16:20:44 UTC
Created attachment 165513 [details]
stacktrace

edited some code
Comment 9 Exceptions Reporter 2018-02-07 20:50:24 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=227009
Comment 10 Exceptions Reporter 2018-02-07 20:59:24 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=227009
Comment 11 Exceptions Reporter 2018-02-07 21:08:24 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=227009
Comment 12 Exceptions Reporter 2018-02-07 21:17:24 UTC
This bug already has 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=227009