Closed javaspeak closed 1 year ago
i wonder if this method is even called anywhere lol, checking
maybe it's something more advanced in Java than what i know, but the note states that it's supposed to return the current IPFS object with modified timeout(s)
but it returns a new object
if it's supposed to return a new object, then yeah it should be static if it's supposed to return the current object, then it should just be a setter that returns the current object and not a new object (this latter part im not 100% certain of, it's just how i'd write it)
oh, the timeout fields are final, so it's not a setter method it has to return a new object because the fields are final i remember something about this when learning Rust... Rust's variables are all final by default (immutable), i forgot why tho https://youtu.be/iFdh4sPC5Tg?t=188
oh it's just for safety when passing it around
so it seems like it's all correct, just the note is kind of tricky for me lol
Fixed merged
The implementation in 1.3.3 is as follows:
public IPFS timeout(int timeout) { return new IPFS(host, port, version, connectTimeoutMillis, readTimeoutMillis, protocol.equals("https")); }
Notice that timeout is not passed to the constructor of IPFS
Also, this method is a bit strange in itself. It returns a new IPFS. If that is the design then surely this method should be a static one?