Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 362390

Summary: Generate collision-free keys for theming properties
Product: [RT] RAP Reporter: Ralf Sternberg <rsternberg>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: 1.5   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

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.