tyutNo4 / findbugs

Automatically exported from code.google.com/p/findbugs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[prefs] Improve diff/versioning of preferences file (patch)

GoogleCodeExporter opened this issue · comments

Hi,
I've already sent an email with this patch to Bill Pugh, but probably my 
mail was filtered as spam (I haven't received any answer), so I've decided 
to post this patch here.

Patch to UserPreferences class:

we hold all project preferences in VCS, so that we could esily track any 
changes. Unfortunately the current FindBugs .fbprefs file is baked by 
Property class. This means that each time you add/remove a key, the key 
order may be randomly changed for *all* other keys too. Another problem is 
the *format* of the key elements for detector enablement. Current format 
is "detector<Number>", where <Number> is just a position of detector in 
the iterator, created by iterator over property file, which returns 
*random* numbers for the same detector each time you store the values.

Old example:

#FindBugs User Preferences
#Mon Dec 04 23:52:02 CET 2006
detector0=SluggishGui|true
detector100=AbnormalFinallyBlockReturn|true
detector101=IncompatMask|true

AS IS: removing "SluggishGui" detector would change the key names for 
AbnormalFinallyBlockReturn and IncompatMask, so that all three lines in 
the porperty file would be marked as changed by diff tool.

TO BE: it would be nice to have a preferences where changes of *one* 
detector setting would lead only to *one* line change compared to previous 
state.

My patch changes the key creation shema and allows the Property file be 
always stored in a sorted state to the disk. Both changes together 
guaranteed you the requirement above.
My patch is compatible to already existing .fbprefs files.

Regards,
Andrei Loskutov

Original issue reported on code.google.com by andya...@nurfuerspam.de on 8 Dec 2006 at 10:21

Attachments:

thank you. This patch has been applied

Original comment by bill.p...@gmail.com on 16 Dec 2006 at 3:45

  • Changed state: Fixed