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 262230 - Lamdas shouldn't throw exceptions when generated
Summary: Lamdas shouldn't throw exceptions when generated
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on: 262212
Blocks:
  Show dependency tree
 
Reported: 2016-05-26 08:52 UTC by Jaroslav Tulach
Modified: 2016-09-19 06:46 UTC (History)
0 users

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 Jaroslav Tulach 2016-05-26 08:52:37 UTC
This is a follow up of issue 262212. Now when I use the great code completion support and generate a lamda, I get:

        $("x").addClass((p1, p2) -> {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        });

however this is wrong. While it may make sense to generate "throw new UOE" in case of implementing multiple methods in regular interfaces, it makes no sense in case of lamdas:

Lamda has only one method and it is clear that once I decide to use lamda, I want to implement it, so rather than the current "throw new UOE" I would find more appropriate to get real code, for example:

        $("x").addClass((p1, p2) -> {
            return null;
        });

in the case of the above JQuery API.
Comment 1 Dusan Balek 2016-09-01 09:12:19 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/575c477b31d1
Comment 2 Quality Engineering 2016-09-02 01:58:45 UTC
Integrated into 'main-silver', will be available in build *201609020002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/575c477b31d1
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #262230 - Lamdas shouldn't throw exceptions when generated - fixed.
Comment 3 Jaroslav Tulach 2016-09-19 06:46:50 UTC
Thanks. The feature seems to work in regular Java files.