When going from 3.0.6 -> 3.0.7, my builds started failing:
error: no suitable method found for expiry(Expiry)
[ERROR] method InsertOptions.expiry(Duration) is not applicable
[ERROR] (argument mismatch; Expiry cannot be converted to Duration)
[ERROR] method InsertOptions.expiry(Instant) is not applicable
[ERROR] (argument mismatch; Expiry cannot be converted to Instant)
Having similar problems with ReplaceOptions and UpsertOptions.
this is a sample of the code that causes the problem:
public static InsertOptions copy(InsertOptions insertOptions) {
InsertOptions.Built built = insertOptions.build();
InsertOptions updatedOptions = insertOptions.insertOptions()
.expiry(built.expiry());
InsertOptions.Built.expiry(x) now returns Expiry instead of Duration… Why’d this change?
Would it be possible to get a overloaded method added to InsertOptions, ReplaceOptions and UpsertOptions (and any other XxxOptions) that takes an Expiry? Seems like that should’ve been there…
Unfortunately, I don’t necessarily have it… There’s no getter available on the Options… I could use reflection. Given we are based on Duration, flipping to Instant isn’t practical right now… This is a wrapper around the client that we have so our applications don’t all have to change when the client does…
@david.nault Not really since our defaults could be passed in from caller. For us, Duration is more meaningful since we want to say all objects of x type expire after 30s. An instant would require the caller to calculate that… Not horrible, but way less friendly.
@daschl Sure. Doesn’t help with this problem, but sure…
@unhuman Expiry has an encode method, which returns a long. You could use it to build an Instant out of it and set it back this way? I know its one object creation but it should be fairly cheap, because when we get an instant on expiry encode we’ll just extract its getEpochSecond.