Skip to content

Commit b07d4c4

Browse files
authored
Merge pull request #2640 from vitaliyboykocontributor/2638-java.lang.RuntimeException-java.util.concurrent.ExecutionException-java.nio.file.InvalidPathException
2638 java.lang.runtime exception java.util.concurrent.execution exception java.nio.file.invalid path exception
2 parents 924ce46 + 9cb6c6c commit b07d4c4

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
1010

1111
- 2026.* IDE's support [#2639](https://github.com/magento/magento2-phpstorm-plugin/pull/2639)
1212

13+
### Fixed
14+
15+
- java.lang.runtime exception java.util.concurrent.execution exception java.nio.file.invalid path exception [#2640](https://github.com/magento/magento2-phpstorm-plugin/pull/2640)
16+
1317
## 2025.2.2
1418

1519
### Fixed

src/main/java/com/magento/idea/magento2plugin/stubs/indexes/EventNameIndex.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
*/
3434
public class EventNameIndex extends ScalarIndexExtension<String> {
3535
public static final ID<String, Void> KEY = ID.create("com.magento.idea.magento2plugin.stubs.indexes.event_name");
36+
private static final String GENERATED_METADATA_PATH_SEGMENT = "/generated/metadata/";
3637
private final KeyDescriptor<String> myKeyDescriptor = new EnumeratorStringDescriptor();
3738

3839
@NotNull
@@ -121,6 +122,7 @@ public KeyDescriptor<String> getKeyDescriptor() {
121122
public FileBasedIndex.InputFilter getInputFilter() {
122123
return file -> (
123124
file.getFileType() == PhpFileType.INSTANCE
125+
&& !file.getPath().contains(GENERATED_METADATA_PATH_SEGMENT)
124126
|| (file.getFileType() == XmlFileType.INSTANCE && file.getName().equals("events.xml"))
125127
);
126128
}
@@ -132,6 +134,6 @@ public boolean dependsOnFileContent() {
132134

133135
@Override
134136
public int getVersion() {
135-
return 1;
137+
return 2;
136138
}
137139
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.stubs.indexes;
6+
7+
import com.intellij.openapi.fileTypes.FileType;
8+
import com.intellij.openapi.vfs.VirtualFile;
9+
import com.intellij.testFramework.LightVirtualFile;
10+
import com.jetbrains.php.lang.PhpFileType;
11+
import org.junit.Test;
12+
13+
import static org.junit.Assert.assertFalse;
14+
import static org.junit.Assert.assertTrue;
15+
16+
public class EventNameIndexTest {
17+
18+
@Test
19+
public void generatedMetadataPhpFilesAreExcludedFromIndexing() {
20+
final EventNameIndex index = new EventNameIndex();
21+
final VirtualFile file = new PhpVirtualFile(
22+
"primary|global|webapi_rest|plugin-list.php",
23+
"//wsl.localhost/Ubuntu/home/pf/projects/mag/src/generated/metadata/"
24+
+ "primary|global|webapi_rest|plugin-list.php"
25+
);
26+
27+
assertFalse(index.getInputFilter().acceptInput(file));
28+
}
29+
30+
@Test
31+
public void regularPhpFilesRemainIndexable() {
32+
final EventNameIndex index = new EventNameIndex();
33+
final VirtualFile file = new PhpVirtualFile(
34+
"Block.php",
35+
"/var/www/magento/app/code/Vendor/Module/Block/Block.php"
36+
);
37+
38+
assertTrue(index.getInputFilter().acceptInput(file));
39+
}
40+
41+
private static final class PhpVirtualFile extends LightVirtualFile {
42+
private final String path;
43+
44+
private PhpVirtualFile(final String name, final String path) {
45+
super(name, PhpFileType.INSTANCE, "<?php");
46+
this.path = path;
47+
}
48+
49+
@Override
50+
public String getPath() {
51+
return path;
52+
}
53+
54+
@Override
55+
public FileType getFileType() {
56+
return PhpFileType.INSTANCE;
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)