Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353311 - [validation] The local variable may not have been initialized
Summary: [validation] The local variable may not have been initialized
Status: NEW
Alias: None
Product: JSDT
Classification: WebTools
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Chris Jaun CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-28 08:08 EDT by Victor Homyakov CLA
Modified: 2018-11-22 17:32 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Homyakov CLA 2011-07-28 08:08:46 EDT
Overview:
JS validator produces message "The local variable inner_callback may not have been initialized" on this code snippet:

Element.addMethods({
  observeOnce: function(element, event_name, outer_callback) {
    var inner_callback = function() {
      outer_callback.apply(this, arguments);
      Element.stopObserving(element, event_name, inner_callback);
    };
    Element.observe(element, event_name, inner_callback);
  }
});

Actual Results:
Warning on line:
      Element.stopObserving(element, event_name, inner_callback);

Expected Results:
No warnings. Variable is initialized.

Build Date & Platform:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Release
Build id: 20110615-0604
Comment 1 Victor Homyakov CLA 2012-07-16 08:41:31 EDT
Still not fixed in WTP 3.4.0 (tested on Eclipse SDK Version: 3.8.0 Build id: M20120626-2030).

Shorter example:

function f1() {
  var closing = setInterval(function() {
    clearInterval(closing);
  }, 30);
}
Comment 2 Gautier de SAINT MARTIN LACAZE CLA 2015-03-12 19:19:30 EDT
It works in Eclipse Java EE IDE for Web Developers.
Version: Mars Milestone 5 (4.5.0M5)
Build id: 20150205-1617