Skip to content

Commit

Permalink
remove unused code, fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue committed Jun 20, 2017
1 parent 7895a03 commit 1b5724e
Show file tree
Hide file tree
Showing 37 changed files with 76 additions and 124 deletions.
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def osgiExport(scalaVersion: String, version: String) = {

lazy val commonSettings = Seq(
organization := "org.scala-lang.modules",
version := "0.9.0-SNAPSHOT"
version := "0.9.0-SNAPSHOT",
scalacOptions ++= Seq("-feature", "-deprecation", "-unchecked")
)

lazy val fnGen = (project in file("fnGen")).
Expand Down
8 changes: 3 additions & 5 deletions fnGen/WrapFnGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ object WrapFnGen {
val packaging = "package scala.compat.java8"

import scala.tools.nsc._
import scala.reflect.internal._
val settings = new Settings(msg => sys.error(msg))
settings.usejavacp.value = true
val compiler = new Global(settings)
Expand Down Expand Up @@ -59,12 +58,12 @@ object WrapFnGen {
}

implicit class SplitMyLinesAndStuff(s: String) {
def toVec = s.linesIterator.toVector
def toVec = s.lines.toVector
def nonBlank = s.trim.length > 0
}

implicit class TreeToText(t: Tree) {
def text = showCode(t).replace("$", "").linesIterator.toVector
def text = showCode(t).replace("$", "").lines.toVector
}

case class Prioritized(lines: Vector[String], priority: Int) {
Expand Down Expand Up @@ -253,7 +252,6 @@ object WrapFnGen {
q"""@inline implicit def $s2jImpN[..$scalafnTdefs](sf: $scalaType[..$scalafnTnames])(implicit ..$evs): $s2jValCN[..$tnParams] =
new $s2jValCN[..$tnParams](sf.asInstanceOf[$scalaType[..$scalaTargs]])
"""
val depth = numberedA.size
(tree, tdParams.length)
}

Expand Down Expand Up @@ -290,7 +288,7 @@ object WrapFnGen {
def sameText(f: java.io.File, text: String): Boolean = {
val x = scala.io.Source.fromFile(f)
val lines = try { x.getLines.toVector } finally { x.close }
lines.iterator.filter(_.nonBlank) == text.linesIterator.filter(_.nonBlank)
lines.iterator.filter(_.nonBlank) == text.lines.filter(_.nonBlank)
}

def write(f: java.io.File, text: String) {
Expand Down
9 changes: 5 additions & 4 deletions src/main/scala/scala/compat/java8/FutureConverters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
*/
package scala.compat.java8

import scala.language.implicitConversions

import scala.concurrent.java8.FuturesConvertersImpl._
import scala.concurrent.{ Future, Promise, ExecutionContext, ExecutionContextExecutorService, ExecutionContextExecutor, impl }
import java.util.concurrent.{ CompletionStage, Executor, ExecutorService, CompletableFuture }
import scala.util.{ Try, Success, Failure }
import java.util.function.{ BiConsumer, Function JF, Consumer, BiFunction }
import scala.concurrent.{ Future, Promise, ExecutionContext, ExecutionContextExecutorService, ExecutionContextExecutor }
import java.util.concurrent.{ CompletionStage, Executor, ExecutorService }
import java.util.function.Consumer

/**
* This class contains static methods which convert between Java CompletionStage
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/scala/compat/java8/OptionConverters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
package scala.compat.java8

import language.implicitConversions
import java.util.{Optional, OptionalDouble, OptionalInt, OptionalLong}

/** This class enables bidirectional conversion between `scala.Option` and the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
package scala.compat.java8

import language.implicitConversions
import java.util.{ Iterator => JIterator, PrimitiveIterator }

/** This class enables conversion from `scala.Iterator` to the set of
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/scala/compat/java8/StreamConverters.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package scala.compat.java8

import language.implicitConversions
import scala.language.higherKinds

import java.util.stream._
import scala.compat.java8.collectionImpl._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.compat.java8.collectionImpl

import scala.language.higherKinds

/** An `Accumulator` is a low-level collection specialized for gathering
* elements in parallel and then joining them in order by merging Accumulators.
* Accumulators can contain more than `Int.MaxValue` elements.
Expand Down Expand Up @@ -232,7 +234,7 @@ private[java8] class AccumulatorStepper[A](private val acc: Accumulator[A]) exte
private var n = if (acc.hIndex > 0) acc.cumulative(0) else acc.index
private var N = acc.totalSize

private def duplicateSelf(limit: Long = N): AccumulatorStepper[A] = {
private def duplicateSelf(limit: Long): AccumulatorStepper[A] = {
val ans = new AccumulatorStepper(acc)
ans.h = h
ans.i = i
Expand All @@ -249,7 +251,7 @@ private[java8] class AccumulatorStepper[A](private val acc: Accumulator[A]) exte
i = 0
}

def characteristics = ORDERED | SIZED | SUBSIZED
def characteristics() = ORDERED | SIZED | SUBSIZED

def estimateSize = N

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.compat.java8.collectionImpl

import scala.language.higherKinds

/** A `DoubleAccumulator` is a low-level collection specialized for gathering
* elements in parallel and then joining them in order by merging them.
* This is a manually specialized variant of `Accumulator` with no actual
Expand Down Expand Up @@ -229,7 +231,7 @@ private[java8] class DoubleAccumulatorStepper(private val acc: DoubleAccumulator
private var n = if (acc.hIndex > 0) acc.cumulative(0) else acc.index
private var N = acc.totalSize

private def duplicateSelf(limit: Long = N): DoubleAccumulatorStepper = {
private def duplicateSelf(limit: Long): DoubleAccumulatorStepper = {
val ans = new DoubleAccumulatorStepper(acc)
ans.h = h
ans.i = i
Expand All @@ -246,7 +248,7 @@ private[java8] class DoubleAccumulatorStepper(private val acc: DoubleAccumulator
i = 0
}

def characteristics = ORDERED | SIZED | SUBSIZED | NONNULL
def characteristics() = ORDERED | SIZED | SUBSIZED | NONNULL

def estimateSize = N

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.compat.java8.collectionImpl

import scala.language.higherKinds

/** A `IntAccumulator` is a low-level collection specialized for gathering
* elements in parallel and then joining them in order by merging them.
* This is a manually specialized variant of `Accumulator` with no actual
Expand Down Expand Up @@ -236,7 +238,7 @@ private[java8] class IntAccumulatorStepper(private val acc: IntAccumulator) exte
private var n = if (acc.hIndex > 0) acc.cumulative(0) else acc.index
private var N = acc.totalSize

private def duplicateSelf(limit: Long = N): IntAccumulatorStepper = {
private def duplicateSelf(limit: Long): IntAccumulatorStepper = {
val ans = new IntAccumulatorStepper(acc)
ans.h = h
ans.i = i
Expand All @@ -253,7 +255,7 @@ private[java8] class IntAccumulatorStepper(private val acc: IntAccumulator) exte
i = 0
}

def characteristics = ORDERED | SIZED | SUBSIZED | NONNULL
def characteristics() = ORDERED | SIZED | SUBSIZED | NONNULL

def estimateSize = N

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.compat.java8.collectionImpl

import scala.language.higherKinds

/** A `LongAccumulator` is a low-level collection specialized for gathering
* elements in parallel and then joining them in order by merging them.
* This is a manually specialized variant of `Accumulator` with no actual
Expand Down Expand Up @@ -230,7 +232,7 @@ private[java8] class LongAccumulatorStepper(private val acc: LongAccumulator) ex
private var n = if (acc.hIndex > 0) acc.cumulative(0) else acc.index
private var N = acc.totalSize

private def duplicateSelf(limit: Long = N): LongAccumulatorStepper = {
private def duplicateSelf(limit: Long): LongAccumulatorStepper = {
val ans = new LongAccumulatorStepper(acc)
ans.h = h
ans.i = i
Expand All @@ -247,7 +249,7 @@ private[java8] class LongAccumulatorStepper(private val acc: LongAccumulator) ex
i = 0
}

def characteristics = ORDERED | SIZED | SUBSIZED | NONNULL
def characteristics() = ORDERED | SIZED | SUBSIZED | NONNULL

def estimateSize = N

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scala.compat.java8.collectionImpl

import scala.language.higherKinds

import java.util.Spliterator

/** A Stepper is a specialized collection that can step through its
Expand Down Expand Up @@ -66,7 +68,7 @@ trait StepperLike[@specialized(Double, Int, Long) A, +CC] { self: CC =>
* guaranteed to be any safer than modification of any generic mutable collection, and if the underlying collection is ordered by
* virtue of sorting, `Stepper` will not keep track of that fact.
*/
def characteristics: Int
def characteristics(): Int

/** Returns the size of the collection, if known exactly, or `-1` if not. */
def knownSize: Long
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package scala.compat.java8.converterImpl

import language.implicitConversions

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

trait AccumulatesFromStepper[@specialized(Double, Int, Long) A, Acc <: AccumulatorLike[A, Acc]] {
def apply(stepper: Stepper[A]): Acc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package scala.compat.java8.converterImpl

import language.implicitConversions

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

trait MakesStepper[T, +Extra] extends Any {
/** Generates a fresh stepper of type `S` for element type `T` */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ package scala.compat.java8.converterImpl

import language.implicitConversions

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

trait Priority3StepConverters {
implicit def richIterableCanStep[A](underlying: Iterable[A]) = new RichIterableCanStep(underlying)
implicit def richMapCanStep[K, V](underlying: collection.Map[K, V]) = new RichMapCanStep[K, V](underlying)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package scala.compat.java8.converterImpl

import language.implicitConversions

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

/////////////////////////////
// Stepper implementations //
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

// Iterables just defer to iterator unless they can pattern match something better.
// TODO: implement pattern matching!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

/////////////////////////////
// Stepper implementations //
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package scala.compat.java8.converterImpl

import annotation.tailrec

import scala.compat.java8.collectionImpl._
import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package scala.compat.java8.converterImpl

import java.util.Spliterator

import scala.compat.java8.collectionImpl._
import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package scala.compat.java8.converterImpl

import java.util.Spliterator

import scala.compat.java8.collectionImpl._
import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package scala.compat.java8.converterImpl

import java.util.Spliterator

import scala.compat.java8.collectionImpl._
import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package scala.compat.java8.converterImpl

import java.util.Spliterator

import scala.compat.java8.collectionImpl._
import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package scala.compat.java8.converterImpl

import java.util.Spliterator

import scala.compat.java8.collectionImpl._
import Stepper._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package scala.compat.java8.converterImpl

import language.implicitConversions
import scala.annotation.switch

import scala.compat.java8.collectionImpl._
import scala.compat.java8.runtime._

import Stepper._

Expand Down
Loading

0 comments on commit 1b5724e

Please sign in to comment.