[code-reflection] RFR: Conflicting code reflection fields for method overrides [v4]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Jun 28 17:38:28 UTC 2024


On Fri, 28 Jun 2024 17:14:42 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> This patch constructs code reflection fields from method name and $-escaped method parameters.
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   constructins field name from escaped MethodRef::toString

Marked as reviewed by mcimadamore (Reviewer).

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethods.java line 194:

> 192:                 // create a static final field holding the op' string text.
> 193:                 // The name of the field is foo$op, where 'foo' is the name of the corresponding method.
> 194:                 classOps.add(opFieldDecl(methodName(bodyScanner.symbolToErasedMethodRef(tree.sym)), tree.getModifiers().flags, funcOp));

Optional comment (we can also leave it for another PR). I think the code would be a bit cleaner if the method name would be computed inside `opFieldDecl`, as that's what that method is about.

test/jdk/java/lang/reflect/code/TestOverloads.java line 87:

> 85: 
> 86:     @Test(dataProvider = "testData")
> 87:     public static void testOverloads(Class<?>[] paramTypes, Object[] params) {

Nice test!

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

PR Review: https://git.openjdk.org/babylon/pull/162#pullrequestreview-2148611701
PR Review Comment: https://git.openjdk.org/babylon/pull/162#discussion_r1659098971
PR Review Comment: https://git.openjdk.org/babylon/pull/162#discussion_r1659099988


More information about the babylon-dev mailing list