On 21/06/2017 07:10, Hamlin Li wrote:
:
It's possible to have 2 public static no-args method "provider" in a
service provider *class file*, JVM spec allows it,
Right, you can't do this in the Java Language but the JVMS allows it.
The most obvious usage of this "feature" is covariant return types where
the java compiler will generate a bridge method with the less specific
return type from the superclass. In the Core Reflection APIs then
getMethods and getMethod need to deal with this so that the user of API
only sees the overriding method.
And I still have questions:
Why need to have this restriction in java API doc?
For completeness only as it's one of the reasons why SCE is thrown. Note
that it's also not "new" in this update, instead the wording for many of
the error cases has been refreshed.
Will there be corresponding update in JVM spec? When will this
restriction be verified, at linking time?
No impact.
-Alan