[External] : MethodTypeDesc.parameterList()
Chen Liang
chen.l.liang at oracle.com
Fri Apr 25 22:02:16 UTC 2025
Excuse me, but I don't understand anything you are talking about here. Note this channel is for discussion of the Class-File API instead of support questions.
Both classes are inner classes, which are nested classes that are not static. (Refer to JLS section 8.1.3). All constructors of inner classes have a mandated (implicit, but required to be present by specification) argument that passes the immediately enclosing instance. See JLS section 15.9.2 for determining enclosing instances.
The JLS is available at https://docs.oracle.com/javase/specs. You can find the sections in the menu.
In short, both cases will have enclosing instances and an implicit outer-this argument in the constructors because their declarations are not static classes. That is, unless you are declaring as member of interfaces; interface member classes are implicitly public and static, which does not seem to be your case as you are declaring the first class as private.
If you have more questions, please go to compiler-dev list.
Regards,
Chen Liang
________________________________
From: Mark Roberts <markro at cs.washington.edu>
Sent: Friday, April 25, 2025 4:54 PM
To: classfile-api-dev at openjdk.org <classfile-api-dev at openjdk.org>
Cc: Chen Liang <chen.l.liang at oracle.com>
Subject: [External] : MethodTypeDesc.parameterList()
There seems to be an inconsistency in the treatment of parameters to inner class constructors. Given that these two classes are inner classes:
private class Entry
{
final double key;
final Object value;
public Entry(double key, Object value) {
this.key = key;
this.value = value;
}
}
public class DuplicateElementException extends RuntimeException
{
DuplicateElementException() { }
DuplicateElementException(String s) { super(s); }
}
For the first, the local vars:
this, key, value
Param types:
MapQuick.PriorityQueue, double, java.lang.Object
Note that the type of ‘this’ is included in the list – this is not true for every other case I have seen.
For the second, local vars:
this, this$0
Param types:
MapQuick.PriorityQueue
This agrees with the ‘normal’ case as MapQuick.PriorityQueue is associated with ‘this$0’ and the type for ‘this’ is not included.
I had to add a lot of ugly code to work around this. It seems like including the type of the ‘this’ pointer is a problem or am I missing something?
Thank you,
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20250425/fba3d4db/attachment.htm>
More information about the classfile-api-dev
mailing list