Skip to content

Commit

Permalink
reformatted and fixed scaladocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ghik committed Feb 25, 2016
1 parent a26e206 commit 750d205
Show file tree
Hide file tree
Showing 37 changed files with 154 additions and 152 deletions.
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ val commonSettings = Seq(
</developers>
},

(publishArtifact in packageDoc) := false,
libraryDependencies += compilerPlugin("com.github.ghik" % "silencer-plugin" % silencerVersion),
libraryDependencies ++= Seq(
"com.github.ghik" % "silencer-lib" % silencerVersion,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package com.avsystem.commons
package analyzer

import org.scalatest.{Assertions, FunSuite}
import org.scalatest.Assertions

import scala.reflect.internal.util.BatchSourceFile
import scala.tools.nsc.plugins.Plugin
import scala.tools.nsc.{Global, Settings}

/**
* Author: ghik
* Created: 21/08/15.
*/
trait AnalyzerTest { this: Assertions =>
* Author: ghik
* Created: 21/08/15.
*/
trait AnalyzerTest {this: Assertions =>
val settings = new Settings
settings.usejavacp.value = true
val compiler = new Global(settings) {
global =>
val compiler = new Global(settings) {global =>

override protected def loadRoughPluginsList(): List[Plugin] =
new AnalyzerPlugin(global) :: super.loadRoughPluginsList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package analyzer
import org.scalatest.FunSuite

/**
* Author: ghik
* Created: 08/09/15.
*/
* Author: ghik
* Created: 08/09/15.
*/
class DetectSI7046Test extends FunSuite with AnalyzerTest {
test("too few varargs parameters should be rejected") {
assertErrors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package analyzer
import org.scalatest.FunSuite

/**
* Author: ghik
* Created: 08/09/15.
*/
* Author: ghik
* Created: 08/09/15.
*/
class ImportJavaUtilTest extends FunSuite with AnalyzerTest {
test("import java.util should be rejected") {
assertErrors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package analyzer
import org.scalatest.FunSuite

/**
* Author: ghik
* Created: 08/09/15.
*/
* Author: ghik
* Created: 08/09/15.
*/
class VarargsAtLeastTest extends FunSuite with AnalyzerTest {
test("too few varargs parameters should be rejected") {
assertErrors(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ package annotation
import scala.annotation.StaticAnnotation

/**
* When applied on varargs parameter, indicates that at least some number of parameters is required.
* This is later checked by the static analyzer.
* <br/>
* WARNING: implementation of method which takes a varargs parameter may NOT assume that given number of
* arguments will always be passed, because it's still possible to pass a [[Seq]] where varargs parameter is
* required using the `: _*` ascription, e.g.
* {{{
* varargsMethod(List(): _*)
* }}}
* and that is not checked by the static analyzer.
*/
* When applied on varargs parameter, indicates that at least some number of parameters is required.
* This is later checked by the static analyzer.
* <br/>
* WARNING: implementation of method which takes a varargs parameter may NOT assume that given number of
* arguments will always be passed, because it's still possible to pass a `Seq` where
* varargs parameter is required using the `: _*` ascription, e.g.
* {{{
* varargsMethod(List(): _*)
* }}}
* and that is not checked by the static analyzer.
*/
class atLeast(n: Int) extends StaticAnnotation
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package serialization
import scala.annotation.StaticAnnotation

/**
* Can be used on case class fields and classes in sealed hierarchy to instruct automatically derived [[GenCodec]]
* Can be used on case class fields and classes in sealed hierarchy to instruct automatically derived `GenCodec`
* to use particular name instead of just using parameter or class name.
*
* For example:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scala.annotation.StaticAnnotation

/**
* If some case class field has default value, you can use this annotation on this field to instruct an
* automatically derived [[GenCodec]] to not persist the value of that field if it's equal to the default value.
* automatically derived `GenCodec` to not persist the value of that field if it's equal to the default value.
*
* For example:
* {{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package serialization
import scala.annotation.StaticAnnotation

/**
* Can be used on case classes with exactly one field to instruct automatically generated [[GenCodec]] that the
* Can be used on case classes with exactly one field to instruct automatically generated `GenCodec` that the
* class is a "transparent wrapper" and should be serialized to the same representation as the value of its sole
* field.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ package com.avsystem.commons
package jiop

import java.util.concurrent.Callable
import java.util.{function => juf, Comparator}
import java.util.{Comparator, function => juf}

import com.avsystem.commons.misc.Sam

import scala.language.implicitConversions

/**
* Utils to convert Scala functions and expressions to most common Java functional interfaces.
*/
* Utils to convert Scala functions and expressions to most common Java functional interfaces.
*/
trait JFunctionUtils {
def jRunnable(code: => Any) = Sam[Runnable](code)
def jCallable[T](expr: => T) = Sam[Callable[T]](expr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package jiop
import java.{util => ju}

/**
* Author: ghik
* Created: 14/07/15.
*/
* Author: ghik
* Created: 14/07/15.
*/
trait JOptionalUtils {

import JOptionalUtils._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import scala.collection.generic.CanBuildFrom
import scala.language.higherKinds

/**
* Author: ghik
* Created: 15/07/15.
*/
* Author: ghik
* Created: 15/07/15.
*/
final class ScalaJDoubleStream(private val jStream: JDoubleStream) extends AnyVal {
def asJava = jStream

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import scala.collection.generic.CanBuildFrom
import scala.language.higherKinds

/**
* Author: ghik
* Created: 15/07/15.
*/
* Author: ghik
* Created: 15/07/15.
*/
final class ScalaJIntStream(private val jStream: JIntStream) extends AnyVal {
def asJava = jStream

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import scala.collection.generic.CanBuildFrom
import scala.language.higherKinds

/**
* Author: ghik
* Created: 15/07/15.
*/
* Author: ghik
* Created: 15/07/15.
*/
final class ScalaJLongStream(private val jStream: JLongStream) extends AnyVal {
def asJava = jStream

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import scala.language.higherKinds
import scala.reflect.ClassTag

/**
* Author: ghik
* Created: 15/07/15.
*/
* Author: ghik
* Created: 15/07/15.
*/
final class ScalaJStream[+A](private val jStream: JStream[A@uV]) extends AnyVal {
def asJava[B >: A]: JStream[B] =
jStream.asInstanceOf[JStream[B]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package jiop
import org.scalatest.FunSuite

/**
* Author: ghik
* Created: 20/07/15.
*/
* Author: ghik
* Created: 20/07/15.
*/
class CBFShadowingTest extends FunSuite {
test("java collections CanBuildFroms should not shadow Scala default ones when imported directly") {
import JavaInterop.jArrayListCBF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.scalatest.FunSuite

import scala.concurrent.duration.Duration
import scala.concurrent.{Await, ExecutionContext, Promise}
import scala.util.{Random, Success}
import scala.util.Success

class JavaInteropTest extends FunSuite {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ object TreeForTypeTest {
testTreeForType("Set[_]")
testTreeForType("Map[T, T] forSome {type T <: String}")
testTreeForType("AnyRef with Serializable")
testTreeForType("""AnyRef {
testTreeForType(
"""AnyRef {
type Lol[K, V] <: Map[K, V]
def stuff[C[+X] <: Traversable[X]](c: C[Int]): C[String]
val lulz: Map[String, Int]
Expand Down Expand Up @@ -65,7 +66,8 @@ class TreeForTypeTest {
testTreeForType("fu.z.type forSome {val fu: Fuu with Singleton}")
testTreeForType("fu.bar.q.type forSome {val fu: Fuu}")
testTreeForType("AnyRef with Serializable")
testTreeForType("""AnyRef {
testTreeForType(
"""AnyRef {
type Lol[K, V] <: Map[K, V]
type Stuff[K, V] = Map[K, V]
def stuff[C[+X] <: Traversable[X]](c: C[Int]): C[String]
Expand All @@ -92,7 +94,8 @@ class TreeForTypeTest {
testTreeForType("fu.z.type forSome {val fu: Fuu}")
testTreeForType("fu.bar.q.type forSome {val fu: Fuu}")
testTreeForType("AnyRef with Serializable")
testTreeForType("""AnyRef {
testTreeForType(
"""AnyRef {
type Lol[K, V] <: Map[K, V]
type Stuff[K, V] = Map[K, V]
def stuff[C[+X] <: Traversable[X]](c: C[Int]): C[String]
Expand All @@ -102,6 +105,7 @@ class TreeForTypeTest {
}

object Unrelated {

import TreeForTypeTest._

testTreeForType("Int")
Expand All @@ -115,7 +119,8 @@ object Unrelated {
testTreeForType("Set[_]")
testTreeForType("Map[T, T] forSome {type T <: String}")
testTreeForType("AnyRef with Serializable")
testTreeForType("""AnyRef {
testTreeForType(
"""AnyRef {
type Lol[K, V] <: Map[K, V]
type Stuff[K, V] = Map[K, V]
def stuff[C[+X] <: Traversable[X]](c: C[Int]): C[String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class TypeClassDerivationTest extends FunSuite {
assert(SealedRoot.tc == SealedHierarchyTC(typeRepr[SealedRoot], List(
("SealedCase", ApplyUnapplyTC(typeRepr[SealedCase], List(("i", TC.forInt, None)))),
("SealedObj", SingletonTC(typeRepr[SealedObj.type], SealedObj)),
("SubSealedCase", ApplyUnapplyTC(typeRepr[SubSealedCase], List(("i", TC.forInt, None), ("w", Whatever.tc ,None))))
("SubSealedCase", ApplyUnapplyTC(typeRepr[SubSealedCase], List(("i", TC.forInt, None), ("w", Whatever.tc, None))))
)))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package com.avsystem.commons
package rpc

import com.avsystem.commons.concurrent.{HasExecutionContext, RunNowEC}
import com.avsystem.commons.rpc.DummyRPC._
import com.github.ghik.silencer.silent
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpec}

import scala.collection.mutable.ArrayBuffer
import scala.concurrent.{ExecutionContext, Future}
import DummyRPC._

class RPCTest extends WordSpec with Matchers with BeforeAndAfterAll {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ trait MacroCommons {
}

/**
* Returns a [[Tree]] that should typecheck to the type passed as argument (without using [[TypeTree]]).
* Returns a `Tree` that should typecheck to the type passed as argument (without using `TypeTree`).
*/
def treeForType(tpe: Type): Tree = tpe match {
case TypeRef(NoPrefix, ExistentialSingleton(_, name, _), Nil) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ trait TypeClassDerivation extends MacroCommons {
* Contains metadata extracted from `apply` method of companion object of some record (case-class like) type.
*
* @param sym symbol of the `apply` method parameter
* @param defaultValue tree that evaluates to default value of the `apply` parameter or [[EmptyTree]]
* @param defaultValue tree that evaluates to default value of the `apply` parameter or `EmptyTree`
* @param instance tree that evaluates to type class instance for type of this parameter
*/
case class ApplyParam(sym: Symbol, defaultValue: Tree, instance: Tree)
Expand Down Expand Up @@ -127,7 +127,7 @@ trait TypeClassDerivation extends MacroCommons {

/**
* Derives type class instance for arbitrary type which is neither a singleton, record nor union type.
* Usually, you want to throw a [[TypecheckException]] to indicate that type class instance cannot be derived
* Usually, you want to throw a `TypecheckException` to indicate that type class instance cannot be derived
* for this type. You can use [[typecheckException]] method for this.
*/
def forUnknown(tpe: Type): Tree
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SamMacros(val c: blackbox.Context) extends MacroCommons {
val byName = validateSam(targetTpe, funTpe)
val m = targetTpe.members.filter(m => m.isAbstract).head

if(byName) {
if (byName) {
q"""
new $targetTpe {
def ${m.name.toTermName} = $fun
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class TestMacros(val c: blackbox.Context) extends TypeClassDerivation {

def forApplyUnapply(tpe: Type, companion: Symbol, params: List[ApplyParam]): Tree = {
val deps = params.map { case ApplyParam(s, dv, t) =>
val defaultValueOpt = if(dv == EmptyTree) q"None" else q"Some($DefValObj($dv))"
val defaultValueOpt = if (dv == EmptyTree) q"None" else q"Some($DefValObj($dv))"
q"(${s.name.toString}, $t, $defaultValueOpt)"
}
q"$ApplyUnapplyTCObj[$tpe](${tpe.toString}, List(..$deps))"
Expand Down
Loading

0 comments on commit 750d205

Please sign in to comment.