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 253248 - Evaluation of lambdas and new classes fails: "Unsupported: can not create a new class"
Summary: Evaluation of lambdas and new classes fails: "Unsupported: can not create a n...
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal with 6 votes (vote)
Assignee: Martin Entlicher
Depends on: 267601
  Show dependency tree
Reported: 2015-06-29 18:46 UTC by _ gtzabari
Modified: 2016-09-02 01:58 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2015-06-29 18:46:42 UTC
For years now I've run into a limitation with the Netbeans debugger: if I reference a Class in the "Variables" tab without the same class being referenced in the source-code being debugged, Netbeans will complain that the class is unknown or (more recently) it complains "Unsupported: can not create a new class."

Can someone please explain this limitation? It is extremely annoying to run into. I keep on having to modify the source-code being debugged in order to artificially inject references to the classes I am trying to debug.

Here is a concrete example...

1. I place a breakpoint after this line of code:

  List<Lang> responseForLanguages = new ArrayList<>(section.getLangs());

2. I enter the following in the Variables tab: " -> lang.getId())"

3. Netbeans responds "Unsupported: can not create a new class".

It's not clear what class cannot be created, nor why it cannot be created.

Expected behavior: users should be able to instantiate whatever classes they need from debugger tabs.
Comment 1 Jiri Kovalsky 2015-06-30 12:20:17 UTC
If this is recognized as RFE I am afraid it won't get implemented due to possible problems like the one described in bug #168949.
Comment 2 Martin Entlicher 2015-06-30 13:01:36 UTC
There are two problems:
1) Inability to evaluate classes that were not loaded in the VM yet and this is described in bug #168949.

2) Inability to create brand new classes during evaluation
   E.g. evaluate "new Runnable() { public void run() { ...}}".

The second case would be necessary when evaluating a lambda expression.

For lambdas, there might be a solution...
Comment 3 _ gtzabari 2015-06-30 16:12:12 UTC
1. Bug #168949 is almost 6 years old. It's time to re-test whether this problem still exists (you'd be surprised how often bugs get fixed without a formal notice).

2. Are you saying that Eclipse and IntelliJ both have the same problem? I'd be extremely surprised if this is the case. If not, they are both open-source... we should dig into how their implementations work. Maybe they found a workaround.

3. We should revisit the OpenJDK bug report. The operating system is listed as Linux only. Is this really OS-specific? The priority is listed as LOW. In my opinion, this should be a MAJOR/CRITICAL priority given the impact it has on debugging-ability.

4. The error message given by Netbeans should be updated to link to this bug report so users can get more information on this limitation.
Comment 4 Michel Graciano 2015-10-13 14:06:42 UTC
I am facing this for things like:
    .filter(...) <-- There is a lambda expression here
    .flatMap(...) <-- There is a lambda expression here

Any chance to someone take a look at this, at least for lambda expressions, where Martin said would might be a solution?
Comment 5 _ gtzabari 2016-01-02 09:35:39 UTC

I am still waiting for you to answer comment 3. This issue is a major productivity blocker when debugging.
Comment 6 ivenxu 2016-02-01 07:50:08 UTC
This is very annoying when debugging Lamda expression.
Comment 7 cocorossello 2016-05-09 09:50:30 UTC
This is a major stopper for debugger as we have more lambdas expressions
Comment 8 Martin Entlicher 2016-08-03 15:35:33 UTC
I've re-tested issues around Bug #168949. The JDK bug is still there, but it seems that it no longer manifests in NetBeans IDE due to various changes in the codebase. Thus I've implemented issue #51387 again, according to my tests it seems to work fine already. Hopefully it will not cause another hard-to-find issue.

I'll check what can we do about lambdas, scheduling for 8.2.
Comment 9 _ gtzabari 2016-08-03 19:02:13 UTC

I'm super happy to hear that! Thank you for picking this up. I will make sure to test this feature when I upgrade my dev build later on this week.
Comment 10 Martin Entlicher 2016-08-04 13:34:58 UTC
Thanks. The evaluation of no-yet-loaded class types are there, lambdas will take me a while... :-)
Comment 11 Martin Entlicher 2016-08-31 13:02:20 UTC
The ability to evaluate lambdas and new classes through compilation is added:
changeset:   300425:f38f3e3ca101
Comment 12 _ gtzabari 2016-08-31 14:34:43 UTC
Amazing job Martin. Thank you so much for all your hard work!
Comment 13 Martin Entlicher 2016-08-31 22:21:14 UTC
Thank you Gili. I hope it will work fine. Please submit any issue you'll encounter during evaluation.

I've just applied one correction now:
changeset:   300455:85c7c34f7111
Comment 15 Martin Entlicher 2016-09-01 07:46:40 UTC
Thanks. I've removed most of the comments as they're not relevant any more.
I've left the original measuring of the time only so that it can be easily turned on when needed.
changeset:   300475:eae9874831be
Best regards.
Comment 16 Quality Engineering 2016-09-02 01:58:49 UTC
Integrated into 'main-silver', will be available in build *201609020002* on (upload may still be in progress)

Log: #253248: Be able to evaluate lambdas and new classes.