Few cents about my commits

iOS13 PostFix #3: Support for @Block member in structs

|

This post continues the series of fixes discovered during compilation of CocoaTouch library.

PostFix #3: Adding support @Block members in structs

Other postfixes:

Issue was discovered while compiling CMBufferHandlers:

java.lang.IllegalArgumentException: No @Marshaler found for return type of @StructMember method <org.robovm.apple.coremedia.CMBufferHandlers: org.robovm.objc.block.Block1 getGetDecodeTimeStamp()>
	at org.robovm.compiler.MarshalerLookup.findMarshalerMethod(MarshalerLookup.java:169)
	at org.robovm.compiler.BroMethodCompiler.getStructMemberType(BroMethodCompiler.java:977)
	at org.robovm.compiler.BroMethodCompiler.getStructType(BroMethodCompiler.java:677)
	at org.robovm.compiler.BroMethodCompiler.getStructType(BroMethodCompiler.java:568)
	at org.robovm.compiler.StructMemberMethodCompiler.reset(StructMemberMethodCompiler.java:63)

Root case and fix

Root case and fix is clear from exception: there is no @Marshaller for @Block return type at moment StructMemberMethodCompiler performs reset. And the fix is to provide such. In details there are several moments and fixes:

  • Marshallers for @Block affected methods are generated by ObjCBlockPlugin in ObjCBlockPlugin.Before class run. The problem here is that ClassCompiler invokes it after StructMemberMethodCompiler.reset where this marshaller is required (and where exception is happening). The fix is to move reset section of method compilers below invocation of plugins Before. This makes marshallers generated at moment StructMemberMethodCompiler.reset needs it.
  • Second moment is that ObjCBlockPlugin.Before was not considering @StructMember annotated methods as subject for method transformation and the fix is trivial – extending condition to include the case.

The fix is delivered as PR421

Comments