RFR 8200452: Jextract failed to produce enum constants for anonymous enums

Henry Jen henry.jen at oracle.com
Tue Apr 3 05:24:38 UTC 2018


On Apr 2, 2018, at 9:23 PM, Sundararajan Athijegannathan <sundararajan.athijegannathan at oracle.com> wrote:
> 
> 
> +    public boolean isAnonymousEnum() {
> 
> +        // libclang::clang_Cursor_isAnonymous only applies to struct, not enum
> +        if (type().kind() == TypeKind.Enum) {
> +            return spelling().isEmpty() &&
> +                    type().spelling().startsWith("enum (anonymous");
> +        }
> +        return false;
> +    }
> +
> 
> 
> Is it possible for check something else that is more stable than implementation aspect ("enum (anonymous")?  How about Java non-identifier character presence or something like that?
> 

I don’t get it, this is based on values from libclang implementation, so I have no idea how that related to Java non-identifie character.
Unfortunately, I cannot find anything we can use in libclang, the isAnonymous() only applies to record type, not enum. I am open to suggestions on how can it be more reliable.

Cheers,
Henry

> -Sundar
> 
> On 03/04/18, 9:40 AM, Henry Jen wrote:
>> Hi,
>> 
>> Please review the webrev[1] for 8200452[2]. The patch add constant int into the main interface is the enum is complete anonymous, otherwise, it was created as an type annotation of int with all enum constants in it.
>> 
>> Cheers,
>> Henry
>> 
>> [1] 
>> http://cr.openjdk.java.net/~henryjen/panama/8200452/webrev/
>> 
>> [2] 
>> https://bugs.openjdk.java.net/browse/JDK-8200452
>> 
>> 
>> 
>> 
>> 
>>> On Mar 29, 2018, at 12:11 PM, Henry Jen <henry.jen at oracle.com>
>>>  wrote:
>>> 
>>> Thanks, this fix part of the issue we encountered with anonymous enum.
>>> 
>>> I filed a bug JDK-8200452[1] for various cases, we need to have a better strategy for naming anonymous enum, particularly when without typedef.
>>> 
>>> Cheers,
>>> Henry
>>> 
>>> 
>>> [1] 
>>> https://bugs.openjdk.java.net/browse/JDK-8200452
>>> 
>>> 
>>> 
>>>> On Mar 27, 2018, at 10:00 PM, Sundararajan Athijegannathan <sundararajan.athijegannathan at oracle.com>
>>>>  wrote:
>>>> 
>>>> Please review.
>>>> 
>>>> Webrev: 
>>>> http://cr.openjdk.java.net/~sundar/jextract_anonymous_enum/webrev.00/
>>>> 
>>>> 
>>>> Thanks,
>>>> -Sundar
>>>> 



More information about the panama-dev mailing list