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.
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: "responseForLanguages.stream().map(lang -> 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.
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.
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...
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.
I am facing this for things like: collection.stream() .filter(...) <-- There is a lambda expression here .flatMap(...) <-- There is a lambda expression here .filter(...) .collect(toList()) Any chance to someone take a look at this, at least for lambda expressions, where Martin said would might be a solution?
Martin, I am still waiting for you to answer comment 3. This issue is a major productivity blocker when debugging.
This is very annoying when debugging Lamda expression.
This is a major stopper for debugger as we have more lambdas expressions
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.
Martin, 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.
Thanks. The evaluation of no-yet-loaded class types are there, lambdas will take me a while... :-)
The ability to evaluate lambdas and new classes through compilation is added: changeset: 300425:f38f3e3ca101 http://hg.netbeans.org/core-main/rev/f38f3e3ca101
Amazing job Martin. Thank you so much for all your hard work!
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 http://hg.netbeans.org/core-main/rev/85c7c34f7111
The only thing I noticed is that you left some commented-out code. I don't know if that was intentional or not. See: http://hg.netbeans.org/core-main/rev/f38f3e3ca101#l8.107 http://hg.netbeans.org/core-main/rev/f38f3e3ca101#l8.125 http://hg.netbeans.org/core-main/rev/f38f3e3ca101#l8.169 http://hg.netbeans.org/core-main/rev/f38f3e3ca101#l9.56 http://hg.netbeans.org/core-main/rev/f38f3e3ca101#l9.128
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.
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/f38f3e3ca101 User: mentlicher@netbeans.org Log: #253248: Be able to evaluate lambdas and new classes.