-
Notifications
You must be signed in to change notification settings - Fork 917
Description
Body
I noticed, that when I created a test.java file in my tmp directory, NetBeans suddenly started a massive scanning job. It turned out NetBeans scanned the whole folder, which also included an angular project with ~30.000 files in the node_modules folder. What is more, I noticed, that other projects in the folder were marked as broken.
My gut feeling led me to the changes for the mult-file source launcher and indeed it has problematic side effect. I could reproduce it like this:
-
Checkout babcc3d (current master), clean dir and build NB and run with "ant tryme"
-
Create an empty directory (PATH in the following)
-
Inside the new directory create a new maven project ("Java with Maven -> Java Application", with default settings, just parent folder changed to PATH)
-
Add
gsonto thepom.xml(as child element of theprojectnode):<dependencies> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.10.1</version> </dependency> </dependencies>
-
Ensure dependency is locally present by invoking "Download Declared Dependencies" on the "Dependencies" node
-
Change class Mavenproject1 to:
package test.mavenproject1; import com.google.gson.Gson; import java.util.Collections; public class Mavenproject1 { public static void main(String[] args) { new Gson().toJson(Collections.singletonMap("Hello", "World")); } }
-
Open Favorites tab and create test.java in the directory created in step 1
Mavenproject1.java is immediately marked as "has errors
- Open "Window -> Action Items" and open
Mavenproject1.java
You'll see:
Error Package com.google.gson ist nicht vorhanden Mavenproject1.java PATH/mavenproject1/src/main/java/test/mavenproject1/Mavenproject1.java:3
Error Symbol nicht gefunden Symbol: Klasse Gson Ort: Klasse test.mavenproject1.Mavenproject1 Mavenproject1.java PATH/mavenproject1/src/main/java/test/mavenproject1/Mavenproject1.java:9
- Remove the directory
- Revert multi-file launcher:
git revert 192bb526a9f535485905998674460c1aaafb9b20
git rm java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/SharedRootData.java java/java.file.launcher/src/org/netbeans/modules/java/file/launcher/queries/MultiSourceRootProvider.java
git revert --continue- Build again with
git clean -f -x -d; ant - Run with
ant try - Repeat steps 2-7 and observe, that problems are gone
Committer
- I acknowledge that I am a maintainer/committer in the Apache NetBeans project.