You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Purushottam Sinha (Jira)" <ji...@apache.org> on 2026/06/05 08:31:00 UTC

[jira] [Created] (FLINK-39860) Reduce ArchUnit violations: production code must not call @VisibleForTesting methods

Purushottam Sinha created FLINK-39860:
-----------------------------------------

             Summary: Reduce ArchUnit violations: production code must not call @VisibleForTesting methods
                 Key: FLINK-39860
                 URL: https://issues.apache.org/jira/browse/FLINK-39860
             Project: Flink
          Issue Type: Sub-task
          Components: Tests
            Reporter: Purushottam Sinha


The NO_CALLS_TO_VISIBLE_FOR_TESTING_METHODS rule in flink-architecture-tests-production (ApiAnnotationRules) is frozen with 23 grandfathered violations — production code calling @VisibleForTesting methods.
  
In all 23 cases the annotation is inaccurate: the target is genuinely invoked by production code, so the "test-only" marker misleads maintainers (it implies the method is safe to refactor/remove when it isn't). Fix is to remove the annotation from the 12 affected methods — no visibility or signature change.
  
Affected methods (flink-runtime unless noted):
   - BlobKey#getHash() — 5 callers (blob integrity checks)
   - TaskExecutorResourceUtils#generateDefaultSlotResourceProfile / #generateTotalAvailableResourceProfile — 4
   - EmbeddedLeaderService#grantLeadership() / #revokeLeadership() — 6 (called by EmbeddedHaServicesWithLeadershipControl)
   - SourceOperator#getSourceReader() — 2
   - CopyOnWriteStateMap#snapshotMapArrays(), ExecutionVertex#finishPartitionsIfNeeded(), DataSetMetaInfo#withNumRegisteredPartitions(), RecreateOnResetOperatorCoordinator.QuiesceableContext#quiesce(), MailboxProcessor#isDefaultActionAvailable() — 1 each
   - Lockable.LockableTypeSerializer#getElementSerializer() (flink-cep) — 1
  
After the fix the store file is empty; the freeze() wrapper is kept (an empty freeze store still fails any newly introduced violation).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)