Bug 38982 - Confusing API: getEnabled vs isEnabled, getVisible vs. isVisible
Summary: Confusing API: getEnabled vs isEnabled, getVisible vs. isVisible
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-16 16:39 EDT by Nick Edgar CLA
Modified: 2003-06-17 22:06 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2003-06-16 16:39:20 EDT
build I20030611

See bug 36908.  It describes a case where code expected isEnabled to be a 
simple getter for the enabled state, as modified by setEnabled.  But this is 
not the case.  This led to a subtle problem that was hard to debug.

It is a common Java pattern to have is<Property>() methods be simple accessors 
for boolean properties.  It would be better to use a different name for methods 
that go up the parent chain.
Comment 1 Steve Northover CLA 2003-06-17 11:23:49 EDT
I agree but we can't change this now without breaking people.
Comment 2 Randy Hudson CLA 2003-06-17 11:48:59 EDT
You could @deprecate isVisible, and add a new method called isShowing()

I'm not sure what the equivalent is for isEnabled, maybe Jeem would know.
Comment 3 Steve Northover CLA 2003-06-17 14:45:49 EDT
Why would we do that?  We're never getting rid of isVisible(), we've already 
made the mistake and we can never correct it.  How does adding an alias help?
Comment 4 Randy Hudson CLA 2003-06-17 15:30:57 EDT
Because if you had done that, then the UI team would have had compile warning 
generated, and they would have realized they were calling a wrong method.

I suppose subclasses that override that method wouldn't enjoy the confusion.
Comment 5 Nick Edgar CLA 2003-06-17 22:06:11 EDT
@deprecated?