I am trying to construct an org.joda.time.Instant from a LocalDate. Ordinarily it is as simple as;
new org.joda.time.Instant(myDate.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli());
But the project I am working on uses the modernizer-maven-plugin and there is a violation on Prefer java.time.Instant. I am not able to change the API of the class I am attempting to use.
So, my question is how do "Prefer java.time.Instant"?
Thx
You can disable specific instances of Modernizer violations via the @SuppressModernizer
annotation:
https://github.com/gaul/modernizer-maven-plugin#ignoring-elements
To ignore all instances of a violation, you can add an <exclusions>
stanza similar to:
<exclusions>
<exclusion>org/joda/time/Instant.now:()Lorg/joda/time/Instant;</exclusion>
<exclusion>org/joda/time/Instant.parse:(Ljava/lang/String;)Lorg/joda/time/Instant;</exclusion>
<exclusion>org/joda/time/Instant."<init>":(J)V</exclusion>
</exclusions>