Skip to content

Commit aeb1a01

Browse files
authored
Merge pull request #108 from SethTisue/scala-2.13.0-M2
support Scala 2.13.0-M2
2 parents 0ae0a53 + e437997 commit aeb1a01

File tree

14 files changed

+27
-68
lines changed

14 files changed

+27
-68
lines changed

.travis.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ jdk:
1414
- oraclejdk8
1515

1616
env:
17-
- SCALA_VERSION=2.10.2
18-
- SCALA_VERSION=2.10.3
19-
- SCALA_VERSION=2.10.4
20-
- SCALA_VERSION=2.10.5
21-
- SCALA_VERSION=2.10.6
2217
- SCALA_VERSION=2.11.0
2318
- SCALA_VERSION=2.11.1
2419
- SCALA_VERSION=2.11.2
@@ -33,7 +28,7 @@ env:
3328
- SCALA_VERSION=2.12.1
3429
- SCALA_VERSION=2.12.2
3530
- SCALA_VERSION=2.12.3
36-
- SCALA_VERSION=2.13.0-M1
31+
- SCALA_VERSION=2.13.0-M2
3732

3833
# there's no better way it seems.. https://github.com/travis-ci/travis-ci/issues/1519
3934
matrix:
@@ -46,7 +41,9 @@ matrix:
4641
- jdk: openjdk6
4742
env: SCALA_VERSION=2.12.2
4843
- jdk: openjdk6
49-
env: SCALA_VERSION=2.13.0-M1
44+
env: SCALA_VERSION=2.12.3
45+
- jdk: openjdk6
46+
env: SCALA_VERSION=2.13.0-M2
5047

5148
# Increasing ReservedCodeCacheSize minimizes scala compiler-interface compile times
5249
script:

LICENSE

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
This software is licensed under the Apache 2 license, quoted below.
22

3-
Copyright 2009-2013 Typesafe Inc. [http://www.typesafe.com]
3+
Copyright 2009-2017 Lightbend Inc. [http://www.lightbend.com]
44

55
Licensed under the Apache License, Version 2.0 (the "License"); you may not
66
use this file except in compliance with the License. You may obtain a copy of

build.sbt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* Copyright (C) 2009-2017 Typesafe Inc. <http://www.typesafe.com>
3-
*/
4-
51
// so we can set this from automated builds and also depending on Scala version
62
lazy val scalaTestVersion = settingKey[String]("The version of ScalaTest to use.")
73

@@ -46,29 +42,31 @@ lazy val `genjavadoc-plugin` = (project in file("plugin"))
4642
else default
4743
},
4844
crossVersion := CrossVersion.full,
49-
exportJars := true
45+
exportJars := true,
46+
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-Xlint", "-Xfatal-warnings")
5047
)
5148

5249
lazy val defaults = Seq(
5350
organization := "com.typesafe.genjavadoc",
5451
scalaVersion := crossScalaVersions.value.last,
5552
crossScalaVersions := {
56-
val latest210 = 6
5753
val latest211 = 11
5854
val latest212 = 3
59-
val pre213 = List("M1")
55+
val pre213 = List("M2")
6056
val skipVersions = Set("2.11.9", "2.11.10")
61-
val scala210and211Versions = (2 to latest210).map(i => s"2.10.$i") ++ (0 to latest211).map(i => s"2.11.$i")
62-
.filterNot(skipVersions.contains(_))
57+
val scala211Versions =
58+
(0 to latest211)
59+
.map(i => s"2.11.$i")
60+
.filterNot(skipVersions.contains(_))
6361
ifJavaVersion(_ < 8) {
64-
scala210and211Versions
62+
scala211Versions
6563
} {
66-
scala210and211Versions ++ (0 to latest212).map(i => s"2.12.$i") ++ pre213.map(s => s"2.13.0-$s")
64+
scala211Versions ++ (0 to latest212).map(i => s"2.12.$i") ++ pre213.map(s => s"2.13.0-$s")
6765
}
6866
},
6967
scalaTestVersion := {
7068
val Some((2, scalaMajor)) = CrossVersion.partialVersion(scalaVersion.value)
71-
if (scalaMajor >= 12) "3.0.3"
69+
if (scalaMajor >= 12) "3.0.4"
7270
else "2.1.3"
7371
},
7472
resolvers += Resolver.mavenLocal,

plugin/src/main/scala-2.10/com/typesafe/genjavadoc/Comments.scala

Lines changed: 0 additions & 22 deletions
This file was deleted.

plugin/src/main/scala/com/typesafe/genjavadoc/AST.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.typesafe.genjavadoc
22

3-
import scala.reflect.internal.Flags
43
import scala.annotation.tailrec
54

65
trait AST { this: TransformCake
@@ -77,7 +76,7 @@ trait AST { this: TransformCake ⇒
7776

7877
def fabricateParams: Boolean
7978

80-
final case class DeprecationInfo(msg: String, since: String) {
79+
case class DeprecationInfo(msg: String, since: String) {
8180
def maybeDot = if (msg.endsWith(".")) " " else ". "
8281
def maybeSinceDot = if (since.endsWith(".")) " " else ". "
8382
def render = s" * @deprecated ${msg}${maybeDot}Since $since${maybeSinceDot}"

plugin/src/main/scala/com/typesafe/genjavadoc/BaseComments.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ trait BaseComments { this: TransformCake ⇒
7373

7474
implicit val positionOrdering: Ordering[Position] = new Ordering[Position] {
7575
def compare(a: Position, b: Position) =
76-
if (a.endOrPoint < b.startOrPoint) -1
77-
else if (a.startOrPoint > b.endOrPoint) 1
76+
if (a.end < b.start) -1
77+
else if (a.start > b.end) 1
7878
else 0
7979
}
8080
var comments = TreeMap[Position, Comment]()
@@ -86,7 +86,7 @@ trait BaseComments { this: TransformCake ⇒
8686

8787
val positions = comments.keySet
8888

89-
def between(p1: Position, p2: Position) = unit.source.content.slice(p1.startOrPoint, p2.startOrPoint).filterNot(_ == '\n').mkString
89+
def between(p1: Position, p2: Position) = unit.source.content.slice(p1.start, p2.start).filterNot(_ == '\n').mkString
9090

9191
object ScalaDoc extends (Comment Boolean) {
9292
def apply(c: Comment): Boolean = c.text.head.startsWith("/**")

plugin/src/main/scala/com/typesafe/genjavadoc/BasicTransform.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.typesafe.genjavadoc
22

33
import scala.reflect.internal.Flags
4-
import java.util.regex.Pattern
54

65
trait BasicTransform { this: TransformCake
76
import global._
@@ -52,7 +51,7 @@ trait BasicTransform { this: TransformCake ⇒
5251
val old = pos
5352
pos = max(tp, prevTemplateMaxPos)
5453
if (old.precedes(pos)) {
55-
(positions.from(old) intersect positions.to(pos)).toSeq map comments filter ScalaDoc lastOption match {
54+
(positions.from(old) intersect positions.to(pos)).toSeq.map(comments).filter(ScalaDoc).lastOption match {
5655
case Some(c) c.text // :+ s"// found in '${between(old, pos)}'"
5756
case None
5857
// s"// empty '${between(old, pos)}' (${pos.lineContent}:${pos.column})" ::

plugin/src/main/scala/com/typesafe/genjavadoc/JavaSig.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ trait JavaSig { this: TransformCake ⇒
1212
def removeThis(in: Type): Type = {
1313
// println("transforming " + in)
1414
in match {
15-
case ThisType(parent) if !parent.isPackage removeThis(parent.tpe)
16-
case SingleType(parent, name) typeRef(removeThis(parent), name, Nil)
17-
case TypeRef(pre, sym, args) typeRef(removeThis(pre), sym, args)
18-
case x x
15+
case ThisType(parent) if !parent.hasPackageFlag removeThis(parent.tpe)
16+
case SingleType(parent, name) typeRef(removeThis(parent), name, Nil)
17+
case TypeRef(pre, sym, args) typeRef(removeThis(pre), sym, args)
18+
case x x
1919
}
2020
}
2121

plugin/src/main/scala/com/typesafe/genjavadoc/Plugin.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ package com.typesafe.genjavadoc
22

33
import scala.tools.nsc
44
import nsc.Global
5-
import nsc.Phase
65
import nsc.plugins.Plugin
76
import nsc.plugins.PluginComponent
8-
import nsc.transform.{ Transform, TypingTransformers }
7+
import nsc.transform.Transform
98
import java.io.File
109
import java.util.Properties
11-
import java.io.StringReader
1210

1311
object GenJavaDocPlugin {
1412

@@ -26,7 +24,6 @@ object GenJavaDocPlugin {
2624
}
2725

2826
class GenJavaDocPlugin(val global: Global) extends Plugin {
29-
import global._
3027
import GenJavaDocPlugin._
3128

3229
val name = "genjavadoc"
@@ -53,15 +50,14 @@ class GenJavaDocPlugin(val global: Global) extends Plugin {
5350
private object MyComponent extends PluginComponent with Transform {
5451

5552
import global._
56-
import global.definitions._
5753

5854
type GT = GenJavaDocPlugin.this.global.type
5955

6056
override val global: GT = GenJavaDocPlugin.this.global
6157

6258
val isPreFields = {
6359
val v = nsc.Properties.versionNumberString
64-
Set("2.12.0-M1", "2.12.0-M2", "2.12.0-M3", "2.12.0-M4", "2.12.0-M5").contains(v) || v.startsWith("2.10.") || v.startsWith("2.11.")
60+
Set("2.12.0-M1", "2.12.0-M2", "2.12.0-M3", "2.12.0-M4", "2.12.0-M5").contains(v) || v.startsWith("2.11.")
6561
}
6662
override val runsAfter = List(if(isPreFields) "uncurry" else "fields")
6763
val phaseName = "GenJavaDoc"

plugin/src/main/scala/com/typesafe/genjavadoc/TransformCake.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.typesafe.genjavadoc
22

33
import scala.tools.nsc.Global
4-
import scala.tools.nsc.transform.Transform
54

65
trait TransformCake extends JavaSig with Output with Comments with BasicTransform with AST {
76

0 commit comments

Comments
 (0)