javaannotationscom4j

@Optional annotation not found


I'm using com4j to generate Java type definitions from a COM type library. The generated code contains a lot of uses of the @Optional annotation, for example:

@DISPID(14) //= 0xe. The runtime will prefer the VTID if present
@VTID(23)
void mail(
    java.lang.String sendTo,
    @Optional @DefaultValue("") java.lang.String sendCc,
    @Optional @DefaultValue("0") int option,
    @Optional @DefaultValue("") java.lang.String subject,
    @Optional @DefaultValue("") java.lang.String comment);

However @Optional is not resolving and I'm unable to find where it's defined.


Solution

  • Found the problem. I was using an older version of com4j that didn't yet support the @Optional annotation. Updated to the latest and it resolved.