Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark internal fields as transient #656

Merged
merged 4 commits into from
Sep 26, 2023

Conversation

axelrindle
Copy link
Contributor

Pull Request

Related issue

Fixes #655

What does this PR do?

Gson has issues working with the class com.meilisearch.sdk.Index in Java 9 and higher. Specifically all the fields which hold a com.meilisearch.sdk.HttpClient. Marking those fields as transient excludes them from serialization and thus preventing the reflective access on JDK-internal types.

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

@axelrindle axelrindle changed the title Fix for issue #655 Mark internal fields as transient Sep 19, 2023
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @axelrindle
thank very much for your PR

Can you add tests to the test suite?

@curquiza curquiza added the bug Something isn't working label Sep 20, 2023
@axelrindle
Copy link
Contributor Author

I could need some assistance for adding tests to the suite. How exactly could I test this very specific scenario?

The InaccessibleObjectException only occurs starting with JDK 9, while the tests are run with JDK 1.8. There a StackOverflowError is thrown instead which I could assert...

@curquiza
Copy link
Member

@axelrindle let's go with your test in this case

However both CIs are failing. Can you fix your PR?

@axelrindle
Copy link
Contributor Author

@curquiza The linter should be happy now :)

@curquiza
Copy link
Member

Hello @axelrindle
Both CI (linter and tests) are still failing

@axelrindle
Copy link
Contributor Author

@curquiza Try again please ... I think I got it right now 😄

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeaaaaaaah it works

Next time you contribute, I will not have to approve the CI to run it and you will be able to see the CI result immediately. This is a security we added for first-time contribution 😊

bors merge

@meili-bors
Copy link
Contributor

meili-bors bot commented Sep 26, 2023

Build succeeded:

@meili-bors meili-bors bot merged commit 6d4fc2f into meilisearch:main Sep 26, 2023
3 checks passed
@axelrindle axelrindle deleted the fix/issue-655 branch September 26, 2023 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InaccessibleObjectException: impossible to retrieve indexes
2 participants