Community
Participate
Working Groups
Build Identifier: 20110916-0149, JSDT: 1.3.1.v20110810 The type of a member variable is lost if it is assigned via the ?: operator: /** @type Number */ this.value = (condition) ? 1 : 0; Obviously, sometimes the result of ?: is ambigous, so the type must be "any", but in such a case, it isn't. And especially, the @type markup should have precedence - if the programmer tells JSDT, what type the variable has, it should be treated like this. Reproducible: Always Steps to Reproduce: 1.Copy attached file into an Eclipse workspace 2.Hover mouse over both "toFixed(2)" statements 3.Enter "this._default2." and press Ctrl-Space -> nothing happens (unlike with _default1)
Created attachment 204287 [details] Test class
This bug also allows the compiler to accept a null assignment to a primitive type. (findbugs marks the line with the warning "Possible indirection of a null pointer"). Although a NullPointerException is thrown at execution. Example code : public class TestClass { public static void main(String[] args) { Object tmp = null; double a = tmp == null ? null : 0.; } }