Ad hoc type restriction
Archie Cobbs
archie.cobbs at gmail.com
Sat Nov 29 22:08:34 UTC 2025
On Wed, Oct 15, 2025 at 7:10 PM Archie Cobbs <archie.cobbs at gmail.com> wrote:
> On Wed, Oct 15, 2025 at 11:34 AM Manu Sridharan <manu at sridharan.net>
> wrote:
>
>> This is all mostly possible via the Checker Framework and similar
>> approaches.
>>
>
> In the spirit of due diligence, I am attempting to implement something
> like "WHAT I WANT" using the checker framework
>
Just a little follow-up on this "due diligence" project... (a summary of
the idea is here
<https://archiecobbs.github.io/typetags/site/apidocs/org/dellroad/typetags/core/TypeTag.html>
).
I'm declaring defeat for now due to an insufficient product of ability×time.
A few debrief notes...
1. I was unable to get basic questions answered about the checker
framework, for example, how to handle dynamically detected annotation
types. Probably because the discussion group is broken
<https://github.com/typetools/checker-framework/issues/7388>. Unfortunately
I don't have time to figure that part out on my own.
2. Thanks to the ClassFile API, the runtime checking component of this idea
was fairly fun & easy to prototype (working example here
<https://github.com/archiecobbs/typetags/blob/main/example/src/main/java/org/dellroad/typetags/example/Example.java>
).
3. There are still a few holes in the RuntimeVisibleTypeAnnotations class
file attribute representation of uses of type annotations in Java source,
e.g., JDK-8371735 <https://bugs.openjdk.org/browse/JDK-8371735> and
JDK-8371733 <https://bugs.openjdk.org/browse/JDK-8371733>. These make me
wonder whether anyone is actually using these attributes much in the real
world.
So for now, this dream of simple, custom type restrictions is still, um,
available :)
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20251129/93c9093e/attachment-0001.htm>
More information about the amber-dev
mailing list