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 240395 - [nashorn] wrong evaluated variable in tooltip/watch
Summary: [nashorn] wrong evaluated variable in tooltip/watch
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 250269 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-01-13 08:45 UTC by Vladimir Riha
Modified: 2015-04-27 05:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
another case (1.89 KB, application/javascript)
2014-01-13 09:08 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2014-01-13 08:45:11 UTC
Please try to 

- debug following JS code in Java project:

   function Humanoid(name) {
       this.name = name;
       this.numberOfLegs = 2;
       this.version = 0;
       this.die = function() {
           print(this.name + " died"); // line breakpoint here
       };

   }

   var homoHabilis = new Humanoid("theFirstOne");
   homoHabilis.die();


- add line breakpoint to the line with print() call
- debug file
- once debugger stops, do Evaluate expression for this.name

=> it is evaluated as type: Undefined, value: #1390 while it should be string with value of "theFirstOne". Tooltip and watch shows the same wrong value, but variable in Variables shows correct one.



Product Version: NetBeans IDE Dev (Build 201401130002)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b65
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b122
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 Vladimir Riha 2014-01-13 09:08:29 UTC
Created attachment 143883 [details]
another case

Please try to add breakpoint to line 96 and debug the attached file in JavaSE project. Once debugger stops, check following:

=> Move cursor over foo on line 93, tooltip shows value null, should be 1
=> select 1+a on line 92, tooltip shows 1+a=null

The same goes for New watch action. Again Variables window shows correct values for these variables.
Comment 2 Martin Entlicher 2014-07-30 17:01:59 UTC
This might be some issue with the Nashorn evaluator.
In Variables I can see correct values, but evaluator returns undefined. :-(
Comment 3 Martin Entlicher 2015-04-20 11:58:20 UTC
*** Bug 250269 has been marked as a duplicate of this bug. ***
Comment 4 Martin Entlicher 2015-04-23 06:02:55 UTC
The evaluation of 'this.<something>' is fixed by changeset:   287176:855d82a1ab66
http://hg.netbeans.org/core-main/rev/855d82a1ab66
The problem with '1+a=null' is a very different problem, which is most likely in Nashorn itself and unfixable in NetBeans. I'll close this issue after I'll file a defect for Nashorn.
Comment 5 Martin Entlicher 2015-04-23 15:32:28 UTC
Issue https://bugs.openjdk.java.net/browse/JDK-8078525 is submitted for the problem with null evaluation result.
In fact, message:
ReferenceError: "a" is not defined
is thrown as a result of the evaluation.
This second part of the issue should be fixed in nashorn IMHO.
Comment 6 Quality Engineering 2015-04-27 05:09:21 UTC
Integrated into 'main-silver', will be available in build *201504270341* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/855d82a1ab66
User: mentlicher@netbeans.org
Log: #240395: Perform evaluation on the Context object and use directEval, which is necessary for correct interpretation of 'this'.