At least org.apache.jasper.compiler.Compiler Tomcat creates URL from string. Instead of transforming an URL to a string to a new URL again, it is better to keep the original URL. Maybe change JspServletWrapper.getDependants to Map<URL, Long> ?
Not all dependencies are identified by URI. String is the lowest common denominator. Also, claims that an approach is "better" needs evidence to back up that claim.
If you convert a URL to a string and then back to URL you will lose a specific URLHandler. I'm using a specific URLHandler it allows me to open, read, and verify a jar against a checksum (sha512) once. The jar data is then kept in memory channel.map(MapMode.PRIVATE, 0, size), so I'm sure that tomcat parsers are getting the signed data. To get it working I put in the URL string something like m2://groupid/artifactid/version so it will reopen the file from .m2/repository but the data may not be correct. If you want to keep other format you can create a class like this : class URLorString { URL url; String string; getURL() { url != null ? url : new URL(string) } }