| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| |
| |
| |
| |
| | |
all conflicts were because the changes changed code that
doesn't exist anymore in 2.12; they were resolved with
`git checkout --ours`
c201eac changed bincompat-forward.whitelist.conf but
I dropped the change in this merge because it refers
to AbstractPromise which no longer exists in 2.12
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To avoid `sun.misc.Unsafe`, which is not supported on Google App Engine.
Deprecate `AbstractPromise` --> extend `j.u.c.atomic.AtomicReference` directly.
`AtomicReference.compareAndSet()` should also provide better performance on
HotSpot, which compiles it down to the machine's CAS instruction.
The binary incompatible change is ok because it's in an internal package.
I can't think of any real issue with adding a superclass (which contributes
only final methods) to a class in an implementation package (as long as
those methods were not introduced in any illicit subclasses of said class).
Instead of changing `DefaultPromise`'s super class, let's be more
conservative, and do it closest to the source. This is both clearer and more
focussed, leaving those subclasses of AbstractPromise we never heard of
unaffected.
Genesis of the commit: since the work on `Future` performance, `AbstractPromise`
is using `Unsafe`, breaking the ability for `Future` to be executed on GAE. At
that time, viktorklang suggested to implement a fallback in case `Unsafe` is
not available. carey proposed an implementation, and mchv submitted a patch,
which was refined by adriaanm.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Removed code based on Sun JDK sorts and implemented new (basic) sorts from
scratch. Deferred to Java Arrays.sort whenever practical. Behavior of
`scala.util.Sorting` should be unchanged, but changed documentation to
specify when the Java methods are being used (as they're typically very fast).
A JUnit test is provided.
Performance is important for sorts. Everything is better with this patch,
though it could be better yet, as described below.
Below are sort times (in microseconds, SEM < 5%) for various 1024-element
arrays of small case classes that compare on an int field (quickSort), or
int arrays that use custom ordering (stableSort). Note: "degenerate"
means there are only 16 values possible, so there are lots of ties.
Times are all with fresh data (no re-using cache from run to run).
Results:
```
random sorted reverse degenerate big:64k tiny:16
Old Sorting.quickSort 234 181 178 103 25,700 1.4
New Sorting.quickSort 170 27 115 74 18,600 0.8
Old Sorting.stableSort 321 234 236 282 32,600 2.1
New Sorting.stableSort 239 16 194 194 25,100 1.2
java.util.Arrays.sort 124 4 8 105 13,500 0.8
java.util.Arrays.sort|Box 126 15 13 112 13,200 0.9
```
The new versions are uniformly faster, but uniformly slower than Java sorting. scala.util.Sorting has use cases that don't map easily in to Java unless everything is pre-boxed, but the overhead of pre-boxing is minimal compared to the sort.
A snapshot of some of my benchmarking code is below.
(Yes, lots of repeating myself--it's dangerous not to when trying to get
somewhat accurate benchmarks.)
```
import java.util.Arrays
import java.util.Comparator
import math.Ordering
import util.Sorting
import reflect.ClassTag
val th = ichi.bench.Thyme.warmed()
case class N(i: Int, j: Int) {}
val a = Array.fill(1024)( Array.tabulate(1024)(i => N(util.Random.nextInt, i)) )
var ai = 0
val b = Array.fill(1024)( Array.tabulate(1024)(i => N(i, i)) )
var bi = 0
val c = Array.fill(1024)( Array.tabulate(1024)(i => N(1024-i, i)) )
var ci = 0
val d = Array.fill(1024)( Array.tabulate(1024)(i => N(util.Random.nextInt(16), i)) )
var di = 0
val e = Array.fill(16)( Array.tabulate(65536)(i => N(util.Random.nextInt, i)) )
var ei = 0
val f = Array.fill(65535)( Array.tabulate(16)(i => N(util.Random.nextInt, i)) )
var fi = 0
val o = new Ordering[N]{ def compare(a: N, b: N) = if (a.i < b.i) -1 else if (a.i > b.i) 1 else 0 }
for (s <- Seq("one", "two", "three")) {
println(s)
th.pbench{ val x = a(ai).clone; ai = (ai+1)%a.length; Sorting.quickSort(x)(o); x(x.length/3) }
th.pbench{ val x = b(bi).clone; bi = (bi+1)%b.length; Sorting.quickSort(x)(o); x(x.length/3) }
th.pbench{ val x = c(ci).clone; ci = (ci+1)%c.length; Sorting.quickSort(x)(o); x(x.length/3) }
th.pbench{ val x = d(di).clone; di = (di+1)%d.length; Sorting.quickSort(x)(o); x(x.length/3) }
th.pbench{ val x = e(ei).clone; ei = (ei+1)%e.length; Sorting.quickSort(x)(o); x(x.length/3) }
th.pbench{ val x = f(fi).clone; fi = (fi+1)%f.length; Sorting.quickSort(x)(o); x(x.length/3) }
}
def ix(ns: Array[N]) = {
val is = new Array[Int](ns.length)
var i = 0
while (i < ns.length) {
is(i) = ns(i).i
i += 1
}
is
}
val p = new Ordering[Int]{ def compare(a: Int, b: Int) = if (a > b) 1 else if (a < b) -1 else 0 }
for (s <- Seq("one", "two", "three")) {
println(s)
val tag: ClassTag[Int] = implicitly[ClassTag[Int]]
th.pbench{ val x = ix(a(ai)); ai = (ai+1)%a.length; Sorting.stableSort(x)(tag, p); x(x.length/3) }
th.pbench{ val x = ix(b(bi)); bi = (bi+1)%b.length; Sorting.stableSort(x)(tag, p); x(x.length/3) }
th.pbench{ val x = ix(c(ci)); ci = (ci+1)%c.length; Sorting.stableSort(x)(tag, p); x(x.length/3) }
th.pbench{ val x = ix(d(di)); di = (di+1)%d.length; Sorting.stableSort(x)(tag, p); x(x.length/3) }
th.pbench{ val x = ix(e(ei)); ei = (ei+1)%e.length; Sorting.stableSort(x)(tag, p); x(x.length/3) }
th.pbench{ val x = ix(f(fi)); fi = (fi+1)%f.length; Sorting.stableSort(x)(tag, p); x(x.length/3) }
}
for (s <- Seq("one", "two", "three")) {
println(s)
th.pbench{ val x = a(ai).clone; ai = (ai+1)%a.length; Arrays.sort(x, o); x(x.length/3) }
th.pbench{ val x = b(bi).clone; bi = (bi+1)%b.length; Arrays.sort(x, o); x(x.length/3) }
th.pbench{ val x = c(ci).clone; ci = (ci+1)%c.length; Arrays.sort(x, o); x(x.length/3) }
th.pbench{ val x = d(di).clone; di = (di+1)%d.length; Arrays.sort(x, o); x(x.length/3) }
th.pbench{ val x = e(ei).clone; ei = (ei+1)%e.length; Arrays.sort(x, o); x(x.length/3) }
th.pbench{ val x = f(fi).clone; fi = (fi+1)%f.length; Arrays.sort(x, o); x(x.length/3) }
}
def bx(is: Array[Int]): Array[java.lang.Integer] = {
val Is = new Array[java.lang.Integer](is.length)
var i = 0
while (i < is.length) {
Is(i) = java.lang.Integer.valueOf(is(i))
i += 1
}
Is
}
def xb(Is: Array[java.lang.Integer]): Array[Int] = {
val is = new Array[Int](Is.length)
var i = 0
while (i < is.length) {
is(i) = Is(i).intValue
i += 1
}
is
}
val q = new Comparator[java.lang.Integer]{
def compare(a: java.lang.Integer, b: java.lang.Integer) = o.compare(a.intValue, b.intValue)
}
for (s <- Seq("one", "two", "three")) {
println(s)
val tag: ClassTag[Int] = implicitly[ClassTag[Int]]
th.pbench{ val x = bx(ix(a(ai))); ai = (ai+1)%a.length; Arrays.sort(x, q); xb(x)(x.length/3) }
th.pbench{ val x = bx(ix(b(bi))); bi = (bi+1)%b.length; Arrays.sort(x, q); xb(x)(x.length/3) }
th.pbench{ val x = bx(ix(c(ci))); ci = (ci+1)%c.length; Arrays.sort(x, q); xb(x)(x.length/3) }
th.pbench{ val x = bx(ix(d(di))); di = (di+1)%d.length; Arrays.sort(x, q); xb(x)(x.length/3) }
th.pbench{ val x = bx(ix(e(ei))); ei = (ei+1)%e.length; Arrays.sort(x, q); xb(x)(x.length/3) }
th.pbench{ val x = bx(ix(f(fi))); fi = (fi+1)%f.length; Arrays.sort(x, q); xb(x)(x.length/3) }
}
```
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Generate alphanumeric values by taking random element of string
containing all alphanumerics.
Instead of generating nextPrintableChar then filtering for
alphanumerics, we can just take from a string containing all
alphanumerics. This provides a significant performance improvement.
|
|\|
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
build.number
src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala
src/library/scala/collection/Iterator.scala
versions.properties
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit contains some minor changes made by the way when
implementing flat classpath.
Sample JUnit test that shows that all pieces of JUnit infrastructure
work correctly now uses assert method form JUnit as it should do from
the beginning.
I removed commented out lines which were obvious to me. In the case
of less obvious commented out lines I added TODOs as someone should
look at such places some day and clean them up.
I removed also some unnecessary semicolons and unused imports.
Many string concatenations using + have been changed to string
interpolation.
There's removed unused, private walkIterator method from ZipArchive.
It seems that it was unused since this commit:
https://github.com/scala/scala/commit/9d4994b96c77d914687433586eb6d1f9e49c520f
However, I had to add an exception for the compatibility checker
because it was complaining about this change.
I made some trivial corrections/optimisations like use 'findClassFile'
method instead of 'findClass' in combination with 'binary' to find
the class file.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit adds an implementation of flat classpath which can handle
both jar and vanilla zip files. In fact there are two versions - for
a class- and a sourcepath. Both extend ZipArchiveFileLookup which
provides common logic.
They use FileZipArchive. @gkossakowski made a comparison of different
ways of handling zips and jars (e.g. using javac's ZipFileIndex). He
stated that general efficiency of FileZipArchive, taking into account
various parameters, is the best.
FileZipArchive is slightly changed. From now it allows to find the
entry for directory in all directory entries without iterating all
entries regardless of a type. Thanks to that we can simply find
a directory for a package - like in the case of DirectoryFileLookup.
There's also added possibility to cache classpath representation of
classpath elements from jar and zip files across compiler instances.
The cache is just a map AbstractFile -> FlatClassPath. It should
reduce the number of created classpath and file instances e.g. in the
case of many ScalaPresentationCompilers in Scala IDE.
To prevent the possibility to avoid a cache, caches are created as
a part of factories responsible for the creation of these types of
the flat classpath.
|
|/
|
|
|
|
|
|
|
| |
This reverts commit 9276a1205f74fdec74206209712831913e93f359.
The change is not binary compatible, See discussion on SI-8899. Making
filterImpl non-private changes its call-sites (within TraversableLike)
from INVOKESTATIC to INVOKEINTERFACE. Subclasses of TraversableLike
compiled before this change don't have a mixin for filterImpl.
|
|
|
|
|
|
|
|
|
|
| |
Used the standard method of sending out two iterators, one twice as fast as the others, to avoid hanging on .force, .hasDefiniteSize, and .addString.
.addString appends a "..." as the last element if it detects a cycle. It knows how to print the cycle length, but there's no good way to specify what you want right now, so it's not used.
Added tests in t8680 that verify that cyclic streams give the expected results.
Added to whitelist names of methods formerly used for recursion (now looping).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The obvious fix, overriding `filterNot` in Stream, is not binary
compatible, see https://github.com/scala/scala/pull/3925
Instead, this makes `filterImpl` in TaversableLike private[scala],
which allows overriding it in Stream. The corresponding mima-failures
can be whitelisted, as the changes are only to private[scala].
In 2.12.x we can remove the override of `filter` in Stream, but in
2.11.x this is not binary compatible.
Eventually we'd also like to make filter / filterNot in
TraversableLike final, but that's not source compatible, so it cannot
be done in 2.12.x.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Make TypeCreator and TreeCreator extend Serializable.
- When replacing a SerializedTypeTag with a TypeTag or WeakTypeTag,
do not use scala.reflect.runtime.universe.rootMirror, since
it is unlikely to find user classes; instead, create a runtime
mirror using the context ClassLoader of the current thread.
Use the same logic for SerializedExpr.
- Remove writeObject/readObject methods from SerializedTypeTag
and SerializedExpr since they are unused.
- Add @throws annotation on writeReplace and readResolve methods.
- Handle SecurityException if the current thread cannot access the
context ClassLoader.
- To make type tags of primitive value classes serializable, make
PredefTypeCreator a top-level class. Otherwise, it would
retain a reference to the enclosing Universe,
rendering the TypeCreator non-serializable.
Binary compatibility:
- Keep nested PredefTypeCreator class to avoid backward binary
incompatible change.
- Keep `var` modifiers on the class parameters of
SerializedTypeTag for backward binary compatibility.
- Adds filter rules to forward binary compatibility whitelist:
- `TypeCreator`, `PredefTypeCreator`, and `TreeCreator` must now
extend from `Serializable`.
- Must have new class `scala.reflect.api.PredefTypeCreator`
to avoid problematic outer reference.
|
|
|
|
|
|
|
|
| |
This moves us a bit closer to the goal of having a single
entry point to reporting.
Must modularize Reporting a bit so it can be used in Variances
(need a reference to `currentRun` in `reflect.internal.Reporting`).
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sharpen interfaces, reduce footprint of Reporting trait.
Ideally, all reporting should indirect through reporter,
and the `Reporting` trait itself should be restricted to
a single method that retrieves the current `reporter`.
Pull up some more reporting to reflect.internal.
Would like to do more, but need to move partest to the
reflect.internal interface first.
(Its `errorCount` relies on `ERROR.count` in `tools.nsc.Reporter`.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move code from Global/SymbolTable to separate Reporting traits to
start carving out an interface in scala.reflect.internal.Reporting,
with internals in scala.tools.nsc. Reporting is mixed into the cake.
It contains a nested class PerRunReporting.
Should do the same for debugging/logging.
The idea is that CompilationUnit and Global forward all reporting
to Reporter. The Reporting trait contains these forwarders, and
PerRunReporting, which accumulates warning state during a run.
In the process, I slightly changed the behavior of `globalError`
in reflect.internal.SymbolTable: it used to abort, weirdly.
I assume that was dummy behavior to avoid introducing an abstract method.
It's immediately overridden in Global, and I couldn't find any other subclasses,
so I don't think the behavior in SymbolTable was ever observed.
Provide necessary hooks for scala.reflect.macros.Parsers#parse.
See scala/reflect/macros/contexts/Parsers.scala's parse method,
which overrides the reporter to detect when parsing goes wrong.
This should be refactored, but that goes beyond the scope of this PR.
Don't pop empty macro context stack.
(Ran into this while reworking -Xfatal-warnings logic.)
Fix -Xfatal-warnings behavior (and check files): it wasn't meant to
influence warning reporting, except for emitting one final error;
if necessary to fail the compile (when warnings but no errors were reported).
Warnings should stay warnings.
This was refactored in fbbbb22946, but we soon seem to have relapsed.
An hour of gitfu did not lead to where it went wrong. Must've been a merge.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can copy the hash table from the parent scope, rather
than constructing it from scratch.
This takes us to:
% rm -rf /tmp/pkg; (for i in {1..50}; do for j in {1..100}; do echo "package pkg { class A_${i}_${j}___(val a: Int, val b: Int) }"; done; done) > sandbox/A1.scala && time qbin/scalac -Ybackend:GenASM -J-Xmx1G -J-XX:MaxPermSize=400M -d /tmp sandbox/A1.scala;
real 0m19.639s // head~1 was 0m35.662s
user 0m41.683s // head~1 was 0m58.275s
sys 0m1.886s
In more detail, this commit:
- Removes the unused `fingerprint` constructor parameter from
scopes. This is a remnant from a previous optimization attempt
- Leave only one constructor on Scope which creates an empty
scope
- Update the factory method, `newNestedScope`, to copy the hash
table from the parent if it exists. We can rely on the invariant
that `outer.hashTable != null || outer.size < MIN_HASH)`, so we
don't need `if (size >= MIN_HASH) createHash()` anymore. This
used to be needed in `Scope#<init>`, which accepted an aribitrary
`initElems: ScopeEntry`.
- Update subclasses and factories of `Scope` in runtime reflection
to accomodate the change. Pleasingly, we could actually remove
the override for `newNestedScope`.
- Unit tests the functionality I'm touching
|
|\
| |
| |
| |
| |
| | |
Conflicts:
bincompat-forward.whitelist.conf
src/reflect/scala/reflect/runtime/JavaMirrors.scala
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Scala's runtime reflection works in few modes. The primary mode reads
reads out the pickled signatures from ScalaSig annotations, if
avaialable. However, these aren't available for Java-defined classes
(obviously) nor for local Scala-defined classes (less obviously.),
and the Scala `Symbol`s and `Types` must be reconstructed from
the Java generic reflection metadata.
This bug occurs in the last case, and is centered in
`FromJavaClassCompleter`.
In that completer, member fields and methods are given an owner
based on the STATIC modifier. That makes sense for Java defined
classes. I'm not 100% if it makes sense for Scala defined classes;
maybe we should just skip them entirely?
This patch still includes them, but makes the ownership-assignment
more robust in the face of STATIC members emitted by the Scala
compiler backend, such as the cache fields for structural calls.
(It's reflection all the way down!). We might not have a companion
module at all, so before we ended up owning those by `NoSymbol`,
and before too long hit the dreaded NSDHNAO crash.
That crash doesn't exist any more on 2.11 (it is demoted to a
-Xdev warning), but this patch still makes sense on that branch.
This commit makes `followStatic` and `enter` more robust when
finding a suitable owner for static members. I've also factored
out the duplicated logic between the two.
|
| |
| |
| |
| |
| |
| |
| | |
scala.reflect.internal._ now gets a free pass from binary
compatibility checking.
Previously, we had to excrutiatingly exclude violations individually.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The bug report suggests this problem only became visible in the
IDE *after* 2.10.3, but I tested an IDE with exactly 2.10.3 and
saw the same problem.
In fact, my test case fails as far back as 2.10.0. I suspect the
problem showed up after 816cecf9a9, which checks that pairs of
companion symbols are codefined eagerly in Namers.
This commit modifies the check of `rawInfo ne NoType`
in `isCoDefinedWith` to avoid triggering adaptation of types from
the previous run. I'm not sure of the precise intent of that check.
I looked at c9861cd198 (genesis of isCoDefinedWith). Before that we
get back to 3761cb4b3a1 (the dawn of Subversion.)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A class should not be required to implement a Java default method.
This commit uses `isDeferredNotDefault` in place of `isDeferred`
when finding unimplemented methods.
The test itself does not depend on Java 8 as we use scalac's
Java source parser to set things up.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Currently type uniqueness is done via a HashSet[Type], but
that means the Types live through an entire compile session, even
ones that are used once. The result is a huge amount of unnecessarily
retained memory. This commit uses a WeakHashSet instead so that Types
and their WeakReferences are cleaned up when no longer in use.
|
| |
| |
| |
| |
| |
| |
| | |
Replaces scala.reflect.internal.WeakHashSet with a version that
* extends the mutable.Set trait
* doesn't leak WeakReferences
* is unit tested
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We have to assume that the classes we are reflecting on were
compiled with the default value for -Xmax-classfile-name (255).
With this assumption, we can apply the same name compactification
as done in the regular compiler.
The REPL is particularly prone to generating long class names
with the '$iw' prefixes, so this is an important fix for runtime
reflection.
Also adds support for getting the runtime class of `O.type` if
`O` is a module.
|
| |\
| | |
| | | |
[nomaster] macro expansions are now auto-duplicated
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The fix still requires macro developers to be careful about sharing trees
by references, because attributed DefTrees will still bring trouble.
However this is an improvement, because it doesn't make matters worse
and automatically fixes situations similar to one in the test.
A much more thorough discussion with a number of open questions left:
http://groups.google.com/group/scala-internals/browse_thread/thread/492560d941b315cc
Was fixed ages ago in master in one of the paradise backports.
Never got to 2.10.x, but it's very useful, so I'm backporting it now.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Synthetic defs introduced by transforms like named/default arguments,
ANF (in scala-async) often introduce a type tree (the tpt of the temporary)
that are based on the types of expressions. These types are scrutinized in
RefChecks to check that type parameter bounds are satisfied.
However, the type of the expression might be based on slack a LUB that
fails to capture constraints between type parameters.
This slackness is noted in `mergePrefixAndArgs`:
// Martin: I removed this, because incomplete. Not sure there is a
// good way to fix it. For the moment we just err on the conservative
// side, i.e. with a bound that is too high.
The synthesizer can now opt out of bounds by annotating the type as follows:
val temp: (<expr.tpe> @uncheckedBounds) = expr
This facility is now used in named/default arguments for the temporaries
used for the reciever and arguments.
The annotation is hidden under scala.reflect.internal, rather than in
the more prominent scala.annotation.unchecked, to reflect the intention
that it should only be used in tree transformers.
The library component of this change and test case will be included in the
next commit. Why split like this? It shows that the 2.10.3 compiler will
work with 2.10.2 scala-reflect.jar.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously PackageScopes from scala.reflect ignored all classes that
had $'s in non-rightmost positions in their names.
Unfortunately this behaviour is inconsistent with how scalac does things,
and I reconciled this as usual, by pulling corresponding logic into
scala-reflect.jar and sharing it between runtime reflection and compiler.
This change has seprate pull requests for 2.10.x and 2.11.0. The latter
deprecates `scala.tools.nsc.util.ClassPath.isTraitImplementation`
whereas the former (which you're looking at right now) does not, because
we can't deprecated members in minor releases.
|
| |
| |
| |
| |
| |
| |
| | |
Apparently there are still discrepancies between how the vanilla compiler
turns class files into symbols and how the reflective compiler does it.
Working on bringing these guys in sync, one bug at a time.
|
| |\
| | |
| | | |
SI-7336 Link flatMapped promises to avoid memory leaks
|
| | | |
|
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`getClass` is special cased in the compiler; this is described
in in the comments on `Definitions.Any_getClass`.
Part of this happens in `Typer#stabilize`. This was trying to determine
if an Ident or Select node was a call to `getClass` by merits of the name
of the tree's symbol and by checking that the its type (if it was a
MethodType or PolyType) had no parameters in the primary parameter list.
Overloaded user defined `getClass` methods confused this check. In the
enclosed test case, the tree `definitions.this.getClass` had an
`OverloadedType`, and such types always report an empty list of `params`.
This commit:
- changes `stabilize` to use `isGetClass`, rather than the
homebrew check
- changes `isGetClass` to consider a `Set[Symbol]` containing all
`getClass` variants. This moves some similar code from `Erasure`
to `Definitions`
- keeps a fast negative path in `isGetClass` based on the symbol's name
|
| |
| |
| |
| |
| |
| |
| |
| | |
Optimizations:
1) Avoiding to call 'synchronized' in tryComplete and in tryAwait
2) Implementing blocking by using an optimized latch so no blocking ops for non-blockers
3) Reducing method size of isCompleted to be cheaper to inline
4) 'result' to use Try.get instead of patmat
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Updates ForkJoinPool and dependent classes to the latest jsr166y revisions:
ForkJoinPool.java:
Revision 1.185
Sat Feb 16 20:50:29 2013 UTC (2 months, 2 weeks ago) by jsr166
ForkJoinTask.java:
Revision 1.100
Tue Feb 5 17:09:54 2013 UTC (3 months ago) by jsr166
ForkJoinWorkerThread.java:
Revision 1.73
Wed Nov 21 19:54:39 2012 UTC (5 months, 2 weeks ago) by dl
- Includes Akka-contributed `sun.misc.Unsafe` detection to support Android.
See changeset 06d685c1bbd8a0d058ee8a3f374569f8097f2acc
- Adds private `CountedCompleter` class.
This class is only visible and used in `ForkJoinPool.java`.
- Updates desired.sha1 for updated forkjoin.jar.
- Updates binary compatibility whitelists to exclude package-private methods
in the `forkjoin` package.
- Also fixes SI-7438.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In classfile parser: mark symbols which represent interface
methods yet have code attributes with new flag DEFAULTMETHOD.
These must be kept distinct from regular method bodies so that
an error can be issued when a regular concrete method is
overridden without the override keyword, but not when the
overridden method is a default.
In java source parser: mark Modifiers of interface default
methods with DEFAULTMETHOD flag.
Writing the test was everything I dreamed, and more! However,
% test/partest --debug test/files/run/t7398.scala
Skipping java8-specific test under java version 1.7.0_21
testing: [...]/files/run/t7398.scala [ OK ]
All of 1 tests were successful (elapsed time: 00:00:04)
% test/partest --debug test/files/run/t7398.scala
Attempting java8-specific test under java version 1.8.0-ea
testing: [...]/files/run/t7398.scala [ OK ]
All of 1 tests were successful (elapsed time: 00:00:13)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In 692372ce, we added a warning (under -Xlint) when binding
a `TupleN` in to a single pattern binder, which wasn't allowed
before 2.10.0, and more often than not represents a bug.
However, that warning overstretched, and warned even when
using a Tuple Pattern to bind to the elements of such a value.
This commit checks for this case, and avoids the spurious warnings.
A new test case is added for this case to go with the existing
test for SI-6675:
$ ./tools/partest-ack 6675
% tests-with-matching-paths ... 3
% tests-with-matching-code ... 2
# 3 tests to run.
test/partest --show-diff --show-log \
test/files/neg/t6675-old-patmat.scala \
test/files/neg/t6675.scala \
test/files/pos/t6675.scala \
""
Testing individual files
testing: [...]/files/pos/t6675.scala [ OK ]
Testing individual files
testing: [...]/files/neg/t6675-old-patmat.scala [ OK ]
testing: [...]/files/neg/t6675.scala [ OK ]
All of 3 tests were successful (elapsed time: 00:00:03)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a type constructor variable is applied to the wrong number of arguments,
return a new type variable whose instance is `ErrorType`.
Dissection of the reported test case by @retronym:
Define the first implicit:
scala> trait Schtroumpf[T]
defined trait Schtroumpf
scala> implicit def schtroumpf[T, U <: Coll[T], Coll[X] <: Traversable[X]]
| (implicit minorSchtroumpf: Schtroumpf[T]): Schtroumpf[U] = ???
schtroumpf: [T, U <: Coll[T], Coll[X] <: Traversable[X]](implicit minorSchtroumpf: Schtroumpf[T])Schtroumpf[U]
Call it explicitly => kind error during type inference reported.
scala> schtroumpf(null): Schtroumpf[Int]
<console>:10: error: inferred kinds of the type arguments (Nothing,Int,Int) do not conform to the expected kinds of the type parameters (type T,type U,type Coll).
Int's type parameters do not match type Coll's expected parameters:
class Int has no type parameters, but type Coll has one
schtroumpf(null): Schtroumpf[Int]
^
<console>:10: error: type mismatch;
found : Schtroumpf[U]
required: Schtroumpf[Int]
schtroumpf(null): Schtroumpf[Int]
^
Add another implicit, and let implicit search weigh them up.
scala> implicitly[Schtroumpf[Int]]
<console>:10: error: diverging implicit expansion for type Schtroumpf[Int]
starting with method schtroumpf
implicitly[Schtroumpf[Int]]
^
scala> implicit val qoo = new Schtroumpf[Int]{}
qoo: Schtroumpf[Int] = $anon$1@c1b9b03
scala> implicitly[Schtroumpf[Int]]
<crash>
Implicit search compares the two in-scope implicits in `isStrictlyMoreSpecific`,
which constructs an existential type:
type ET = Schtroumpf[U] forSome { type T; type U <: Coll[T]; type Coll[_] <: Traversable[_] }
A subsequent subtype check `ET <:< Schtroumpf[Int]` gets to `withTypeVars`, which
replaces the quantified types with type variables, checks conformance of that
substitued underlying type against `Schtroumpf[Int]`, and then tries to solve
the collected type constraints. The type var trace looks like:
[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing )
[ setInst] scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=scala.collection.immutable.Nil.type )
[ setInst] =?scala.collection.immutable.Nil.type( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?scala.collection.immutable.Nil.type )
[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Int )
[ create] ?T ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?U ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ create] ?Coll ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]] )
[ setInst] Nothing ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], T=Nothing )
[ setInst] Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], U=Int )
[ setInst] =?Int ( In Test#schtroumpf[T,U <: Coll[T],Coll[_] <: Traversable[_]], Coll==?Int )
The problematic part is when `?Int` (the type var originated from `U`) is registered
as a lower bound for `Coll`. That happens in `solveOne`:
for (tparam2 <- tparams)
tparam2.info.bounds.hi.dealias match {
case TypeRef(_, `tparam`, _) =>
log(s"$tvar addLoBound $tparam2.tpeHK.instantiateTypeParams($tparams, $tvars)")
tvar addLoBound tparam2.tpeHK.instantiateTypeParams(tparams, tvars)
case _ =>
}
|
| |
| |
| |
| |
| |
| |
| | |
For imminent reuse in the subsequent commit.
The binary compatibility whitelist is updated to
ignore these, as they live in reflect.internal.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This commit makes the ClassFileReader/ICodeReader parse class files
from JDK 7 (class file version 51). It does that by skipping over
the method handle related entries in the constant pool and by doing
some dummy processing on invoke dynamic instructions. The inliner
is updated to not try to inline a method with an invoke dynamic
instruction. A place holder INVOKE_DYNAMIC instruction is added to ICode
but it is designed to create an error if there's ever any attempt to
analyze it. Because the inliner is the only phase that ever tries
to analyze ICode instructions not generated from Scala source and
because Scala source will never emit an INVOKE_DYNAMIC, the place
holder INVOKE_DYNAMIC should never cause any errors.
A test is included that generates a class file with INVOKE_DYNAMIC
and then compiles Scala code that depends on it.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 54a84a36d5b435a787d93ca48d45399136c7e162.
This is necessary to maintain binary compatibility with 2.10.0.
run/t6989.check had to be updated as it also (indirectly) tested SI-6548
Conflicts:
test/files/lib/javac-artifacts.jar.desired.sha1
test/files/run/t6548.check
test/files/run/t6548/Test_2.scala
|
| |
| |
| |
| |
| |
| | |
This reworks 02ed5fb so that we don't change JavaUniverse's super classes.
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| | |
This reverts commit 0429f0fd9224499cd8b606490d04b1a8dcffbca8.
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| | |
Inlined AdaptedForkJoinTask, made uncaughtExceptionHandler private[this].
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| | |
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Reworks d526f8bd74.
This is necessary to maintain binary compatibility with 2.10.0.
matchName="scala.collection.mutable.MutableList.tailImpl"
problemName=MissingMethodProblem
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Also revert "SI-4664 [Make scala.util.Random Serializable] Add test case"
This reverts commit 0b92073a38f9d1823f051ac18173078bfcfafc8a.
This reverts commit 2aa66bec86fd464712b0d15251cc400ff9d52821.
This is necessary to maintain binary compatibility with 2.10.0.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit a557a973608a75c7a02f251bbcf49fe6f6b6655e.
This is necessary to maintain binary compatibility with 2.10.0.
Mima says:
matchName="scala.collection.immutable.Range.head"
problemName=IncompatibleResultTypeProblem
The bridge method appeared because result is now Int, whereas
the super-method's result type erases to Object
|
|
|
|
|
|
|
|
|
|
| |
Using @gkossakowski's contribution to mima (in 0.1.5-SNAPSHOT),
make sure bc.run doesn't fail by filtering out all binary incompatibilities.
Each subsequent commit will comment out the filters it makes irrelevant,
until we only need to filter out permitted binary incompatibilities.
We only allow binary incompatibilities in scala.reflect.internal.
|