Panama unresolved error when instantiating wayland struct...

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Feb 15 13:33:57 UTC 2019


Offsets can be computed using the Layout API, no allocation is required.

E.g.

Group g = (Group)LayoutType.ofStruct(Foo.class).layout();
int[] offsets = new int[g.elements().size()];
int offset = 0;
for (int i = 0 ; i < g.elements().size() ; i++) {
     offsets[i] = offset;
     offset += g.elements().get(i).bitsSize();
}

This should work?

Maurizio


On 15/02/2019 13:18, Jorn Vernee wrote:
> Yes, this looks good to me.
>
> It looks like we need to add some sort of static offsetOf utility API 
> so that you don't have to allocate a struct to find the offset of a 
> field. Maybe something like (Java):
>
>     public static <T extends Struct<T>> long offsetOf(Class<T> 
> structClass, String fieldName) {
>         ...
>     }


More information about the panama-dev mailing list