Skip to content

Forbidden method invocation: java.net.URL#<init>(java.lang.String,java.lang.String,int,java.lang.String,java.net.URLStreamHandler) [Deprecated in Java 21] #849

@Pankraz76

Description

@Pankraz76

What version of OpenRewrite are you using?

I am using

  • OpenRewrite v1.2.3
  • Maven/Gradle plugin v1.2.3
  • rewrite-module v1.2.3

How are you running OpenRewrite?

I am using the Maven plugin, and my project is a single module project.

<rewrite-migrate-java.version>3.17.0</rewrite-migrate-java.version>

What is the smallest, simplest way to reproduce the problem?

        final URL url = new URL("test", null, 0, "", new URLStreamHandler() {
            @Override
            protected URLConnection openConnection(URL u) {
                return urlConnection;
            }
        });

What did you expect to see?

        final URL url = new URL("test", null, 0, "", new URLStreamHandler() {
            @Override
            protected URLConnection openConnection(URL u) {
                return urlConnection;
            }
        });

What did you see instead?

        final URL url = URL.of(new URI("test:///"), new URLStreamHandler() {
            @Override
            protected URLConnection openConnection(URL u) {
                return urlConnection;
            }
        });

What is the full stack trace of any errors you encountered?

stacktrace output here

Are you interested in contributing a fix to OpenRewrite?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Recipes Wanted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions