RFR: 7903965: Fix Launching Tests from Context Menu

Oleksii Sylichenko duke at openjdk.org
Mon Mar 10 13:27:15 UTC 2025


On Mon, 10 Mar 2025 13:23:11 GMT, Oleksii Sylichenko <duke at openjdk.org> wrote:

>> plugins/idea/src/main/java/com/oracle/plugin/jtreg/configuration/producers/JTRegClassConfigurationProducer.java line 73:
>> 
>>> 71:         if (element instanceof PsiDirectory runDir) {
>>> 72:             configuration.setPackage(runDir.getVirtualFile().getPath());
>>> 73:         } else {
>> 
>> If this producer can now handle directories too, do we still need `JTRegDirectoryConfigurationProducer`?
>> 
>> Also, for a directory this would end up calling `nameForElement` -> `element.getContainingFile().getName()`, where `getContainingFile` seemingly returns `null`, so I think that would fail.
>
> `PsiDirectory#getVirtualFile` should not return `null` due to its annotated with `@NotNull`:
> 
> ![PsiDirectory#getVirtualFile](https://github.com/user-attachments/assets/1d222ffe-5a3c-49cc-a70c-5e6a8daef9ac)

On the other hand, a file element could produce null for `getVirtualFile()`:

![image](https://github.com/user-attachments/assets/15dcfd4b-7b87-4387-a0e8-440d65fff0e7)

ok, I will add check there

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

PR Review Comment: https://git.openjdk.org/jtreg/pull/252#discussion_r1987280068


More information about the jtreg-dev mailing list