JetBrains-Research / TestSpark

TestSpark - a plugin for generating unit tests. TestSpark natively integrates different AI-based test generation tools and techniques in the IDE. Started by SERG TU Delft. Currently under implementation by JetBrains Research (ICTL) for research purposes.
MIT License
35 stars 9 forks source link

Fix the Null SDK issue #260

Open pderakhshanfar opened 3 weeks ago

pderakhshanfar commented 3 weeks ago

Description of changes made

Users can now see their own SDK for project under test in the headless mode. If this SDK is not provided and IJ cannot also detected a project SDK for this project, the script uses the SDK provided in Java home.

Why is merge request needed

Headless mode does not work properly and it throws null pointer exception because of null sdk

Other notes

Closes #issue_number

Vladislav0Art commented 3 weeks ago

For some reason, the following line in TestProcessor.kt fails with NullPointerxception:

command.add(CompilerModuleExtension.getInstance(projectContext.cutModule!!)?.compilerOutputPath!!.path)

The projectContext.cutModule cannot be null by design, thus it is the compilerOutputPath which is null. I do not know why this happens, but I managed to craft the required filepath by hand (outputDirectory + CUTPackageSplitBySlashes).

Vladislav0Art commented 3 weeks ago

Does this PR still require a review? Several issues in this PR seem to have been addressed within the pderakhshanfar/improvements/headless-mode-newopener branch.

pderakhshanfar commented 3 weeks ago

@Vladislav0Art Short answer: This PR does not need a review and will be closed soon. Long answer: The headless-mode-new opener branch is only a temporary solution to fix project openings in our previous implementation. So, it cannot be merged into the development branch. This branch will not be merged into the development branch too as it does not work properly and (same as headless-mode-newopener) we need to implement new project openers or Maven and Gradle projects using CommandLineInspectionProjectConfigurators.