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

Custom open modules windows #1139

Open
3 tasks
Domonion opened this issue Oct 11, 2022 · 2 comments
Open
3 tasks

Custom open modules windows #1139

Domonion opened this issue Oct 11, 2022 · 2 comments
Assignees
Labels
comp-ui Improvements of plugin UI appearence and functionality ctg-enhancement New feature, improvement or change request

Comments

@Domonion
Copy link
Collaborator

Description
Starting from JDK17 there are no special cli switch illegal-access which opens for reflection all jdk internal modules such as java.base - ref.

UtBot requires some internal jdk modules to be open for reflection. Current set of modules are available here. This set is used every time EngineProcess is started.

However, there can be many other modules which are used via reflection either directly or indirectly. Accessing them would break UTBot. Although we have OpenModulesContainer, it cannot suffice because:

  1. User code might have it's own modules
  2. User code might access internal modules in unpredictable way
  3. There are additional JDK providers which differs by JDK vendors - see Oracle internal modules used in sandbox #1138.

All 3 options implicate that whatever set of open modules we use - it is still possible for UTBot to access modules closed for reflection. This will break UTBot execution.

To mitigate that problem I propose to provide user a tool to customly set required modules open. The motivation is that user have much better understanding of the project UTBot is used on. In case if our module list is incomplete - he will manully provide additonal modules.

This feature involves:

  • At least 1 working example when our list is insufficient
  • Detect and catch all similar error
  • UI developement
@Domonion Domonion added ctg-enhancement New feature, improvement or change request comp-ui Improvements of plugin UI appearence and functionality labels Oct 11, 2022
@korifey korifey moved this to Todo in UTBot Java Oct 11, 2022
@denis-fokin
Copy link
Collaborator

denis-fokin commented Oct 13, 2022

If we are discussing the generated tests, we have information about incorrect modules set-up even on concrete execution's phase. We can use this information to specify open modules automatically (on the fly).

Maybe we can employ module-info.test or module-info.java (probably this article can help https://sormuras.github.io/blog/2018-09-11-testing-in-the-modular-world#white-box-modular-testing-with-extra-java-command-line-options)

@tyuldashev tyuldashev assigned denis-fokin and unassigned korifey Jul 6, 2023
@tyuldashev
Copy link
Collaborator

tyuldashev commented Jul 6, 2023

@denis-fokin module-info.test seems not the best option, because that's unofficial suggestion and is not supported by tools out of the box (see for example discussion, especially last comment, for IDEA ). Also one maybe don't want to modularize his own project, so adding module-info.java/test would make more harm than good. For now I would suggest to disable such problematic cases and add some type of the comment, what's needed to be 'fixe' in project configuration.

UPD: actually for generated tests there is dedicated case #2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-ui Improvements of plugin UI appearence and functionality ctg-enhancement New feature, improvement or change request
Projects
Status: Todo
Development

No branches or pull requests

4 participants