Skip to content

Commit

Permalink
Enable '-Xfatal-warnings flag (monix#114) (monix#248)
Browse files Browse the repository at this point in the history
* Removed method type parameters

* Enable '-Xfatal-warnings' compiler flag (monix#114)

* Update headers

* Replaced Monix deprecated method
  • Loading branch information
paualarco authored Jan 11, 2021
1 parent c7231f9 commit 0b8c94e
Show file tree
Hide file tree
Showing 98 changed files with 195 additions and 129 deletions.
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ https://github.com/AdrielVelazquez

Arun Gopalpuri
https://github.com/arun0009

Pau Alarcón
https://github.com/paualarco
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ lazy val sharedSettings = warnUnusedImport ++ Seq(
scalacOptions ++= Seq(
// Turns all warnings into errors ;-)
// TODO: enable after fixing deprecations for Scala 2.13
// "-Xfatal-warnings",
"-Xfatal-warnings",
// Enables linter options
"-Xlint:adapted-args", // warn if an argument list is modified to match the receiver
"-Xlint:nullary-unit", // warn when nullary methods return Unit
Expand Down Expand Up @@ -129,7 +129,7 @@ lazy val sharedSettings = warnUnusedImport ++ Seq(
licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/monix/monix-kafka")),
headerLicense := Some(HeaderLicense.Custom(
"""|Copyright (c) 2014-2019 by The Monix Project Developers.
"""|Copyright (c) 2014-2021 by The Monix Project Developers.
|
|Licensed under the Apache License, Version 2.0 (the "License");
|you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -193,6 +193,7 @@ lazy val commonDependencies = Seq(
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.2",
"com.typesafe" % "config" % "1.4.1",
"org.slf4j" % "log4j-over-slf4j" % "1.7.30",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.3.2",
// For testing ...
"ch.qos.logback" % "logback-classic" % "1.2.3" % "test",
"org.scalatest" %% "scalatest" % "3.0.9" % "test",
Expand Down
2 changes: 1 addition & 1 deletion kafka-0.10.x/src/main/scala/monix/kafka/Commit.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -93,8 +93,8 @@ object CommittableOffsetBatch {
if (committableOffsets.nonEmpty) {
committableOffsets
.groupBy(_.commitCallback)
.mapValues(CommittableOffsetBatch(_))
.values
.map(CommittableOffsetBatch(_))
.toList
} else {
List.empty
Expand Down
2 changes: 1 addition & 1 deletion kafka-0.10.x/src/main/scala/monix/kafka/Deserializer.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,10 +19,10 @@ package monix.kafka
import java.io.File
import java.util.Properties

import collection.JavaConverters._
import com.typesafe.config.{Config, ConfigFactory}
import monix.kafka.config._

import scala.jdk.CollectionConverters._
import scala.concurrent.duration._

/** Configuration for Kafka Consumer.
Expand Down Expand Up @@ -287,7 +287,7 @@ final case class KafkaConsumerConfig(
)

def toJavaMap: java.util.Map[String, Object] =
toMap.filter(_._2 != null).mapValues(_.asInstanceOf[AnyRef]).toMap.asJava
toMap.filter(_._2 != null).map{case (a, b) =>(a, b.asInstanceOf[AnyRef])}.asJava

def toProperties: Properties = {
val props = new Properties()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,8 @@ import monix.reactive.observers.Subscriber
import org.apache.kafka.clients.consumer.internals.NoOpConsumerRebalanceListener
import org.apache.kafka.clients.consumer.{Consumer, ConsumerRecord, KafkaConsumer}

import scala.collection.JavaConverters._

import scala.jdk.CollectionConverters._
import scala.concurrent.blocking
import scala.util.matching.Regex

Expand Down Expand Up @@ -245,7 +246,6 @@ object KafkaConsumerObservable {
K: Deserializer[K],
V: Deserializer[V]): Task[Consumer[K, V]] = {

import collection.JavaConverters._
Task.evalAsync {
val configMap = config.toJavaMap
blocking {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@ import monix.reactive.Observer
import monix.reactive.observers.Subscriber
import org.apache.kafka.clients.consumer.{Consumer, ConsumerRecord}

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.{blocking, Future}
import scala.util.control.NonFatal
import scala.util.{Failure, Success}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@ import monix.reactive.observers.Subscriber
import org.apache.kafka.clients.consumer.{Consumer, OffsetAndMetadata, OffsetCommitCallback}
import org.apache.kafka.common.TopicPartition

import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
import scala.concurrent.{blocking, Future}
import scala.util.control.NonFatal
import scala.util.{Failure, Success}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,11 +18,11 @@ package monix.kafka

import java.io.File
import java.util.Properties
import collection.JavaConverters._

import com.typesafe.config.{Config, ConfigFactory}
import monix.kafka.config._

import scala.jdk.CollectionConverters._
import scala.concurrent.duration._

/** The Kafka Producer config.
Expand Down Expand Up @@ -272,7 +272,7 @@ case class KafkaProducerConfig(
)

def toJavaMap: java.util.Map[String, Object] =
toMap.filter(_._2 != null).mapValues(_.asInstanceOf[AnyRef]).toMap.asJava
toMap.filter(_._2 != null).map{case (a, b) =>(a, b.asInstanceOf[AnyRef])}.asJava

def toProperties: Properties = {
val props = new Properties()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion kafka-0.10.x/src/main/scala/monix/kafka/Serializer.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion kafka-0.10.x/src/main/scala/monix/kafka/config/Acks.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package monix.kafka.config

import com.typesafe.config.ConfigException.BadValue
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class MonixKafkaTopicListTest extends FunSuite with KafkaTestKit {
val result = for {
//Force creation of producer
s1 <- producer.send(topicName, "test-message-1")
res <- Task.parZip2(producer.close(), Task.gather(List.fill(10)(sendTask)).attempt)
res <- Task.parZip2(producer.close(), Task.parSequence(List.fill(10)(sendTask)).attempt)
(_, s2) = res
s3 <- sendTask
} yield (s1, s2, s3)
Expand Down
2 changes: 1 addition & 1 deletion kafka-0.11.x/src/main/scala/monix/kafka/Commit.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -93,8 +93,8 @@ object CommittableOffsetBatch {
if (committableOffsets.nonEmpty) {
committableOffsets
.groupBy(_.commitCallback)
.mapValues(CommittableOffsetBatch(_))
.values
.map(CommittableOffsetBatch(_))
.toList
} else {
List.empty
Expand Down
2 changes: 1 addition & 1 deletion kafka-0.11.x/src/main/scala/monix/kafka/Deserializer.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 by The Monix Project Developers.
* Copyright (c) 2014-2021 by The Monix Project Developers.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,10 +19,10 @@ package monix.kafka
import java.io.File
import java.util.Properties

import collection.JavaConverters._
import com.typesafe.config.{Config, ConfigFactory}
import monix.kafka.config._

import scala.jdk.CollectionConverters._
import scala.concurrent.duration._

/** Configuration for Kafka Consumer.
Expand Down Expand Up @@ -293,7 +293,7 @@ final case class KafkaConsumerConfig(
)

def toJavaMap: java.util.Map[String, Object] =
toMap.filter(_._2 != null).mapValues(_.asInstanceOf[AnyRef]).toMap.asJava
toMap.filter(_._2 != null).map{case (a, b) =>(a, b.asInstanceOf[AnyRef])}.asJava

def toProperties: Properties = {
val props = new Properties()
Expand Down
Loading

0 comments on commit 0b8c94e

Please sign in to comment.