Page MenuHomePhabricator

Don't define abstract methods but instead leave them defined as null
Closed, ResolvedPublic

Description

/**
 * @abstract
 * @method
 */
ve.foo.Bar.prototype.abstractMethod = function () {
   throw new Error( 've.foo.Bar subclass must implement abstractMethod');
};


x.abstractMethod();
> Error: ve.foo.Bar subclass must implement abstractMethod


/**
 * @abstract
 * @method
 */
ve.foo.Bar.prototype.abstractMethod = null;

x.abstractMethod();
> TypeError: Property 'abstractMethod' of object #<VeFooQuuxBar> is not a function

Seems easier to maintain and good enough.


Version: unspecified
Severity: enhancement

Details

Reference
bz52482
Related Gerrit Patches:

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:48 AM
bzimport added a project: Technical-Debt.
bzimport set Reference to bz52482.
Krinkle created this task.Aug 2 2013, 9:30 PM
Jdforrester-WMF renamed this task from VisualEditor: Use null instead of flame throwers as abstract method value to Don't define abstract methods but instead leave them defined as null.Apr 9 2015, 2:48 PM
Jdforrester-WMF set Security to None.
Jdforrester-WMF added subscribers: Aklapper, Esanders.

Change 203046 had a related patch set uploaded (by Jforrester):
Replace abstract functions that just throw with null

https://gerrit.wikimedia.org/r/203046

Change 203246 had a related patch set uploaded (by Jforrester):
Replace abstract functions that just throw with null

https://gerrit.wikimedia.org/r/203246

Change 203046 merged by jenkins-bot:
Replace abstract functions that just throw with null

https://gerrit.wikimedia.org/r/203046

Change 203246 merged by jenkins-bot:
Replace abstract functions that just throw with null

https://gerrit.wikimedia.org/r/203246

Change 252605 had a related patch set uploaded (by Esanders):
Use null for abstract methods and correct documentation

https://gerrit.wikimedia.org/r/252605

Change 252605 merged by jenkins-bot:
Use null for abstract methods and correct documentation

https://gerrit.wikimedia.org/r/252605