Community
Participate
Working Groups
DialogSettings throw an Exception, if getInt(key) is called with a key for which no value was set. Requesting a value with get(key) only returns null and does not throw an Exception. Maybe we could set a default value for getInt(key) etc.?!
You can't change the API contract, and independently of the value you will choose it will break someone using exact this value for some obscure reason :-) The API is not user friendly, true. If it would just return Integer, it would be enough. Now one option could be to provide hasValue(String), but this would NOT guarantee that the value is a valid number in the case of int/long.
I'd vote for get(String key,int def)
sorry getInt(String key, int def)
(In reply to Thomas Schindl from comment #3) > sorry getInt(String key, int def) Of course, I'm so stupid! and getLong(String key, long def) then please, and both in IDialogSettings.
New Gerrit change created: https://git.eclipse.org/r/101550
Thanks for your quick responses. I pushed a change which adds several methods that takes a default value. Should I annotate them with @since? And can I annote the other (old) methods as deprecated?
(In reply to David Weiser from comment #6) > Thanks for your quick responses. I pushed a change which adds several > methods that takes a default value. > > Should I annotate them with @since? Please install API tools and please set API baseline to 4.7. You will see what they report and they offer solutions for errors. > And can I annote the other (old) methods > as deprecated? Depreciation should be announced and also handled by a dedicated bug.
Sorry, I don't think this is worth it.