0

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.

Fergal
  • 5,213
  • 6
  • 35
  • 44

2 Answers2

1

You can always create it yourself:

public @interface Optional {

}
David Kroukamp
  • 36,155
  • 13
  • 81
  • 138
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
1

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.

Fergal
  • 5,213
  • 6
  • 35
  • 44