URIs are immutable value classes, so you don't need to make copies. But if you really need to, then your βhackingβ (this is really not so bad) is the way to do it.
EDIT: I just noticed that you are not using java.net.URI ...
From the Eclipse SDK javadocs ,
Like String, a URI is an immutable class;
This class is also immutable, and the same advice applies. Usually you do not need to make a copy, just reuse the instance of the URI that you have. The reason this is safe is because you cannot change it after creating the object. Two different clients can use the same URI without fear that it will be changed by another.
There are methods in the URI that update the components of the URI (for example, appendQuery() ), but updates are performed on a new instance of the URI β the existing URI is not changed.
mdma source share