Community
Participate
Working Groups
build I20050413 ColorUtils.process using reflection to scan over all the fields in the SWT class. This is called for each color extension. If there are many of these, this will be slow. I haven't looked at actual numbers since I'm in a broken state at the moment, but just wanted to flag this.
Maybe cache a table of appropriate COLOR_* strings to the corresponding SWT Field?
Sounds reasonable.
I've gotten Tod to profile this and I've done some System.currentTimeMillis() testing myself and it seems like all of the work is being done in the first call to clazz.getDeclaredFields() (taking a whopping 10ms). Every successive call to process() cannot be measured accurately (0ms deltas). Marking as WONTFIX.
They must be caching the list themselves, probably to make getField(String) work efficiently.
Do you really want to allow any SWT constant though? Should we check for particular prefixes?
We could check for appropriate constants but it's not a really big deal. If they use a bad constant they just get back COLOR_BLACK. It's a seperate bug at any rate...
Agree it's a separate bug. It just seems strange to allow them to specify e.g. ARROW_DOWN.