-
Enhancement
-
Resolution: Won't Fix
-
P4
-
1.1.4, 1.1.5, 1.2.2, 1.3.0, 1.4.0, 1.4.1, 1.4.2, 6, 7
-
generic, x86
-
generic, linux, windows_95, windows_98, windows_2000, windows_xp
Please extend the definition of an 'Interface'
to include class (static) methods.
Currently, attempting to expose class methods
via an interface generates a compiler error, e.g.
MyInterface.java:2: Interface methods can't be
native, static, synchronized, final, private,
or protected : void classMethod()
public static void classMethod ();
This limitation forces one to create two classes
and two interfaces (which in turn creates other
difficulties), instead of one of each, in order
to publish class methods e.g. 'Orders' and 'Order'
classes and interfaces. Visual Basic's lack of
class methods forces one to do the same thing.
Noting the other exclusions above, I would also
question why interfaces cannot have final or
synchronized methods.
(Review ID: 19893)
======================================================================
- duplicates
-
JDK-4193604 Interfaces should be able to support an implementation API.
-
- Closed
-
-
JDK-4291381 Add static methods to interfaces
-
- Closed
-
-
JDK-4306573 Allow class methods to be specified by interfaces
-
- Closed
-
-
JDK-4491759 Interfaces to support static declarations
-
- Closed
-
-
JDK-4804452 RFE to add staticinterfaces to java
-
- Closed
-
-
JDK-5046180 Class interface support to have interface definition of the static methods
-
- Closed
-
-
JDK-6469144 RFE: consider adding traits to Java
-
- Closed
-
-
JDK-7103116 Traits for java (interfaces with implemented methods)
-
- Closed
-