Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复因编译器不一致导致,识别不了Java新特性的代码 #833

Open
wants to merge 1 commit into
base: 6.1.1-post
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,39 @@
<!-- TODO -->
<suppress
checks="(BooleanExpressionComplexity)"
files="(KafkaRestConfig).java"
files="(KafkaRestConfig|GetReassignmentAction).java"
/>

<suppress
checks="(CyclomaticComplexity)"
files="(AvroConverter|SchemaRestProducer|ConsumerInstanceConfig|ConsumerManager|ConsumerReadTask|KafkaConsumerManager|PartitionOffset|KafkaRestContextProvider).java"
files="(AvroConverter|SchemaRestProducer|ConsumerInstanceConfig|ConsumerManager|ConsumerReadTask|KafkaConsumerManager|PartitionOffset|KafkaRestContextProvider|GetReassignmentAction).java"
/>

<suppress
checks="(ClassDataAbstractionCoupling)"
files="(AvroConverter|ConsumerManager|KafkaConsumerManager|KafkaRestApplication|SimpleConsumerManager|KafkaRestContextProvider|KafkaConsumerState|ProducerPool|TopicsResource).java"
files="(AvroConverter|ConsumerManager|KafkaConsumerManager|KafkaRestApplication|SimpleConsumerManager|KafkaRestContextProvider|KafkaConsumerState|ProducerPool|TopicsResource|GetReassignmentAction).java"
/>

<suppress
checks="(ClassFanOutComplexity)"
files="(ConsumerManager|KafkaConsumerState).java"
files="(ConsumerManager|KafkaConsumerState|GetReassignmentAction).java"
/>

<suppress
checks="(JavaNCSS)"
files="(ConsumerManager|KafkaConsumerManager).java"
files="(ConsumerManager|KafkaConsumerManager|GetReassignmentAction).java"
/>

<suppress
checks="(NPathComplexity)"
files="(SchemaRestProducer|ConsumerInstanceConfig|ConsumerManager|KafkaConsumerManager|PartitionOffset|KafkaRestContextProvider).java"
files="(SchemaRestProducer|ConsumerInstanceConfig|ConsumerManager|KafkaConsumerManager|PartitionOffset|KafkaRestContextProvider|GetReassignmentAction).java"
/>
<suppress
checks="(MethodLength)"
files="(KafkaRestConfig).java"
files="(KafkaRestConfig|GetReassignmentAction).java"
/>
<suppress
checks="(ParameterNumber)"
files="(ClusterData).java"
files="(ClusterData|GetReassignmentAction).java"
/>
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import io.confluent.kafkarest.extension.ResourceBlocklistFeature.ResourceName;
import io.confluent.kafkarest.resources.AsyncResponses;
import io.confluent.rest.annotations.PerformanceMetric;
import io.confluent.rest.exceptions.RestException;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -79,7 +81,7 @@ public void getPartition(
CompletableFuture<GetPartitionResponse> response =
partitionManager.get()
.getLocalPartition(topic, partitionId)
.thenApply(partition -> partition.orElseThrow(Errors::partitionNotFoundException))
.thenApply(partition -> partition.<RestException>orElseThrow(() -> Errors.partitionNotFoundException()))
.thenApply(GetPartitionResponse::fromPartition);

AsyncResponses.asyncResume(asyncResponse, response);
Expand All @@ -103,7 +105,7 @@ public void getOffsets(
CompletableFuture<TopicPartitionOffsetResponse> response =
partitionManager.get()
.getLocalPartition(topic, partitionId)
.thenApply(partition -> partition.orElseThrow(Errors::partitionNotFoundException))
.thenApply(partition -> partition.<RestException>orElseThrow(() -> Errors.partitionNotFoundException()))
.thenApply(
partition ->
new TopicPartitionOffsetResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import io.confluent.kafkarest.extension.ResourceBlocklistFeature.ResourceName;
import io.confluent.kafkarest.resources.AsyncResponses;
import io.confluent.rest.annotations.PerformanceMetric;
import io.confluent.rest.exceptions.RestException;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -80,7 +82,7 @@ public void getTopic(

CompletableFuture<Topic> topicFuture =
topicManager.getLocalTopic(topicName)
.thenApply(topic -> topic.orElseThrow(Errors::topicNotFoundException));
.thenApply(topic -> topic.<RestException>orElseThrow(() -> Errors.topicNotFoundException()));
CompletableFuture<GetTopicResponse> response =
topicFuture.thenCompose(
topic -> topicConfigManager.listTopicConfigs(topic.getClusterId(), topicName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void getBrokerConfig(
CompletableFuture<GetBrokerConfigResponse> response =
brokerConfigManager.get()
.getBrokerConfig(clusterId, brokerId, name)
.thenApply(broker -> broker.orElseThrow(NotFoundException::new))
.thenApply(broker -> broker.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(broker -> GetBrokerConfigResponse.create(toBrokerConfigData(broker)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void getBroker(
CompletableFuture<GetBrokerResponse> response =
brokerManager.get()
.getBroker(clusterId, brokerId)
.thenApply(broker -> broker.orElseThrow(NotFoundException::new))
.thenApply(broker -> broker.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(broker -> GetBrokerResponse.create(toBrokerData(broker)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void getClusterConfig(
CompletableFuture<GetClusterConfigResponse> response =
clusterConfigManager.get()
.getClusterConfig(clusterId, configType, name)
.thenApply(config -> config.orElseThrow(NotFoundException::new))
.thenApply(config -> config.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(config -> GetClusterConfigResponse.create(toClusterConfigData(config)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void getCluster(
CompletableFuture<GetClusterResponse> response =
clusterManager.get()
.getCluster(clusterId)
.thenApply(cluster -> cluster.orElseThrow(NotFoundException::new))
.thenApply(cluster -> cluster.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(cluster -> GetClusterResponse.create(toClusterData(cluster)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void getConsumerAssignment(
CompletableFuture<GetConsumerAssignmentResponse> response =
consumerAssignmentManager.get()
.getConsumerAssignment(clusterId, consumerGroupId, consumerId, topicName, partitionId)
.thenApply(assignment -> assignment.orElseThrow(NotFoundException::new))
.thenApply(assignment -> assignment.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(
assignment ->
GetConsumerAssignmentResponse.create(toConsumerAssignmentData(assignment)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void getConsumerGroup(
CompletableFuture<GetConsumerGroupResponse> response =
consumerGroupManager.get()
.getConsumerGroup(clusterId, consumerGroupId)
.thenApply(consumerGroup -> consumerGroup.orElseThrow(NotFoundException::new))
.thenApply(consumerGroup -> consumerGroup.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(
consumerGroup ->
GetConsumerGroupResponse.create(toConsumerGroupData(clusterId, consumerGroup)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void getConsumer(
CompletableFuture<GetConsumerResponse> response =
consumerManager.get()
.getConsumer(clusterId, consumerGroupId, consumerId)
.thenApply(consumer -> consumer.orElseThrow(NotFoundException::new))
.thenApply(consumer -> consumer.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(
consumer -> GetConsumerResponse.create(toConsumerData(consumer)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void getReassignment(
@PathParam("partitionId") Integer partitionId) {
CompletableFuture<GetReassignmentResponse> response =
reassignmentManager.get().getReassignment(clusterId, topicName, partitionId)
.thenApply(reassignment -> reassignment.orElseThrow(NotFoundException::new))
.thenApply(reassignment -> reassignment.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(
reassignment -> GetReassignmentResponse.create(toReassignmentData(reassignment)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void getPartition(
CompletableFuture<GetPartitionResponse> response =
partitionManager.get()
.getPartition(clusterId, topicName, partitionId)
.thenApply(partition -> partition.orElseThrow(NotFoundException::new))
.thenApply(partition -> partition.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(partition -> GetPartitionResponse.create(toPartitionData(partition)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void getReplica(
CompletableFuture<GetReplicaResponse> response =
replicaManager.get()
.getReplica(clusterId, topicName, partitionId, brokerId)
.thenApply(replica -> replica.orElseThrow(NotFoundException::new))
.thenApply(replica -> replica.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(replica -> GetReplicaResponse.create(toReplicaData(replica)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void getTopicConfig(
CompletableFuture<GetTopicConfigResponse> response =
topicConfigManager.get()
.getTopicConfig(clusterId, topicName, name)
.thenApply(topic -> topic.orElseThrow(NotFoundException::new))
.thenApply(topic -> topic.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(topic -> GetTopicConfigResponse.create(toTopicConfigData(topic)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public void getTopic(
CompletableFuture<GetTopicResponse> response =
topicManager.get()
.getTopic(clusterId, topicName)
.thenApply(topic -> topic.orElseThrow(NotFoundException::new))
.thenApply(topic -> topic.<NotFoundException>orElseThrow(() -> new NotFoundException()))
.thenApply(topic -> GetTopicResponse.create(toTopicData(topic)));

AsyncResponses.asyncResume(asyncResponse, response);
Expand Down