Anonymous structs have strange issues with scala and intellij in ea+44

Jorn Vernee jbvernee at xs4all.nl
Tue Feb 19 23:29:40 UTC 2019


Hi Mark,

I ran into this as well while testing with the Windows API a while ago, 
so I don't think it's caused by a change in the latest build.

As you've discovered, IntelliJ's intellisense is rejecting the type, 
while javac is still able to compile it. I did find a bug in IntelliJ's 
bug tracker which seems very similar, but this seems to have closed as 
"Fixed" ages ago: https://youtrack.jetbrains.com/issue/IDEA-106532

I tried to reproduce the problem without using jextract as well, but was 
not able to, so the bug seems to be up to a particularity of the classes 
generated by jextract. I'm not sure if the bug should be attributed to 
jextract or IntelliJ though.

I'm using pure Java, so this was less of an issue for me. I moved on and 
kind of forgot to report this.

Thanks for bringing this up again,
Jorn

Mark Hammons schreef op 2019-02-20 00:03:
> Hi again all,
> 
> I started making progress on my project, and I've hit a strange bump
> in the road. I have a type wlr_backend defined as such:
> 
> struct wlr_backend {
>         const struct wlr_backend_impl *impl;
> 
>         struct {
>                 /** Raised when destroyed, passed the wlr_backend 
> reference */
>                 struct wl_signal destroy;
>                 /** Raised when new inputs are added, passed the
> wlr_input_device */
>                 struct wl_signal new_input;
>                 /** Raised when new outputs are added, passed the 
> wlr_output */
>                 struct wl_signal new_output;
>         } events;
> };
> 
> basically, an anonymous struct. In the latest version, a type is
> created for this struct with the name anon$backend_h$444. However, the
> wlr_backend I get back from the foreign interface does not actually
> return this type. When I was using scala I kept getting weird errors
> of the sort "Class wlroots.backend$anon$backend_h$444 not found -
> continuing with a stub." so I switched to accessing this stuff with
> pure java using the following file:
> 
> public class McWayfaceServer {
>     public Pointer<wayland_server_core.wl_event_loop> eventLoop;
>     public Pointer<backend.wlr_backend> backend;
> 
>     public McWayfaceServer(Pointer<wayland_server_core.wl_display> 
> display) {
>         eventLoop =
> usr.include.wayland.wayland_server_core_h.wl_display_get_event_loop(display);
>         backend = wlroots.backend_h.wlr_backend_autocreate(display,
> Callback.ofNull());
>     }
> 
> 
>     public wlroots.backend.anon$backend_h$444 getBackendEvents() {
> 
>     //intellij says this line has a type error
> 
>       return backend.get().events$get();
>     }
> }
> 
> IntelliJ marks the line below as erroneous. It says that the actual
> type is wlroots.backend.anon.backend_h.444. However, the code as
> written compiles. I don't know if this is a bug or a change in how
> java 13 works that scala and intellij can't deal with. All I know is
> that these issues didn't exist in the previous release. I can work
> around them by writing java handlers for these types that help scala
> realize types in question so it's not a blocker, but it is an odd
> behavior change I noticed.
> 
> Thanks,
> 
> Mark


More information about the panama-dev mailing list