Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362390 - Generate collision-free keys for theming properties
Summary: Generate collision-free keys for theming properties
Status: NEW
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.5   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-29 05:04 EDT by Ralf Sternberg CLA
Modified: 2011-10-29 05:04 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 Ralf Sternberg CLA 2011-10-29 05:04:00 EDT
The theme store uses keys to identify properties in the protocol. These keys are currently derived from hash codes - see ThemePropertyAdapter#getKey().
This leads to problems when hash code collisions occur, such as in bug 362272, bug 361122, bug 326888.

Using hash codes is an inherently unsafe method of generating unique keys, as this allows for collisions by design.
I'd like to propose a safe approach:
 * have a dedicated class for generating theming keys for all property types
 * this class collects all theming property objects in a map (we don't need to release the references anyway)
 * the map would map property objects to keys
 * for every property object that a key is requested for, we look it up in the map, and return the key
 * property objects that are not yet contained in the map, get a sequential key and are added

This approach would allow us to shorten the ids and get rid of the slots in the theme store.