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 223115

Summary: Type of variable not fully resolved from JSDoc
Product: javascript Reporter: Vladimir Riha <vriha>
Component: EditorAssignee: Petr Pisl <ppisl>
Status: STARTED ---    
Severity: normal CC: vriha
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description Vladimir Riha 2012-12-01 23:03:38 UTC
Please try this:

/**
 * 
 * @param {Window} window
 * @returns {Utils}
 */
var Utils = function(window) {
    
    this.document = window.document;
    
}

Type of this.document in Navigator is "windowdocument" while it should be probably "Document". Similar case is:

/**
 * 
 * @param {Date} aa
 * @returns {Utils}
 */
var Utils = function(aa) {
    this.test = aa.getDay();
};

Where Navigator does not show any type at all.



Product Version: NetBeans IDE Dev (Build web-main-9401-on-20121201)
Java: 1.7.0; Java HotSpot(TM) 64-Bit Server VM 21.0-b17
Runtime: Java(TM) SE Runtime Environment 1.7.0-b147
System: Linux version 3.5.0-18-generic running on amd64; UTF-8; en_US (nb)
Comment 1 Petr Pisl 2012-12-16 12:54:05 UTC
Unfortunately these two cases has separate root of problem. I have created new issue #223891 for the second test case.
Comment 2 Petr Pisl 2012-12-16 14:06:12 UTC
The first case is little different. When I correct the code to:
/**
 * 
 * @param {window} bla
 * @returns {Utils}
 */
var Utils = function(bla) {

    this.document = bla.document;

} 

Then the type of this.document is recognized correctly. In our signature files there is the property document a part of window object, not Window. Basically in the signature files is something like:

var window = new Window();
window.document = new document();

How is it in runtime? Has Window object document property?
Comment 3 Vladimir Riha 2012-12-17 07:15:10 UTC
(In reply to comment #2)
> How is it in runtime? Has Window object document property?

You're right, Window does not have document. But following still doesn't work:

/**
 * 
 * @param {window} window
 * @returns {Utils}
 */
var Utils = function(window) {

    this.document = window.document;

}

Code completion for parameter "window" does not show any type and "this.document" is w/o type as well, code completion for

this.|

shows

document:



Product Version: NetBeans IDE Dev (Build web-main-9541-on-20121216)
Java: 1.7.0_10; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Linux version 3.2.0-34-generic-pae running on i386; UTF-8; en_US (nb)
Comment 4 Petr Pisl 2012-12-17 07:20:31 UTC
I know, this is the reason, why I keep it open. I will try to fix it. The part of the problem is that the type has the same name as the parameter. The second problem is in the model itself.