You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2021/11/26 08:56:09 UTC

[flink] 02/03: [FLINK-25063][tests] Allow @VisibleForTesting calls from enclosing class

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 481bb718c526b18ca92dff4659ae10e1f781dd8d
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Thu Nov 25 15:47:04 2021 +0100

    [FLINK-25063][tests] Allow @VisibleForTesting calls from enclosing class
---
 .../org/apache/flink/architecture/rules/ApiAnnotationRules.java     | 6 ++++++
 .../violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5                 | 5 -----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java b/flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java
index 9f7078a..1402612 100644
--- a/flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java
+++ b/flink-architecture-tests/src/test/java/org/apache/flink/architecture/rules/ApiAnnotationRules.java
@@ -148,6 +148,12 @@ public class ApiAnnotationRules {
                                                             .orElse(false)) {
                                                 return false;
                                             }
+                                            if (targetOwner
+                                                    .getEnclosingClass()
+                                                    .map(originOwner::equals)
+                                                    .orElse(false)) {
+                                                return false;
+                                            }
 
                                             return call.getTarget()
                                                     .isAnnotatedWith(VisibleForTesting.class);
diff --git a/flink-architecture-tests/violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5 b/flink-architecture-tests/violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
index f5e3ff0..67bd28c 100644
--- a/flink-architecture-tests/violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
+++ b/flink-architecture-tests/violations/e5126cae-f3fe-48aa-b6fb-60ae6cc3fcd5
@@ -1,4 +1,3 @@
-Constructor <org.apache.flink.runtime.scheduler.exceptionhistory.ExceptionHistoryEntry.<init>(java.lang.Throwable, long, java.lang.String, org.apache.flink.runtime.taskmanager.TaskManagerLocation)> calls method <org.apache.flink.runtime.scheduler.exceptionhistory.ExceptionHistoryEntry$ArchivedTaskManagerLocation.fromTaskManagerLocation(org.apache.flink.runtime.taskmanager.TaskManagerLocation)> in (ExceptionHistoryEntry.java:90)
 Constructor <org.apache.flink.runtime.state.heap.CopyOnWriteStateMapSnapshot.<init>(org.apache.flink.runtime.state.heap.CopyOnWriteStateMap)> calls method <org.apache.flink.runtime.state.heap.CopyOnWriteStateMap.snapshotMapArrays()> in (CopyOnWriteStateMapSnapshot.java:86)
 Constructor <org.apache.flink.streaming.api.operators.StreamingRuntimeContext.<init>(org.apache.flink.streaming.api.operators.AbstractStreamOperator, org.apache.flink.runtime.execution.Environment, java.util.Map)> calls method <org.apache.flink.streaming.api.operators.AbstractStreamOperator.getProcessingTimeService()> in (StreamingRuntimeContext.java:85)
 Constructor <org.apache.flink.streaming.runtime.io.StreamTaskExternallyInducedSourceInput.<init>(org.apache.flink.streaming.api.operators.SourceOperator, java.util.function.Consumer, int, int)> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getSourceReader()> in (StreamTaskExternallyInducedSourceInput.java:39)
@@ -31,7 +30,6 @@ Method <org.apache.flink.runtime.io.network.partition.consumer.RemoteInputChanne
 Method <org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator$DeferrableCoordinator.closeAsync(long)> calls method <org.apache.flink.runtime.operators.coordination.RecreateOnResetOperatorCoordinator$QuiesceableContext.quiesce()> in (RecreateOnResetOperatorCoordinator.java:319)
 Method <org.apache.flink.runtime.state.heap.HeapKeyedStateBackend.numKeyValueStateEntries(java.lang.Object)> calls method <org.apache.flink.runtime.state.heap.StateTable.sizeOfNamespace(java.lang.Object)> in (HeapKeyedStateBackend.java:391)
 Method <org.apache.flink.runtime.state.heap.StateTable.sizeOfNamespace(java.lang.Object)> calls method <org.apache.flink.runtime.state.heap.StateMap.sizeOfNamespace(java.lang.Object)> in (StateTable.java:361)
-Method <org.apache.flink.runtime.taskexecutor.TaskExecutor.registerNewJobAndCreateServices(org.apache.flink.api.common.JobID, java.lang.String)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutor$TaskExecutorJobServices.create(org.apache.flink.runtime.execution.librarycache.LibraryCacheManager$ClassLoaderLease, java.lang.Runnable)> in (TaskExecutor.java:1121)
 Method <org.apache.flink.runtime.taskexecutor.TaskManagerConfiguration.fromConfiguration(org.apache.flink.configuration.Configuration, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, java.lang.String)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateDefaultSlotResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, int)> in (TaskManagerConfiguration.java:236)
 Method <org.apache.flink.runtime.taskexecutor.TaskManagerConfiguration.fromConfiguration(org.apache.flink.configuration.Configuration, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, java.lang.String)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateTotalAvailableResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec)> in (TaskManagerConfiguration.java:238)
 Method <org.apache.flink.runtime.taskexecutor.TaskManagerServices.createTaskSlotTable(int, org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, long, int, java.util.concurrent.Executor)> calls method <org.apache.flink.runtime.taskexecutor.TaskExecutorResourceUtils.generateDefaultSlotResourceProfile(org.apache.flink.runtime.taskexecutor.TaskExecutorResourceSpec, int)> in (TaskManagerServices.java:387)
@@ -42,13 +40,10 @@ Method <org.apache.flink.streaming.api.operators.InternalTimeServiceManagerImpl.
 Method <org.apache.flink.streaming.api.operators.SourceOperator$1$1.asClassLoader()> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getRuntimeContext()> in (SourceOperator.java:250)
 Method <org.apache.flink.streaming.api.operators.SourceOperator$1$1.registerReleaseHookIfAbsent(java.lang.String, java.lang.Runnable)> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getRuntimeContext()> in (SourceOperator.java:256)
 Method <org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer.getTransactionCoordinatorId()> calls method <org.apache.flink.streaming.connectors.kafka.internals.FlinkKafkaInternalProducer.getTransactionCoordinatorId()> in (FlinkKafkaProducer.java:1327)
-Method <org.apache.flink.streaming.connectors.kafka.internals.KafkaShuffleFetcher.partitionConsumerRecordsHandler(java.util.List, org.apache.flink.streaming.connectors.kafka.internals.KafkaTopicPartitionState)> calls method <org.apache.flink.streaming.connectors.kafka.internals.KafkaShuffleFetcher$KafkaShuffleElementDeserializer.deserialize(org.apache.kafka.clients.consumer.ConsumerRecord)> in (KafkaShuffleFetcher.java:108)
 Method <org.apache.flink.streaming.runtime.tasks.SourceOperatorStreamTask.init()> calls method <org.apache.flink.streaming.api.operators.SourceOperator.getSourceReader()> in (SourceOperatorStreamTask.java:72)
 Method <org.apache.flink.streaming.runtime.tasks.StreamTask.isMailboxLoopRunning()> calls method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.isMailboxLoopRunning()> in (StreamTask.java:801)
 Method <org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxStep()> calls method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxStep()> in (StreamTask.java:796)
 Method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxExecutorImpl.isIdle()> calls method <org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.isDefaultActionAvailable()> in (MailboxExecutorImpl.java:63)
-Method <org.apache.flink.table.catalog.CatalogManager.getPermanentTable(org.apache.flink.table.catalog.ObjectIdentifier)> calls method <org.apache.flink.table.catalog.CatalogManager$TableLookupResult.permanent(org.apache.flink.table.catalog.Catalog, org.apache.flink.table.catalog.ResolvedCatalogBaseTable)> in (CatalogManager.java:428)
-Method <org.apache.flink.table.catalog.CatalogManager.getTable(org.apache.flink.table.catalog.ObjectIdentifier)> calls method <org.apache.flink.table.catalog.CatalogManager$TableLookupResult.temporary(org.apache.flink.table.catalog.ResolvedCatalogBaseTable)> in (CatalogManager.java:394)
 Method <org.apache.flink.table.catalog.hive.util.HiveTableUtil.instantiateHiveTable(org.apache.flink.table.catalog.ObjectPath, org.apache.flink.table.catalog.CatalogBaseTable, org.apache.hadoop.hive.conf.HiveConf)> calls method <org.apache.flink.table.catalog.hive.HiveCatalog.isHiveTable(java.util.Map)> in (HiveTableUtil.java:379)
 Method <org.apache.flink.table.data.writer.BinaryArrayWriter.getSegments()> calls method <org.apache.flink.table.data.writer.AbstractBinaryWriter.getSegments()> in (BinaryArrayWriter.java:30)
 Method <org.apache.flink.table.data.writer.BinaryRowWriter.getSegments()> calls method <org.apache.flink.table.data.writer.AbstractBinaryWriter.getSegments()> in (BinaryRowWriter.java:27)