Bug 330845 - [Model] Possible bug in Member class
Summary: [Model] Possible bug in Member class
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-22 14:05 EST by Jeff McAffer CLA
Modified: 2010-12-07 02:25 EST (History)
2 users (show)

See Also:
jarthana: review+


Attachments
Proposed fix + regression test (3.14 KB, patch)
2010-11-22 15:12 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff McAffer CLA 2010-11-22 14:05:01 EST
In researching my own misuse of Boolean.getBoolean() I found the following use in JDT core's Member#getHandleFromMemento

			if (!memento.hasMoreTokens()) return this;
			boolean isParameter = Boolean.getBoolean(memento.nextToken());

getBoolean looks up system properties and converts the value to a boolean.  I did not do any code review but from a distance it seems unlikely that that is what you want here.  Rather, consider

			boolean isParameter = Boolean.valueOf(memento.nextToken().booleanValue);
Comment 1 Olivier Thomann CLA 2010-11-22 15:08:39 EST
Thanks, Jeff.
This is indeed a bug.
I guess you meant:
boolean isParameter = Boolean.valueOf(memento.nextToken()).booleanValue();

I'll provide a patch shortly.
Comment 2 Olivier Thomann CLA 2010-11-22 15:12:36 EST
Created attachment 183598 [details]
Proposed fix + regression test

Changing the MementoTests to check that the memento of the restored java element is equals to the expected memento.
I think this also exposed a bug in org.eclipse.jdt.internal.core.JavaProject.getPackageFragmentRoot(IPath).
See attached patch.
Comment 3 Olivier Thomann CLA 2010-11-22 15:13:35 EST
Jay, please review the patch.
I have not yet run all tests with this patch. But MementoTests are now green.
Comment 4 Olivier Thomann CLA 2010-11-22 15:31:56 EST
All model tests passed.
Comment 5 Jay Arthanareeswaran CLA 2010-11-23 05:37:14 EST
Patch looks good.
Comment 6 Olivier Thomann CLA 2010-11-23 20:34:01 EST
Released for 3.7M4.
Comment 7 Jay Arthanareeswaran CLA 2010-12-07 02:25:31 EST
Verified for 3.7M4 by code inspection and regression tests.