';' gets inserted at wrong position when editing a single-line java lambda expression with enclosing {}
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 20 release candidate
### What happened
NB 20.
Was coding, tried to type ";" in the middle of a java lambda with enclosing {}, but caret automatically jumps to the end of the line and inserts ";" at wrong position.
### How to reproduce
Paste this code in IDE. Put caret just before "}" on the .filter line, type ';'.
Workaround: problem does not happen if the "}" is on the next line.
```java
public static void main(String[] args)
{
Pattern P_SHARP_SPT = Pattern.compile("#(\\w+)\\s+(.*)");
String s = Arrays.asList(args).stream()
.filter(l -> {var m=P_SHARP_SPT.matcher(l); return m.matches() && m.group(1).equals(spt.getName()) } )
.findAny()
.orElse(null);
}
```
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
WIN11
### JDK
JDK 17 x64 Adoptium
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
_No response_
### Are you willing to submit a pull request?
No
Contributor guide
Research direction
Reproduce the issue in Apache NetBeans 20 using the supplied Java lambda, with the caret immediately before the closing brace on the .filter line. Trace the Java editor behavior triggered when typing ';' in that position and compare it with the multiline-brace workaround. Done means the semicolon remains at the caret position for the single-line lambda without regressing normal Java editing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100