RFR: JDK-8302019: Clarify Elements.overrides [v2]

Pavel Rappo prappo at openjdk.org
Thu Jan 25 09:25:31 UTC 2024


On Thu, 25 Jan 2024 05:17:41 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Explicitly discuss and test handling of an interface declaring methods that "override" public methods on java.lang.Object.
>
> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update wording.

Thanks for addressing this, Joe. I have a few minor comments.

src/java.compiler/share/classes/javax/lang/model/util/Elements.java line 692:

> 690:      * Consistent with the usage of the {@code @Override} annotation, if an
> 691:      * interface declares a method override-equivalent to a {@code
> 692:      * public} method on {@code java.lang.Object}, this method treats

Nit: I'm not sure about "on". JLS uses "of" in a similar [context]:
> the method is override-equivalent to a public method of Object

It seems like the only similar use of "on" in javax.** can be found here:
https://github.com/openjdk/jdk/blob/1f89acd8498945e1d531b7845748bcee8194115b/src/java.compiler/share/classes/javax/tools/StandardJavaFileManager.java#L149-L151

In other cases, "on" is preceded by "invoke" or "call", which has a different meaning.

[context]: https://docs.oracle.com/javase/specs/jls/se21/html/jls-9.html#jls-9.6.4.4

test/langtools/tools/javac/processing/model/util/elements/TestOverrides.java line 63:

> 61:             if (expectedOverrideResult !=
> 62:                 elements.overrides(method, findMethod(methodName, objectElt), objectInterfaceElt ) ) {
> 63:                 throw new RuntimeException("Unexpected overrding relation found for " + method);

Suggestion:

                throw new RuntimeException("Unexpected overriding relation found for " + method);

test/langtools/tools/javac/processing/model/util/elements/TestOverrides.java line 88:

> 86: 
> 87: /**
> 88:  * Interface that has methods override-equivalent to methods on

Similar comment on "on".

test/langtools/tools/javac/processing/model/util/elements/TestOverrides.java line 110:

> 108:     void finalize();
> 109: 
> 110:     // Final methods on Object (getClass, wait, notify[all]) rejected

Ditto.

-------------

PR Review: https://git.openjdk.org/jdk/pull/17564#pullrequestreview-1843157189
PR Review Comment: https://git.openjdk.org/jdk/pull/17564#discussion_r1466040622
PR Review Comment: https://git.openjdk.org/jdk/pull/17564#discussion_r1466066047
PR Review Comment: https://git.openjdk.org/jdk/pull/17564#discussion_r1466045235
PR Review Comment: https://git.openjdk.org/jdk/pull/17564#discussion_r1466069947


More information about the compiler-dev mailing list