RFR: 8168073: Speed up URI creation during module bootstrap

Paul Sandoz paul.sandoz at oracle.com
Mon Oct 17 19:58:18 UTC 2016


> On 17 Oct 2016, at 10:53, Claes Redestad <claes.redestad at oracle.com> wrote:
> 
> Hi Paul,
> 
> On 2016-10-17 19:39, Paul Sandoz wrote:
>> Hi Claes,
>> 
>> This looks good.
> 
> Thanks!
> 
>> 
>> Did you consider adding asserts to the package private constructor?
> 
> No, might be reasonable. Do you insist? :-)
> 

A gentle insistence. It could stop a nasty bug in the future if this method gets used in other places and incorrect URI instances are produced e.g.:

  assert foo(scheme, path);

  static boolean foo(String scheme, String path) {
    URI u = new URI(scheme + “:/“ + path);
    return scheme.equals(u.scheme) && path.equals(u.path);
  }

Paul.


More information about the core-libs-dev mailing list