Skip to content

Reflective access on Java 11 #6299

@marekjelen

Description

@marekjelen

Hello,

on JRuby version

jruby 9.2.11.1 (2.5.7) 2020-03-25 b1f55b1a40 OpenJDK 64-Bit Server VM 11.0.7+10-LTS on 11.0.7+10-LTS +jit [darwin-x86_64]

the following code

java_import java.net.http.HttpClient
java_import java.time.Duration

builder = HttpClient.new_builder
builder.followRedirects(HttpClient::Redirect::NORMAL)
builder.connectTimeout(Duration.ofSeconds(20))
@client = builder.build

fails with

TypeError: illegal access on 'build': class org.jruby.javasupport.JavaMethod (in module org.jruby.dist) cannot access class jdk.internal.net.http.HttpClientBuilderImpl (in module java.net.http) because module java.net.http does not export jdk.internal.net.http to module org.jruby.dist

When the package is opened, it works fine.

--add-opens java.net.http/jdk.internal.net.http=org.jruby.dist

However, is it really necessary for JRuby to require access to the internal package?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions