apache / apache/netbeans

The "-source XX" and "-target XX" java compiler parameters should no longer be used in Ant project

Open
#9,429 0 comments 0 reactions 0 assignees View on GitHub
Ant Java kind:feature needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Description

In Ant project, NetBeans is still using obsolete "-source XX" and "-target XX" java compiler parameters. It does not guarantee the compatibility with the target version, because it does not use proper system modules for compilation. The **--release XX** parameter should be used instead. The compiler warning is clear.

_warning: [options] location of system modules is not set in conjunction with -source 11
not setting the location of system modules may lead to class files that cannot run on JDK 11
--release 11 is recommended instead of -source 11 -target 11 because it sets the location of system modules automatically_

### Use case/motivation

The "--release" parameter cannot be used in additional compiler options, because it collides with -target and -source parameters.

_error: option --source cannot be used together with --release
error: option --target cannot be used together with --release
Usage: javac
use --help for a list of possible options_

### Related issues

_No response_

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

No

Contributor guide

Open the contributing guide

Research direction

Start by locating where NetBeans assembles javac options for Ant projects and where the -source and -target values are added. Trace the compiler invocation and check how the requested target version is represented. Done means Ant builds use --release without conflicting source or target options and the system-module warning is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.