kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject [kafka] branch trunk updated: KAFKA-7399: KIP-366, Make FunctionConversions deprecated (#5562)
Date Wed, 19 Sep 2018 16:10:28 GMT
This is an automated email from the ASF dual-hosted git repository.

guozhang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new af80dcc  KAFKA-7399: KIP-366, Make FunctionConversions deprecated (#5562)
af80dcc is described below

commit af80dccc7dfb18c41d17d590a316cb6803294cbb
Author: Joan Goyeau <joan@goyeau.com>
AuthorDate: Wed Sep 19 17:10:15 2018 +0100

    KAFKA-7399: KIP-366, Make FunctionConversions deprecated (#5562)
    
    Reviewers: John Roesler <vvcephei@users.noreply.github.com>, Guozhang Wang <wangguoz@gmail.com>
---
 gradle/spotbugs-exclude.xml                                      | 6 ++++++
 .../org/apache/kafka/streams/scala/FunctionConversions.scala     | 9 +--------
 ...unctionConversions.scala => FunctionsCompatConversions.scala} | 7 ++-----
 .../org/apache/kafka/streams/scala/kstream/KGroupedStream.scala  | 2 +-
 .../org/apache/kafka/streams/scala/kstream/KGroupedTable.scala   | 2 +-
 .../scala/org/apache/kafka/streams/scala/kstream/KStream.scala   | 2 +-
 .../scala/org/apache/kafka/streams/scala/kstream/KTable.scala    | 2 +-
 .../kafka/streams/scala/kstream/SessionWindowedKStream.scala     | 2 +-
 .../apache/kafka/streams/scala/kstream/TimeWindowedKStream.scala | 2 +-
 9 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/gradle/spotbugs-exclude.xml b/gradle/spotbugs-exclude.xml
index 99a657e..d83c4c4 100644
--- a/gradle/spotbugs-exclude.xml
+++ b/gradle/spotbugs-exclude.xml
@@ -284,6 +284,12 @@ For a detailed description of spotbugs bug categories, see https://spotbugs.read
         <Bug pattern="EQ_UNUSUAL"/>
     </Match>
 
+    <Match>
+        <Package name="org.apache.kafka.streams.scala"/>
+        <Source name="FunctionsCompatConversions.scala"/>
+        <Bug pattern="EQ_UNUSUAL"/>
+    </Match>
+
 -    <Match>
         <Package name="org.apache.kafka.streams.scala"/>
         <Or>
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionConversions.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionConversions.scala
index 566ba22..26ba800 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionConversions.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionConversions.scala
@@ -24,14 +24,7 @@ import org.apache.kafka.streams.kstream._
 import scala.collection.JavaConverters._
 import java.lang.{Iterable => JIterable}
 
-/**
- * Implicit classes that offer conversions of Scala function literals to
- * SAM (Single Abstract Method) objects in Java. These make the Scala APIs much
- * more expressive, with less boilerplate and more succinct.
- * <p>
- * For Scala 2.11, most of these conversions need to be invoked explicitly, as Scala 2.11
does not
- * have full support for SAM types.
- */
+@deprecated("This object is for internal use only", since = "2.1.0")
 object FunctionConversions {
 
   implicit private[scala] class ForeachActionFromFunction[K, V](val p: (K, V) => Unit)
extends AnyVal {
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionConversions.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionsCompatConversions.scala
similarity index 95%
copy from streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionConversions.scala
copy to streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionsCompatConversions.scala
index 566ba22..754f1cc 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionConversions.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/FunctionsCompatConversions.scala
@@ -1,7 +1,4 @@
 /*
- * Copyright (C) 2018 Lightbend Inc. <https://www.lightbend.com>
- * Copyright (C) 2017-2018 Alexis Seigneurin.
- *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -32,9 +29,9 @@ import java.lang.{Iterable => JIterable}
  * For Scala 2.11, most of these conversions need to be invoked explicitly, as Scala 2.11
does not
  * have full support for SAM types.
  */
-object FunctionConversions {
+private[scala] object FunctionsCompatConversions {
 
-  implicit private[scala] class ForeachActionFromFunction[K, V](val p: (K, V) => Unit)
extends AnyVal {
+  implicit class ForeachActionFromFunction[K, V](val p: (K, V) => Unit) extends AnyVal
{
     def asForeachAction: ForeachAction[K, V] = new ForeachAction[K, V] {
       override def apply(key: K, value: V): Unit = p(key, value)
     }
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedStream.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedStream.scala
index 5d0f05e..5168805 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedStream.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedStream.scala
@@ -22,7 +22,7 @@ package kstream
 
 import org.apache.kafka.streams.kstream.{KGroupedStream => KGroupedStreamJ, _}
 import org.apache.kafka.streams.scala.ImplicitConversions._
-import org.apache.kafka.streams.scala.FunctionConversions._
+import org.apache.kafka.streams.scala.FunctionsCompatConversions._
 
 /**
  * Wraps the Java class KGroupedStream and delegates method calls to the underlying Java
object.
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedTable.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedTable.scala
index 56f84e3..54b1e1f 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedTable.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KGroupedTable.scala
@@ -22,7 +22,7 @@ package kstream
 
 import org.apache.kafka.streams.kstream.{KGroupedTable => KGroupedTableJ, _}
 import org.apache.kafka.streams.scala.ImplicitConversions._
-import org.apache.kafka.streams.scala.FunctionConversions._
+import org.apache.kafka.streams.scala.FunctionsCompatConversions._
 
 /**
  * Wraps the Java class KGroupedTable and delegates method calls to the underlying Java object.
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala
index 8e4c9aa..d54ac5a 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KStream.scala
@@ -24,7 +24,7 @@ import org.apache.kafka.streams.KeyValue
 import org.apache.kafka.streams.kstream.{KStream => KStreamJ, _}
 import org.apache.kafka.streams.processor.{Processor, ProcessorSupplier, TopicNameExtractor}
 import org.apache.kafka.streams.scala.ImplicitConversions._
-import org.apache.kafka.streams.scala.FunctionConversions._
+import org.apache.kafka.streams.scala.FunctionsCompatConversions._
 
 import scala.collection.JavaConverters._
 
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KTable.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KTable.scala
index d41496f..881c8e0 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KTable.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/KTable.scala
@@ -24,7 +24,7 @@ import org.apache.kafka.common.serialization.Serde
 import org.apache.kafka.common.utils.Bytes
 import org.apache.kafka.streams.kstream.{KTable => KTableJ, _}
 import org.apache.kafka.streams.scala.ImplicitConversions._
-import org.apache.kafka.streams.scala.FunctionConversions._
+import org.apache.kafka.streams.scala.FunctionsCompatConversions._
 import org.apache.kafka.streams.state.KeyValueStore
 
 /**
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/SessionWindowedKStream.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/SessionWindowedKStream.scala
index a602767..6571df9 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/SessionWindowedKStream.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/SessionWindowedKStream.scala
@@ -22,7 +22,7 @@ package kstream
 
 import org.apache.kafka.streams.kstream.{SessionWindowedKStream => SessionWindowedKStreamJ,
_}
 import org.apache.kafka.streams.scala.ImplicitConversions._
-import org.apache.kafka.streams.scala.FunctionConversions._
+import org.apache.kafka.streams.scala.FunctionsCompatConversions._
 
 /**
  * Wraps the Java class SessionWindowedKStream and delegates method calls to the underlying
Java object.
diff --git a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/TimeWindowedKStream.scala
b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/TimeWindowedKStream.scala
index c54ba4f..d84416e 100644
--- a/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/TimeWindowedKStream.scala
+++ b/streams/streams-scala/src/main/scala/org/apache/kafka/streams/scala/kstream/TimeWindowedKStream.scala
@@ -22,7 +22,7 @@ package kstream
 
 import org.apache.kafka.streams.kstream.{TimeWindowedKStream => TimeWindowedKStreamJ,
_}
 import org.apache.kafka.streams.scala.ImplicitConversions._
-import org.apache.kafka.streams.scala.FunctionConversions._
+import org.apache.kafka.streams.scala.FunctionsCompatConversions._
 
 /**
  * Wraps the Java class TimeWindowedKStream and delegates method calls to the underlying
Java object.


Mime
View raw message