Skip to content

[api] Remove dead no-arg getExecutionEnvironment() referencing a non-existent LocalExecutionEnvironment#848

Merged
wenjin272 merged 1 commit into
apache:mainfrom
weiqingy:847-fix-java-local-env-stub
Jun 15, 2026
Merged

[api] Remove dead no-arg getExecutionEnvironment() referencing a non-existent LocalExecutionEnvironment#848
wenjin272 merged 1 commit into
apache:mainfrom
weiqingy:847-fix-java-local-env-stub

Conversation

@weiqingy

@weiqingy weiqingy commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Linked issue: #847

Purpose of change

AgentsExecutionEnvironment.getExecutionEnvironment() (no-arg) and the env == null branch of the two-arg overload reflectively loaded org.apache.flink.agents.runtime.env.LocalExecutionEnvironment — a class that has never existed in the tree or in git history (the runtime env/ package ships only RemoteExecutionEnvironment). So both paths could only throw RuntimeException at runtime, while the Javadoc promised "a local execution environment for testing and development." It went unnoticed because no Java code calls the no-arg form, but these are public API methods, so a user following the Javadoc would hit an obscure failure.

This removes the no-arg overload and the dead env == null branch, and requires a non-null StreamExecutionEnvironment (fail-fast checkNotNull) — Java agents always run on a Flink environment.

Cross-language parity note: Python's get_execution_environment(env=None) still returns a working in-process local environment. This change makes Java explicitly remote-only, which only surfaces an asymmetry that already existed (the Java no-arg form threw). Whether Python's local path should change too is being evaluated separately in #829. If maintainers would rather keep Java↔Python parity, the alternative is to keep the no-arg signature and implement a real Java local environment — happy to take that direction instead.

Tests

New AgentsExecutionEnvironmentTest asserts a null StreamExecutionEnvironment is rejected on both overloads. The full api suite passes (264 tests) and a full-reactor mvn test-compile succeeds, confirming no caller relied on the removed method.

API

Yes. Removes the public static no-arg getExecutionEnvironment() and makes the env parameter required. Safe because the removed method could only throw and had no callers; the project is pre-1.0 (0.3-SNAPSHOT).

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions Bot added doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. and removed doc-not-needed Your PR changes do not impact docs labels Jun 14, 2026
…existent LocalExecutionEnvironment

The no-arg getExecutionEnvironment() and the env==null branch of the two-arg
overload reflectively loaded
org.apache.flink.agents.runtime.env.LocalExecutionEnvironment, a class that does
not exist (the runtime env/ package ships only RemoteExecutionEnvironment) and
never existed in git history. Both paths could therefore only throw at runtime,
while the Javadoc promised a local execution environment for testing.

No Java code calls the no-arg form; every example and test passes a real
StreamExecutionEnvironment. Remove the no-arg overload and the dead branch, and
require a non-null StreamExecutionEnvironment (fail-fast). Java agents always run
on a Flink environment.
@weiqingy weiqingy force-pushed the 847-fix-java-local-env-stub branch from 07915d4 to 20396f8 Compare June 14, 2026 06:44

@wenjin272 wenjin272 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wenjin272 wenjin272 merged commit 38f8b66 into apache:main Jun 15, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants