mirror of https://github.com/apache/kafka.git
MINOR: Update Scalafmt to latest version (#12475)
Reviewers: Divij Vaidya <diviv@amazon.com>, Chris Egerton <fearthecellos@gmail.com>
This commit is contained in:
parent
b449b8032e
commit
e138772ba5
|
@ -30,7 +30,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.diffplug.spotless' version '5.12.5'
|
id 'com.diffplug.spotless' version '6.10.0'
|
||||||
id 'com.github.ben-manes.versions' version '0.42.0'
|
id 'com.github.ben-manes.versions' version '0.42.0'
|
||||||
id 'idea'
|
id 'idea'
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
|
@ -47,7 +47,7 @@ plugins {
|
||||||
spotless {
|
spotless {
|
||||||
scala {
|
scala {
|
||||||
target 'streams/**/*.scala'
|
target 'streams/**/*.scala'
|
||||||
scalafmt("$versions.scalafmt").configFile('checkstyle/.scalafmt.conf')
|
scalafmt("$versions.scalafmt").configFile('checkstyle/.scalafmt.conf').scalaMajorVersion(versions.baseScala)
|
||||||
licenseHeaderFile 'checkstyle/java.header', 'package'
|
licenseHeaderFile 'checkstyle/java.header', 'package'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,10 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
docstrings = JavaDoc
|
version = 3.5.9
|
||||||
|
runner.dialect = scala213
|
||||||
|
docstrings.style = Asterisk
|
||||||
|
docstrings.wrap = false
|
||||||
maxColumn = 120
|
maxColumn = 120
|
||||||
continuationIndent.defnSite = 2
|
continuationIndent.defnSite = 2
|
||||||
assumeStandardLibraryStripMargin = true
|
assumeStandardLibraryStripMargin = true
|
||||||
|
|
|
@ -111,7 +111,10 @@ versions += [
|
||||||
reload4j: "1.2.19",
|
reload4j: "1.2.19",
|
||||||
rocksDB: "6.29.4.1",
|
rocksDB: "6.29.4.1",
|
||||||
scalaCollectionCompat: "2.6.0",
|
scalaCollectionCompat: "2.6.0",
|
||||||
scalafmt: "2.7.5",
|
// When updating the scalafmt version please also update the version field in checkstyle/.scalafmt.conf. scalafmt now
|
||||||
|
// has the version field as mandatory in its configuration, see
|
||||||
|
// https://github.com/scalameta/scalafmt/releases/tag/v3.1.0.
|
||||||
|
scalafmt: "3.5.9",
|
||||||
scalaJava8Compat : "1.0.2",
|
scalaJava8Compat : "1.0.2",
|
||||||
scoverage: "1.4.11",
|
scoverage: "1.4.11",
|
||||||
slf4j: "1.7.36",
|
slf4j: "1.7.36",
|
||||||
|
|
|
@ -24,9 +24,8 @@ import java.lang.{Iterable => JIterable}
|
||||||
import org.apache.kafka.streams.processor.ProcessorContext
|
import org.apache.kafka.streams.processor.ProcessorContext
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implicit classes that offer conversions of Scala function literals to
|
* Implicit classes that offer conversions of Scala function literals to SAM (Single Abstract Method) objects in Java.
|
||||||
* SAM (Single Abstract Method) objects in Java. These make the Scala APIs much
|
* These make the Scala APIs much more expressive, with less boilerplate and more succinct.
|
||||||
* more expressive, with less boilerplate and more succinct.
|
|
||||||
*/
|
*/
|
||||||
private[scala] object FunctionsCompatConversions {
|
private[scala] object FunctionsCompatConversions {
|
||||||
|
|
||||||
|
|
|
@ -19,22 +19,21 @@ package org.apache.kafka.streams.scala
|
||||||
import org.apache.kafka.common.serialization.Serde
|
import org.apache.kafka.common.serialization.Serde
|
||||||
import org.apache.kafka.streams.KeyValue
|
import org.apache.kafka.streams.KeyValue
|
||||||
import org.apache.kafka.streams.kstream.{
|
import org.apache.kafka.streams.kstream.{
|
||||||
KStream => KStreamJ,
|
|
||||||
KGroupedStream => KGroupedStreamJ,
|
|
||||||
TimeWindowedKStream => TimeWindowedKStreamJ,
|
|
||||||
SessionWindowedKStream => SessionWindowedKStreamJ,
|
|
||||||
CogroupedKStream => CogroupedKStreamJ,
|
CogroupedKStream => CogroupedKStreamJ,
|
||||||
TimeWindowedCogroupedKStream => TimeWindowedCogroupedKStreamJ,
|
KGroupedStream => KGroupedStreamJ,
|
||||||
SessionWindowedCogroupedKStream => SessionWindowedCogroupedKStreamJ,
|
KGroupedTable => KGroupedTableJ,
|
||||||
|
KStream => KStreamJ,
|
||||||
KTable => KTableJ,
|
KTable => KTableJ,
|
||||||
KGroupedTable => KGroupedTableJ
|
SessionWindowedCogroupedKStream => SessionWindowedCogroupedKStreamJ,
|
||||||
|
SessionWindowedKStream => SessionWindowedKStreamJ,
|
||||||
|
TimeWindowedCogroupedKStream => TimeWindowedCogroupedKStreamJ,
|
||||||
|
TimeWindowedKStream => TimeWindowedKStreamJ
|
||||||
}
|
}
|
||||||
import org.apache.kafka.streams.processor.StateStore
|
import org.apache.kafka.streams.processor.StateStore
|
||||||
import org.apache.kafka.streams.scala.kstream._
|
import org.apache.kafka.streams.scala.kstream._
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implicit conversions between the Scala wrapper objects and the underlying Java
|
* Implicit conversions between the Scala wrapper objects and the underlying Java objects.
|
||||||
* objects.
|
|
||||||
*/
|
*/
|
||||||
object ImplicitConversions {
|
object ImplicitConversions {
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,11 @@ package org.apache.kafka.streams.scala
|
||||||
package kstream
|
package kstream
|
||||||
|
|
||||||
import org.apache.kafka.streams.kstream.{
|
import org.apache.kafka.streams.kstream.{
|
||||||
|
CogroupedKStream => CogroupedKStreamJ,
|
||||||
SessionWindows,
|
SessionWindows,
|
||||||
SlidingWindows,
|
SlidingWindows,
|
||||||
Window,
|
Window,
|
||||||
Windows,
|
Windows
|
||||||
CogroupedKStream => CogroupedKStreamJ
|
|
||||||
}
|
}
|
||||||
import org.apache.kafka.streams.scala.FunctionsCompatConversions.{AggregatorFromFunction, InitializerFromFunction}
|
import org.apache.kafka.streams.scala.FunctionsCompatConversions.{AggregatorFromFunction, InitializerFromFunction}
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,12 @@ package kstream
|
||||||
import org.apache.kafka.streams.kstream.internals.KTableImpl
|
import org.apache.kafka.streams.kstream.internals.KTableImpl
|
||||||
import org.apache.kafka.streams.scala.serialization.Serdes
|
import org.apache.kafka.streams.scala.serialization.Serdes
|
||||||
import org.apache.kafka.streams.kstream.{
|
import org.apache.kafka.streams.kstream.{
|
||||||
|
KGroupedStream => KGroupedStreamJ,
|
||||||
|
KTable => KTableJ,
|
||||||
SessionWindows,
|
SessionWindows,
|
||||||
SlidingWindows,
|
SlidingWindows,
|
||||||
Window,
|
Window,
|
||||||
Windows,
|
Windows
|
||||||
KGroupedStream => KGroupedStreamJ,
|
|
||||||
KTable => KTableJ
|
|
||||||
}
|
}
|
||||||
import org.apache.kafka.streams.scala.FunctionsCompatConversions.{
|
import org.apache.kafka.streams.scala.FunctionsCompatConversions.{
|
||||||
AggregatorFromFunction,
|
AggregatorFromFunction,
|
||||||
|
|
|
@ -21,11 +21,11 @@ import org.apache.kafka.streams.KeyValue
|
||||||
import org.apache.kafka.streams.kstream.{
|
import org.apache.kafka.streams.kstream.{
|
||||||
GlobalKTable,
|
GlobalKTable,
|
||||||
JoinWindows,
|
JoinWindows,
|
||||||
|
KStream => KStreamJ,
|
||||||
Printed,
|
Printed,
|
||||||
TransformerSupplier,
|
TransformerSupplier,
|
||||||
ValueTransformerSupplier,
|
ValueTransformerSupplier,
|
||||||
ValueTransformerWithKeySupplier,
|
ValueTransformerWithKeySupplier
|
||||||
KStream => KStreamJ
|
|
||||||
}
|
}
|
||||||
import org.apache.kafka.streams.processor.TopicNameExtractor
|
import org.apache.kafka.streams.processor.TopicNameExtractor
|
||||||
import org.apache.kafka.streams.processor.api.{FixedKeyProcessorSupplier, ProcessorSupplier}
|
import org.apache.kafka.streams.processor.api.{FixedKeyProcessorSupplier, ProcessorSupplier}
|
||||||
|
@ -334,7 +334,7 @@ class KStream[K, V](val inner: KStreamJ[K, V]) {
|
||||||
* @see `org.apache.kafka.streams.kstream.KStream#branch`
|
* @see `org.apache.kafka.streams.kstream.KStream#branch`
|
||||||
* @deprecated since 2.8. Use `split` instead.
|
* @deprecated since 2.8. Use `split` instead.
|
||||||
*/
|
*/
|
||||||
//noinspection ScalaUnnecessaryParentheses
|
// noinspection ScalaUnnecessaryParentheses
|
||||||
@deprecated("use `split()` instead", "2.8")
|
@deprecated("use `split()` instead", "2.8")
|
||||||
def branch(predicates: ((K, V) => Boolean)*): Array[KStream[K, V]] =
|
def branch(predicates: ((K, V) => Boolean)*): Array[KStream[K, V]] =
|
||||||
inner.branch(predicates.map(_.asPredicate): _*).map(kstream => new KStream(kstream))
|
inner.branch(predicates.map(_.asPredicate): _*).map(kstream => new KStream(kstream))
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.kafka.streams.scala
|
||||||
package kstream
|
package kstream
|
||||||
|
|
||||||
import org.apache.kafka.common.utils.Bytes
|
import org.apache.kafka.common.utils.Bytes
|
||||||
import org.apache.kafka.streams.kstream.{TableJoined, ValueJoiner, ValueTransformerWithKeySupplier, KTable => KTableJ}
|
import org.apache.kafka.streams.kstream.{KTable => KTableJ, TableJoined, ValueJoiner, ValueTransformerWithKeySupplier}
|
||||||
import org.apache.kafka.streams.scala.FunctionsCompatConversions.{
|
import org.apache.kafka.streams.scala.FunctionsCompatConversions.{
|
||||||
FunctionFromFunction,
|
FunctionFromFunction,
|
||||||
KeyValueMapperFromFunction,
|
KeyValueMapperFromFunction,
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.nio.ByteBuffer
|
||||||
import java.util
|
import java.util
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import org.apache.kafka.common.serialization.{Deserializer, Serde, Serializer, Serdes => JSerdes}
|
import org.apache.kafka.common.serialization.{Deserializer, Serde, Serdes => JSerdes, Serializer}
|
||||||
import org.apache.kafka.streams.kstream.WindowedSerdes
|
import org.apache.kafka.streams.kstream.WindowedSerdes
|
||||||
|
|
||||||
object Serdes extends LowPrioritySerdes {
|
object Serdes extends LowPrioritySerdes {
|
||||||
|
|
|
@ -25,16 +25,16 @@ import org.apache.kafka.streams.kstream.{
|
||||||
Aggregator,
|
Aggregator,
|
||||||
Initializer,
|
Initializer,
|
||||||
JoinWindows,
|
JoinWindows,
|
||||||
KeyValueMapper,
|
|
||||||
Reducer,
|
|
||||||
Transformer,
|
|
||||||
ValueJoiner,
|
|
||||||
ValueMapper,
|
|
||||||
KGroupedStream => KGroupedStreamJ,
|
KGroupedStream => KGroupedStreamJ,
|
||||||
KStream => KStreamJ,
|
KStream => KStreamJ,
|
||||||
KTable => KTableJ,
|
KTable => KTableJ,
|
||||||
|
KeyValueMapper,
|
||||||
Materialized => MaterializedJ,
|
Materialized => MaterializedJ,
|
||||||
StreamJoined => StreamJoinedJ
|
Reducer,
|
||||||
|
StreamJoined => StreamJoinedJ,
|
||||||
|
Transformer,
|
||||||
|
ValueJoiner,
|
||||||
|
ValueMapper
|
||||||
}
|
}
|
||||||
import org.apache.kafka.streams.processor.{api, ProcessorContext}
|
import org.apache.kafka.streams.processor.{api, ProcessorContext}
|
||||||
import org.apache.kafka.streams.processor.api.{Processor, ProcessorSupplier}
|
import org.apache.kafka.streams.processor.api.{Processor, ProcessorSupplier}
|
||||||
|
@ -42,7 +42,7 @@ import org.apache.kafka.streams.scala.ImplicitConversions._
|
||||||
import org.apache.kafka.streams.scala.serialization.{Serdes => NewSerdes}
|
import org.apache.kafka.streams.scala.serialization.{Serdes => NewSerdes}
|
||||||
import org.apache.kafka.streams.scala.serialization.Serdes._
|
import org.apache.kafka.streams.scala.serialization.Serdes._
|
||||||
import org.apache.kafka.streams.scala.kstream._
|
import org.apache.kafka.streams.scala.kstream._
|
||||||
import org.apache.kafka.streams.{KeyValue, StreamsConfig, TopologyDescription, StreamsBuilder => StreamsBuilderJ}
|
import org.apache.kafka.streams.{KeyValue, StreamsBuilder => StreamsBuilderJ, StreamsConfig, TopologyDescription}
|
||||||
import org.junit.jupiter.api.Assertions._
|
import org.junit.jupiter.api.Assertions._
|
||||||
import org.junit.jupiter.api._
|
import org.junit.jupiter.api._
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,7 @@ class KStreamTest extends TestDriver {
|
||||||
testDriver.close()
|
testDriver.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
//noinspection ScalaDeprecation
|
// noinspection ScalaDeprecation
|
||||||
@Test
|
@Test
|
||||||
def testJoinCorrectlyRecords(): Unit = {
|
def testJoinCorrectlyRecords(): Unit = {
|
||||||
val builder = new StreamsBuilder()
|
val builder = new StreamsBuilder()
|
||||||
|
|
|
@ -19,11 +19,11 @@ package org.apache.kafka.streams.scala.kstream
|
||||||
import org.apache.kafka.streams.kstream.Suppressed.BufferConfig
|
import org.apache.kafka.streams.kstream.Suppressed.BufferConfig
|
||||||
import org.apache.kafka.streams.kstream.{
|
import org.apache.kafka.streams.kstream.{
|
||||||
Named,
|
Named,
|
||||||
SlidingWindows,
|
|
||||||
SessionWindows,
|
SessionWindows,
|
||||||
|
SlidingWindows,
|
||||||
|
Suppressed => JSuppressed,
|
||||||
TimeWindows,
|
TimeWindows,
|
||||||
Windowed,
|
Windowed
|
||||||
Suppressed => JSuppressed
|
|
||||||
}
|
}
|
||||||
import org.apache.kafka.streams.scala.ImplicitConversions._
|
import org.apache.kafka.streams.scala.ImplicitConversions._
|
||||||
import org.apache.kafka.streams.scala.serialization.Serdes._
|
import org.apache.kafka.streams.scala.serialization.Serdes._
|
||||||
|
|
Loading…
Reference in New Issue