Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353311

Summary: [validation] The local variable may not have been initialized
Product: [WebTools] JSDT Reporter: Victor Homyakov <vkhomyackov>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: NEW --- QA Contact: Chris Jaun <cmjaun>
Severity: normal    
Priority: P3 CC: thomas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

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