question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Illegal Reflective Access Operation to field java.net.HttpURLConnection.method

See original GitHub issue

Describe the bug I attempt to archive a repository using the following code:

GHRepository repo = this.org.getRepository("repo-name-here");
repo.archive();

When checking GitHub itself, the repository is in fact archived, however I receive a warning in the stderr stream consisting of the following:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.kohsuke.github.GitHubHttpUrlConnectionClient$HttpURLConnectionResponseInfo (file:/C:/Users/andrew/.m2/repository/org/kohsuke/github-api/1.108/github-api-1.108.jar) to field java.net.HttpURLConnection.method
WARNING: Please consider reporting this to the maintainers of org.kohsuke.github.GitHubHttpUrlConnectionClient$HttpURLConnectionResponseInfo
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

To Reproduce Steps to reproduce the behavior:

  1. Fetch a GHRepository that is not yet archived.
  2. Call archive() on that repository.

Expected behavior I expect that there should not be any illegal reflective access exceptions.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Firefox
  • Version 74

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
aalmiraycommented, Apr 8, 2021

Thank you @bitwiseman 😄 ! I’ll give it a try tomorrow, it’s close to midnight where I am right now. Will report back as soon as I have something conclusive.

1reaction
lotharschulzcommented, Oct 7, 2020

Thanks @bitwiseman! These are the relevant kotlin changes I was able to do based on your input:

additional dependency using kotlin dsl (build.gradle.kts)

    implementation("com.squareup.okhttp3:okhttp:4.9.0")

some kt file

import okhttp3.OkHttpClient
import org.kohsuke.github.GitHubBuilder.fromEnvironment
import org.kohsuke.github.extras.okhttp3.OkHttpConnector
...
// within an existing class
    companion object {
        private val baseClient = OkHttpClient()
    }
...
// within an existing fun
                fromEnvironment().
                withConnector(
                    OkHttpConnector(baseClient)
                ).build()
Read more comments on GitHub >

github_iconTop Results From Across the Web

Illegal reflective access operation warning occurs when using ...
Hi! My script creates a simple GET request: #!/usr/bin/env clj (import java.net.URL) (let [connection (.
Read more >
Java 9 Illegal Reflective Access Warning - Baeldung
The accessibility of modules is a finer concept and cares if one class can access another class's field or method.
Read more >
Developers - Illegal Reflective Access Operation to field java.net ...
Illegal Reflective Access Operation to field java.net.HttpURLConnection.method · Describe the bug. I attempt to archive a repository using the following code:
Read more >
An illegal reflective access operation has occurred when ...
You will see An illegal reflective access operation has occurred warning when installing and using AM (including Amster and ssoadm tools), Java ......
Read more >
Java 1.9 Reflection and Package Access Changes - Evil Tester
Since I new that the requests field on the URLConnection had the information that I needed, I simply used reflection to go and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found