From a practical standpoint, the java.net.URL class dates from the earliest versions of Java and is rubbish, so I would say that in general java.net.URI is preferred regardless of whether the thing in question is really a URI or a URL. But in that case I think the method name and documentation should also say URI. Otherwise it will be confusing.