apache / apache/netbeans

Unable to unfold code block in java editor

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

Description

### Apache NetBeans version

Apache NetBeans 19

### What happened

When folding the if part of an if/else statement the if part becomes impossible to unfold. This only happens if the else is on the same line as the closing curly brace.

![image](https://github.com/apache/netbeans/assets/88770028/650db7a8-be4d-448e-bdff-4f45483059de)

![image](https://github.com/apache/netbeans/assets/88770028/052f19a3-d103-4fcb-bd54-c6357a74727c)

### How to reproduce

Just open a file with a if/else statement where the else is on the same line as the closing curly brace of the if.

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

No / Don't know

### Operating System

Fedora 38

### JDK

OpenJDK 64-Bit Server VM 11.0.20+8

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

_No response_

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

Yes

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in Apache NetBeans 19 using a Java if/else statement with else on the same line as the closing brace, then inspect the Java editor's code-folding behavior. Done means the folded if block can be unfolded reliably in that formatting case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.