History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-11033
Type: Bug Bug
Status: Open Open
Priority: Critical Critical
Assignee: Maxim Shafirov
Reporter: Bas Leijdekkers
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

false positive in "Constant conditions & Exceptions"

Created: 14 Jul 05 16:46   Updated: 06 Nov 08 23:29
Component/s: Code Analysis. Inspection
Fix Version/s: Undefined

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Windows XP

Build: 3,405
Severity: Medium


 Description  « Hide
In the following code "Constant conditions & Exceptions" marks the condition as always true:
public class NonconstantCondition {
	static boolean flag = false;

	public static void test() {
		if (flag == (flag = true)) {
			System.out.println("condition is false");
		} else {
			System.out.println("condition is true");
		}
	}

	public static void main(String[] args) {
		test();
		test();
	}
}

Running it produces the following output show that the condition is indeed false once:

condition is true
condition is false



 All   Comments   Work Log   Change History      Sort Order:
Stephen Friedrich - 05 Sep 06 19:33
Looks like a duplicate of IDEABKL-2810

Vladislav Kaznacheev - 19 Oct 06 19:16
reproduces in 6052