Re:Java's URL.equals() Performs DNS Resolution
by bspammer on Wednesday December 11, 2019 @06:35PM
(#21767932)
Doesn't look like it's turned on by default though, which seems strange. Presumably if you care enough to go into the settings to enable that specific warning you're unlikely to make the mistake in the first place. It's exactly the type of non-obvious gotcha that would be nice to have your IDE warn you about out of the box.
Re:Java's URL.equals() Performs DNS Resolution
by ShinTakuya on Wednesday December 11, 2019 @10:55PM
(#21769146)
I agree and disagree. I mean, the thing is that outside of personal projects it's not uncommon to inherit a codebase from other people, sometimes quite a large codebase. Such a warning can be useful when eliminating boo-boos (acting as an lint I guess).
Re:Java's URL.equals() Performs DNS Resolution
by tuwtuwtuwtuw on Thursday December 12, 2019 @12:58AM
(#21769603)
Wouldn't you want warnings when an inherited code base does weird things with possible incorrect behaviors as side effect?
Re:Java's URL.equals() Performs DNS Resolution
by ShinTakuya on Thursday December 12, 2019 @03:20PM
(#21775984)
Well I would consider DNS resolution on comparisons/hashing to be an incorrect behaviour as a side effect.
Re:Java's URL.equals() Performs DNS Resolution
by ivan_gammel on Thursday December 12, 2019 @03:34PM
(#21776126)
In this case Sonar will do a better job. IDE warnings are good for fixing them immediately - when they accumulate itβs very easy to stop paying any attention.
- equals() or hashCode() called on java.net.URL object
- Map or Set may contain java.net.URL objects
https://www.jetbrains.com/help/idea/list-of-java-inspections...