Skip to content

Commit 2a75034

Browse files
committed
Merge commit '5e99f82' into merge-2.11-to-2.12-nov-27
2 parents f5de0a5 + 5e99f82 commit 2a75034

File tree

12 files changed

+28
-28
lines changed

12 files changed

+28
-28
lines changed

src/library/scala/reflect/ScalaLongSignature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
@Retention(RetentionPolicy.RUNTIME)
99
@Target(ElementType.TYPE)
1010
public @interface ScalaLongSignature {
11-
public String[] bytes();
11+
String[] bytes();
1212
}

src/library/scala/reflect/ScalaSignature.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
@Retention(RetentionPolicy.RUNTIME)
99
@Target(ElementType.TYPE)
1010
public @interface ScalaSignature {
11-
public String bytes();
11+
String bytes();
1212
}

src/reflect/scala/reflect/internal/util/WeakHashSet.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D
4141
* power of two equal to or greater than the specified initial capacity
4242
*/
4343
private def computeCapacity = {
44-
if (initialCapacity < 0) throw new IllegalArgumentException("initial capacity cannot be less than 0");
44+
if (initialCapacity < 0) throw new IllegalArgumentException("initial capacity cannot be less than 0")
4545
var candidate = 1
4646
while (candidate < initialCapacity) {
4747
candidate *= 2
@@ -372,13 +372,13 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D
372372
* Number of buckets that hold collisions. Useful for diagnosing performance issues.
373373
*/
374374
def collisionBucketsCount: Int =
375-
(table filter (entry => entry != null && entry.tail != null)).size
375+
(table count (entry => entry != null && entry.tail != null))
376376

377377
/**
378378
* Number of buckets that are occupied in this hash table.
379379
*/
380380
def fullBucketsCount: Int =
381-
(table filter (entry => entry != null)).size
381+
(table count (entry => entry != null))
382382

383383
/**
384384
* Number of buckets in the table

src/reflect/scala/reflect/macros/Attachments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ abstract class Attachments { self =>
3939

4040
/** An underlying payload of the given class type `T`. */
4141
def get[T: ClassTag]: Option[T] =
42-
(all filter matchesTag[T]).headOption.asInstanceOf[Option[T]]
42+
(all find matchesTag[T]).asInstanceOf[Option[T]]
4343

4444
/** Check underlying payload contains an instance of type `T`. */
4545
def contains[T: ClassTag]: Boolean =

src/reflect/scala/reflect/runtime/ReflectionUtils.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ object ReflectionUtils {
7272
def singletonAccessor(clazz: Class[_]): Option[Method] =
7373
if (clazz == null) None
7474
else {
75-
val declaredAccessor = clazz.getDeclaredMethods.filter(_.getName == accessorName).headOption
75+
val declaredAccessor = clazz.getDeclaredMethods.find(_.getName == accessorName)
7676
declaredAccessor orElse singletonAccessor(clazz.getSuperclass)
7777
}
7878

@@ -92,7 +92,7 @@ object ReflectionUtils {
9292
}
9393

9494
class EnclosedIn[T](enclosure: jClass[_] => T) {
95-
def unapply(jclazz: jClass[_]): Option[T] = if (enclosure(jclazz) != null) Some(enclosure(jclazz)) else None
95+
def unapply(jclazz: jClass[_]): Option[T] = Option(enclosure(jclazz))
9696
}
9797

9898
object EnclosedInMethod extends EnclosedIn(_.getEnclosingMethod)

src/reflect/scala/reflect/runtime/SynchronizedOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private[reflect] trait SynchronizedOps extends internal.SymbolTable
1515

1616
override protected def newBaseTypeSeq(parents: List[Type], elems: Array[Type]) =
1717
// only need to synchronize BaseTypeSeqs if they contain refined types
18-
if (elems.filter(_.isInstanceOf[RefinedType]).nonEmpty) new BaseTypeSeq(parents, elems) with SynchronizedBaseTypeSeq
18+
if (elems.exists(_.isInstanceOf[RefinedType])) new BaseTypeSeq(parents, elems) with SynchronizedBaseTypeSeq
1919
else new BaseTypeSeq(parents, elems)
2020

2121
trait SynchronizedBaseTypeSeq extends BaseTypeSeq {
@@ -31,7 +31,7 @@ private[reflect] trait SynchronizedOps extends internal.SymbolTable
3131

3232
override def lateMap(f: Type => Type): BaseTypeSeq =
3333
// only need to synchronize BaseTypeSeqs if they contain refined types
34-
if (map(f).toList.filter(_.isInstanceOf[RefinedType]).nonEmpty) new MappedBaseTypeSeq(this, f) with SynchronizedBaseTypeSeq
34+
if (map(f).toList.exists(_.isInstanceOf[RefinedType])) new MappedBaseTypeSeq(this, f) with SynchronizedBaseTypeSeq
3535
else new MappedBaseTypeSeq(this, f)
3636
}
3737

src/scalap/scala/tools/scalap/CodeWriter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CodeWriter(writer: Writer) {
3535
def setIndentWidth(width: Int): CodeWriter =
3636
setIndentString(List.fill(width)(' ').mkString)
3737

38-
def getIndentString = step;
38+
def getIndentString = step
3939

4040
def setIndentString(step: String): CodeWriter = {
4141
this.step = step

src/scalap/scala/tools/scalap/Decode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ object Decode {
4949
import classFile._
5050

5151
classFile annotation SCALA_SIG_ANNOTATION map { case Annotation(_, els) =>
52-
val bytesElem = els find (x => constant(x.elementNameIndex) == BYTES_VALUE) getOrElse null
52+
val bytesElem = els find (x => constant(x.elementNameIndex) == BYTES_VALUE) orNull
5353
val _bytes = bytesElem.elementValue match { case ConstValueIndex(x) => constantWrapped(x) }
5454
val bytes = _bytes.asInstanceOf[StringBytesPair].bytes
5555
val length = ByteCodecs.decode(bytes)

src/scalap/scala/tools/scalap/JavaWriter.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer
164164
}
165165

166166
def printClass() {
167-
val pck = getPackage(cf.classname);
167+
val pck = getPackage(cf.classname)
168168
if (pck.length() > 0)
169169
println("package " + pck + ";")
170170
print(flagsToStr(true, cf.flags))
@@ -175,14 +175,14 @@ class JavaWriter(classfile: Classfile, writer: Writer) extends CodeWriter(writer
175175
printClassHeader;
176176
case Some(cf.Attribute(_, data)) =>
177177
val mp = new MetaParser(getName(
178-
((data(0) & 0xff) << 8) + (data(1) & 0xff)).trim());
178+
((data(0) & 0xff) << 8) + (data(1) & 0xff)).trim())
179179
mp.parse match {
180180
case None => printClassHeader;
181181
case Some(str) =>
182182
if (isInterface(cf.flags))
183-
print("trait " + getSimpleClassName(cf.classname) + str);
183+
print("trait " + getSimpleClassName(cf.classname) + str)
184184
else
185-
print("class " + getSimpleClassName(cf.classname) + str);
185+
print("class " + getSimpleClassName(cf.classname) + str)
186186
}
187187
}
188188
var statics: List[cf.Member] = Nil

src/scalap/scala/tools/scalap/MetaParser.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class MetaParser(meta: String) {
6464
case _: Exception => None
6565
}
6666
} else
67-
None;
67+
None
6868

6969
protected def parseMetaClass: String = {
7070
nextToken
@@ -100,7 +100,7 @@ class MetaParser(meta: String) {
100100
parseType
101101
} while (token == "with")
102102
}
103-
res.toString();
103+
res.toString()
104104
}
105105

106106
protected def parseMetaMethod: String = {
@@ -113,10 +113,10 @@ class MetaParser(meta: String) {
113113
var loop = true
114114
res.append("[")
115115
while (loop) {
116-
res.append(token.substring(1));
117-
nextToken;
116+
res.append(token.substring(1))
117+
nextToken
118118
if (token == "<") {
119-
nextToken;
119+
nextToken
120120
res.append(" <: ")
121121
parseType
122122
}
@@ -133,16 +133,16 @@ class MetaParser(meta: String) {
133133
if (token == "(") {
134134
do {
135135
if (token == ",") {
136-
nextToken;
136+
nextToken
137137
if (token != ")")
138138
res.append(", ")
139139
} else {
140-
nextToken;
140+
nextToken
141141
res.append("(")
142142
}
143143
if (token != ")") {
144144
if (token == "def") {
145-
nextToken;
145+
nextToken
146146
res.append("def ")
147147
}
148148
parseType

0 commit comments

Comments
 (0)