[
https://issues.apache.org/jira/browse/FLINK-41372?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Martijn Visser reassigned FLINK-41372:
--------------------------------------
Assignee: Younes Mahmoudi
> [Docs] Document disabling "Use '--release' option" in IntelliJ to prevent
> javac failure with --add-exports
> ----------------------------------------------------------------------------------------------------------
>
> Key: FLINK-41372
> URL: https://issues.apache.org/jira/browse/FLINK-41372
> Project: Flink
> Issue Type: Improvement
> Components: Build System, Documentation
> Environment: First observed on macOS with IntelliJ IDEA 2026.2; the
> 4-case matrix below was then reproduced systematically on Linux (Manjaro).
> The failure is therefore OS-independent: it stems from {{javac}} / JEP 247
> behavior, not the platform.
> - Git Commit: 6e194b0167e (master)
> - OS: Linux 6.12.112-1-MANJARO x86_64
> - IDE: IntelliJ IDEA 2026.2 (Ultimate Edition) - Build #IU-262.8665.258
> - SDK: OpenJDK 64-Bit Server VM (build 21.0.12.1 & 17.0.20.1+1)
> Reporter: Younes Mahmoudi
> Assignee: Younes Mahmoudi
> Priority: Minor
> Labels: build, documentation, intellij
>
> h3. Problem Description
> When importing and compiling Apache Flink in modern versions of IntelliJ IDEA
> (e.g., 2026.x), the compilation fails for modules relying on internal JVM
> packages (such as flink-annotations and flink-test-utils-junit).
> Example compiler errors:
> {code}
> java: exporting a package from system module java.management is not allowed
> with --release
> java: exporting a package from system module java.rmi is not allowed with
> --release
> java: exporting a package from system module java.security.jgss is not
> allowed with --release
> {code}
> h3. Technical Root Cause
> # *Flink Build Configuration:* Certain modules configure {{--add-exports}} in
> their {{pom.xml}} files (e.g., {{--add-exports
> java.management/...=ALL-UNNAMED}}) to access internal APIs.
> # *Javac Specification (JEP 247):* When {{--release N}} is supplied to
> {{javac}}, the compiler enforces cross-compilation against the documented
> platform signature ({{ct.sym}}) and strictly disallows package exports via
> {{--add-exports}}.
> # *IntelliJ Default Behavior:* Recent versions of IntelliJ IDEA enable "Use
> '--release' option for cross-compilation" by default under {{Settings ->
> Build, Execution, Deployment -> Compiler -> Java Compiler}}. This flag
> collision causes {{javac}} to fail.
> h3. Test Verification Matrix
> || # || Project SDK || Maven Profiles || "Use '--release' option..." ||
> Result ||
> | 1 | JDK 21 | IntelliJ defaults | Checked (Default) | FAILED (exporting
> package not allowed with {{--release}}) |
> | 2 | JDK 21 | IntelliJ defaults | Unchecked | SUCCESS ({{MemorySizeTest}}
> passed, exit code 0) |
> | 3 | JDK 21 | {{java21-target}} & {{java21}} | Checked | SUCCESS (Flink
> target profiles override properly) |
> | 4 | JDK 17 | IntelliJ defaults | Checked | FAILED (Exact same collision) |
> h3. Proposed Resolution
> Update the documentation in DEVELOPMENT.md (and
> docs/content/docs/flinkDev/ide_setup.md):
> * Explicitly instruct developers to uncheck "Use '--release' option for
> cross-compilation" under Settings | Build, Execution, Deployment | Compiler |
> Java Compiler, OR activate the respective target profile (e.g. java21-target).
> I am ready to submit a documentation PR for this once approved.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)