apache / apache/netbeans

ConcurrentModificationException in TestMethodController

Open
#5,148 0 comments 0 reactions 0 assignees View on GitHub
FormDesigner Java kind:bug
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 16

### What happened

probably related to #4608

```
java.util.ConcurrentModificationException
at java.base/java.util.ArrayList.forEach(ArrayList.java:1513)
at org.netbeans.modules.gsf.testrunner.ui.api.TestMethodController.setTestMethodsImpl(TestMethodController.java:67)
at org.netbeans.modules.gsf.testrunner.ui.api.TestMethodController.lambda$setTestMethods$0(TestMethodController.java:44)
at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:296)
at org.openide.text.NbDocument.runAtomic(NbDocument.java:411)
at org.netbeans.modules.gsf.testrunner.ui.api.TestMethodController.setTestMethods(TestMethodController.java:43)
at org.netbeans.modules.java.testrunner.ui.ComputeTestMethodsImpl$TaskImpl.lambda$run$0(ComputeTestMethodsImpl.java:106)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
```

### How to reproduce

- Create new JFrame Form component
- Create another new JFrame Form component
- For each form do as follows:
- In the navigator window select the root element (Form)
- In the properties window deselect "Generate Full Classnames" option
- click on source tab
- delete the remaining fully classified names one by one (e.g. javax.swing.JFrame -> JFrame) and add the impor using hint
- save changes and get back to design mode

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 10 version 10.0 running on amd64; UTF-8; en_US (nb)

### JDK

OpenJDK 64-Bit Server VM 18.0.2+9-61

### Apache NetBeans packaging

Apache NetBeans provided installer

### Anything else

Product Version: Apache NetBeans IDE 16
Java: 18.0.2; OpenJDK 64-Bit Server VM 18.0.2+9-61
Runtime: OpenJDK Runtime Environment 18.0.2+9-61
System: Windows 10 version 10.0 running on amd64; UTF-8; en_US (nb)

### Are you willing to submit a pull request?

No

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start with TestMethodController.setTestMethodsImpl at line 67 and follow the call from ComputeTestMethodsImpl.TaskImpl.run shown in the stack trace. Reproduce the two-JFrame workflow and verify that it no longer raises ConcurrentModificationException while updating test methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.