intellij s == null returns false on un initialized variable s
the variable s is declared but not initialized
during debug the s == null returns false
if i run the same app it returns true
so, intellij returns a different result for an uninitialized null check on a variable depending on
whether you run it or debug it
anyone else see this?
请先登录再写评论。
Please provide sample code to reproduce.
when I run main with debug i get initialized in console even though i know it is not initialized
walk through the code and you will wonder why it thinks simple is not null inside check()
when i run the same without debug i get the result i expect to get of not initialized
the outcome is that i get 2 different answers
the run sais it is not initialized
the debug sais that it is
the correct result is the run version
other ide's give the correct answer from the run so i thought it was helpful to submit
i am using build 141.177 March 23, 2015
It's expected behavior of running under debugger when you have enabled toString object view, disable it here:

What happens is that debugger calls toString that initializes your object.
Perfect!
That's it - Fixed!