This program:
// --
interface IfaceWithPrivateFinalMethod {
private final void privateFinalMethod() {}
}
triggers the error:
X.java:2: error: modifier final not allowed here
private final void privateFinalMethod() {}
^
1 error
It would seem since private methods are not inherited, they are final anyway and the compiler should allow the combination of private and final to modify an interface method.
// --
interface IfaceWithPrivateFinalMethod {
private final void privateFinalMethod() {}
}
triggers the error:
X.java:2: error: modifier final not allowed here
private final void privateFinalMethod() {}
^
1 error
It would seem since private methods are not inherited, they are final anyway and the compiler should allow the combination of private and final to modify an interface method.
- relates to
-
JDK-8072872 9.4: Allow interface methods to be 'private'
- Closed