Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 135115 - [inline] boolean assigned to "x instanceof y" goes awry
Summary: [inline] boolean assigned to "x instanceof y" goes awry
Status: RESOLVED DUPLICATE of bug 44419
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-05 15:22 EDT by Larry Edelstein CLA
Modified: 2006-04-07 13:46 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Larry Edelstein CLA 2006-04-05 15:22:01 EDT
Start with this:

package example.inlineerror;

public class Foo {

	public void foo(Object o) {
		boolean b = o instanceof String;
		if (!b) {
			System.out.println("it wasN'T");
		}
	}
}

Select the "b" variable and use Refactor...Inline...  Your result will be:

package com.revere.rp.model.impl;

public class Foo {

	public void foo(Object o) {
		if (!o instanceof String) {
			System.out.println("it wasN'T");
		}
	}
}

...which will give you a syntax error - it should be !(o instanceof String).
Comment 1 Olivier Thomann CLA 2006-04-05 15:22:48 EDT
Move to JDT/UI
Comment 2 Markus Keller CLA 2006-04-07 13:46:28 EDT
Good timing! Dirk has already fixed this today :-).

*** This bug has been marked as a duplicate of 44419 ***