RFR: 7903300: Add test library support to jtreg plugin

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Sep 15 15:06:10 UTC 2022


On Sun, 11 Sep 2022 13:06:20 GMT, Guoxiong Li <gli at openjdk.org> wrote:

> Hi all,
> 
> Currently, when we open a jtreg test file which uses the JUnit or TestNG, the plugin can't identify the related classes of the JUnit or TestNG. So the statement such as `import org.junit.Test` is marked as red with error message `Cannot resolve symbol 'junit'`.
> 
> This patch adds the jtreg libraries directory to the lib path of the `Jetbrains IDEA` when opening the JUnit or TestNG test files so that the `Jetbrains IDEA` can identify the related classes.
> 
> Thanks for taking the time to review.
> 
> Best Regards,
> -- Guoxiong

plugins/idea/src/main/java/com/oracle/plugin/jtreg/util/JTRegUtils.java line 352:

> 350:      * Create (if not existing) and get the jtreg project library.
> 351:      */
> 352:     public static Library createJTRegLibrary(Project project, String oldDir, String newDir) {

Wouldn't it be better to split this into a function that creates the library, and one that updates it? I find it odd that the file listener is calling this with oldDir == newDir. Maybe just add option for oldDir to be null, so that we only drop the old root if one is given?

-------------

PR: https://git.openjdk.org/jtreg/pull/117


More information about the jtreg-dev mailing list