apache / apache/netbeans

Cannot enable assertions in JavaFX

Open
#9,194 1 comment 0 reactions 0 assignees View on GitHub
JavaFX kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 28

### What happened

When you use Scenebuilder, it creates a skeleton controller class for the scene. The initialize method created by Scenebuilder generates several assert statements validating the state of the GUI variables. This is very useful to ensure the FXML and java class are in synch. The assert statement is default disabled in Java. You must put the -enableassertions option on the Java command.

[skeleton GetMasterPW.java](https://github.com/user-attachments/files/25138397/skeleton.GetMasterPW.java)

Unfortunately, when you go to the project properties/Run, the VM options are disabled with the warning, "One of Run/Debug/Profile Project actions has been modified and the Run panel cannot be safely edited."
It would be very useful if assert statements count be enabled somehow.

### Language / Project Type / NetBeans Component

_No response_

### How to reproduce

Create a JavaFX application with Maven. Create a FXML file using Scenebuilder. In Scenebuilder, go to View / Show sample controller skeleton.

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

No / Don't know

### Operating System

Windows 11 Home 25H2

### JDK

openjdk version "24.0.1" 2025-04-15

### Apache NetBeans packaging

Community provided installer

### Anything else

The problem occurs every time.

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

No

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a JavaFX Maven application in NetBeans 28, then inspect Project Properties > Run and the warning that disables VM options. Compare the generated Maven run configuration with the needed -enableassertions option. Done means assertions can be enabled for the relevant project actions and execute in the generated controller.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.