Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy String.toURL is deprecated - why and what should we use instead?

Tags:

groovy

In current groovy versions, the method DefaultGroovyMethods.toURL(String) is marked as deprecated, but without any explanation.

Why is it deprecated and what should we use instead? I wanted to use it to easily get a file from HTTP like this:

def xml = "http://url.to/file.xml".toURL().text
like image 497
jhyot Avatar asked Jun 11 '15 12:06

jhyot


1 Answers

toURL() invoked on String comes from this class, not from DefaultGroovyMethods, so everything works fine and correct method is invoked.

like image 129
Opal Avatar answered Sep 18 '22 10:09

Opal