[foreign] RFC 8219042: Cross-header layout resolution does not work

Jorn Vernee jbvernee at xs4all.nl
Fri Feb 15 18:59:23 UTC 2019


Looks good! I like it.

It's a nice way of explicitly saying what an annotation's dependencies 
are.

Jorn

Maurizio Cimadamore schreef op 2019-02-15 18:11:
> Here's what I have in mind:
> 
> https://cr.openjdk.java.net/~mcimadamore/panama/8219042_v2/
> 
> Essentially, I've introduced a new attribute in the @NativeHeader,
> @NativeStruct and @NativeCallback annotations. The attribute is called
> 'resolutionContext' and points to an optional j.l.Class array. If left
> empty, the resolution context for C is assumed to be the outermost
> class in which C is defined.
> 
> If non-empty, the default resolution context will be augmented to also
> look inside the classes specified in the attribute (and all classes
> nested in them).
> 
> I think it is a very clean approach, which does not intrude too much
> (no test was impacted, except for the clang/FFI test, which actually
> had a true cross-header reference - from Index.h to CXString.h).
> 
> No new annotations, more efficient (no more full method signature
> scans) and deterministic model, which scales to custom defined bound
> interfaces, too.
> 
> I think this looks like a winner?
> 
> If looks good, I can go ahead, add a test and file a RFR.
> 
> Maurizio
> 
> On 15/02/2019 15:47, Maurizio Cimadamore wrote:
>> As for (2), I think there are many intermediate steps we could take - 
>> for instance, instead of explicit name -> class mapping, we could 
>> simply define a list of 'friends' toplevel classes the resolver has to 
>> scan.
>> 
>> So, if you are in header A and you refer to something in header B, you 
>> can say @Friend(B.class), for example.


More information about the panama-dev mailing list