| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
SI-9375 add synthetic readResolve only for static modules
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For inner modules, the synthetic readResolve method would cause the
module constructor to be invoked on de-serialization in certain
situations. See the discussion in the ticket.
Adds a comprehensive test around serializing and de-serializing
modules.
|
|\ \
| | |
| | | |
SI-6806 Add an @implicitAmbiguous annotation
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Example usage:
trait =!=[C, D]
implicit def neq[E, F] : E =!= F = null
@annotation.implicitAmbiguous("Could not prove ${J} =!= ${J}")
implicit def neqAmbig1[G, H, J] : J =!= J = null
implicit def neqAmbig2[I] : I =!= I = null
implicitly[Int =!= Int]
Which gives the following error:
implicit-ambiguous.scala:9: error: Could not prove Int =!= Int
implicitly[Int =!= Int]
^
Better than what was previously given:
implicit-ambiguous.scala:9: error: ambiguous implicit values:
both method neqAmbig1 in object Test of type [G, H, J]=> Main.$anon.Test.=!=[J,J]
and method neqAmbig2 in object Test of type [I]=> Main.$anon.Test.=!=[I,I]
match expected type Main.$anon.Test.=!=[Int,Int]
implicitly[Int =!= Int]
^
|
|\ \ \
| | | |
| | | | |
SI-6810 Disallow EOL in char literal
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It's clear that char literals are one-lined like normal
string literals.
By the same token, pun intended, char literals accept
unicode escapes the same as string literals, including
`\u000A`.
This commit adds the usual exclusions (CR, NL, SU).
The spec is outdated in outlawing chars that are not
"printable", in particular, the ASCII control codes.
The original intention may have been that the ordinary
string escapes are required, such as "\b\n". Note that
some common escapes are absent, such as "\a".
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
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
|
| | | | | |
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-1931 Hide Predef.any2stringadd in REPL
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
User imports that reference Predef are relocated to the top of
the wrapping template so that they can hide implicits defined
in Predef.
Only one import from Predef is retained for special treatment.
This is simple and sane. The test shows that `import Predef._`
restores Predef implicits even if a user-defined term would
normally be in scope.
A smart `:import` command to turn off or quarantine imports explicitly
would allow fine-grained control.
|
| |\ \ \ \ \
| | | | | | |
| | | | | | | |
SI-9425 Leave Companion.apply if constructor is less accessible
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Calls to synthetic case class apply methods are inlined to the
underlying constructor invocation in refchecks.
However, this can lead to accessibility errors if the constructor
is private.
This commit ensures that the constructor is at least as accessible
as the apply method before performing this tranform.
I've manually checked that other the optimization still works in other
cases:
scala> class CaseApply { Some(42) }
defined class CaseApply
scala> :javap -c CaseApply
Compiled from "<console>"
public class CaseApply {
public CaseApply();
Code:
0: aload_0
1: invokespecial #9 // Method java/lang/Object."<init>":()V
4: new #11 // class scala/Some
7: dup
8: bipush 42
10: invokestatic #17 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
13: invokespecial #20 // Method scala/Some."<init>":(Ljava/lang/Object;)V
16: pop
17: return
}
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-6938 Use mutable red-black tree in `mutable.TreeSet`
|
| | |_|_|_|/ /
| |/| | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The previous implementation of `mutable.TreeSet` uses a mutable reference to an immutable red-black tree as its underlying data structure. That leads to unnecessary objects being created, which can be a problem in systems with limited resources. It also has reduced performance when compared with common mutable implementations.
In this commit `mutable.TreeSet` is changed so that it uses the recently created `mutable.RedBlackTree` as its underlying data structure. Specialized red-black tree methods were created for working with keys for efficiency reasons. The new implementation is source-compatible with the previous one, although its serialized representation obviously changes.
Closes [SI-6938](https://issues.scala-lang.org/browse/SI-6938).
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-8554 Two-arg remove now throws exception on overly-large count
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
ListBuffer now throws exceptions like other buffers do when trying to index out of range.
Also harmonized the order of testing (`count < 0` tested before `n` in range).
Test in scala-collection-laws (gated by SI8554 flag). Also modified test in run/t6634.scala
|
|\ \ \ \ \ \ \ \
| |_|/ / / / / /
|/| | / / / / /
| | |/ / / / /
| |/| | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Transcript:
```
➜ scala git:(2.12.x) export MB=$(git merge-base 2.12.x 2.11.x)
➜ scala git:(2.12.x) echo $MB
0e9525aa618a2eca143a1c7379ff1e6efd23b86e
➜ scala git:(2.12.x) g log --oneline --graph $MB...2.11.x
```
Read this upside down :-). The last merge comes first,
with merge commands interspersed in the git log.
```
➜ scala git:(2.12.x) g merge 2.11.x
Auto-merging versions.properties
Auto-merging src/reflect/scala/reflect/internal/pickling/UnPickler.scala
Auto-merging src/reflect/scala/reflect/internal/Types.scala
Auto-merging src/reflect/scala/reflect/internal/TreeGen.scala
Auto-merging src/library/scala/collection/immutable/Stream.scala
Auto-merging src/library/scala/collection/convert/Wrappers.scala
Auto-merging build.xml
CONFLICT (content): Merge conflict in build.xml
Auto-merging README.md
Automatic merge failed; fix conflicts and then commit the result.
```
```
* 928e6892d4 (scala/2.11.x, 2.11.x) Merge pull request #4682 from adriaanm/jline-quick.bin
|\
| * b763dbf368 (adriaanm/jline-quick.bin, jline-quick.bin) Include jline on quick.bin tool path
* | ccded7d179 Merge pull request #4680 from janekdb/2.11.x-option
|\ \
| |/
|/|
| * 58ae3e51f7 Delegate null test to Option
|/
* a745f06e35 Merge pull request #4670 from retronym/ticket/9422
|\
| * ec95e534a2 SI-9422 Fix incorrect constant propagation
* 65fa73dff3 Merge pull request #4669 from janekdb/2.11.x-scaladoc-reflect
|\
| * e206a1837d ScalaDoc fixes for reflect
* | 8e7e3b4a5f Merge pull request #4667 from janekdb/2.11.x-scaladoc-library-library-aux
|\ \
| |/
|/|
| * 69c2c106fe ScalaDoc fixes for library and library-aux
* | 7de4cbc5e5 Merge pull request #4665 from lrytz/asm-504-3
|\ \
| * | cdc55c29d0 Upgrade scala-asm to 5.0.4-scala-3
|/ /
* | d8da39a197 Merge pull request #4661 from retronym/ticket/9365
|\ \
| * | 0c99742c51 SI-9365 Don't null out dependencies of transient lazy vals
| /
* | 2279d3f3d9 Merge pull request #4662 from janekdb/2.11.x-redundant-val-modifier
|\ \
| * | 173a6fad95 Remove redundant 'val' from case class params.
* | | e0d21432d6 Merge pull request #4664 from SethTisue/remove-dead-link-in-readme
|\ \ \
| |_|/
|/| |
| * | 600fc4e6e1 fix readme for death of typesafe.artifactoryonline.com
| |/
* | 7492bda816 Merge pull request #4636 from SethTisue/contributor-stuff-from-github-wiki
|\ \
| |/
|/|
| * ed5098dbc4 merge two reviewers lists in readme
| * e136e4ad47 tighten up CONTRIBUTING.md a little
| * f9ca6863d4 readme/contributor's guide tweaks
| * 80e98b03a1 tiny readme fix
| * 197845620c merge in text from pull request policy from old wiki
| * e93ca409ae drop in pull request policy from old wiki
| * 951939d1b3 contributor guide: add a morsel salvaged from GitHub wiki
* f682441f6f Merge pull request #4653 from lrytz/t9403
|\
| * 2678d349b2 SI-9403 fix ICodeReader for negative BIPUSH / SIPUSH values
```
```
➜ scala git:(2.12.x) g merge -s ours f2d7838d90
Merge made by the 'ours' strategy.
```
```
* f2d7838d90 Merge pull request #4657 from lrytz/backports
|\
| * 241bb9ac19 Rename the ENUM / DEFAULTMETHOD flags to include JAVA_
| * 7a7f9927c3 SI-9393 fix modifiers of ClassBTypes for Java annotations
| * 8946d60bd2 [backport] Fix bytecode stability when running the closure optimizer
| * 3b6b2bfe9f [backport] SI-9392 Clarify the workaround comment and introduce a devWarning
| * 091c1e6ed8 [backport] SI-9392 Avoid crash in GenBCode for incoherent trees
| * 6177cb4481 [backport] SI-9393 Temporarily disable two assertions in GenBCode
| * a1d471f7ba [backport] Refactor the ClosureOptimizer, run ProdCons only once per method
| * f5e72765f2 [backport] SI-9387 Fix VerifyError introduced by indylambda
| * 41b99e2531 [backport] Integrate the LMFInvokeDynamic extractor into LambdaMetaFactoryCall
| * fc1cda2118 [backport] Small refactoring to the closure optimizer
| * 8f272c0ad2 [backport] Accessibility checks for methods with an InvokeDynamic instruction
| * 1c1d8259b5 [backport] Fix bytecode stability
| * ef9d845676 [backport] Support methodHandle / invokeDynamic constant pool entries in scalap
| * 60747c7555 [backport] Skip mirror class when invoking deserializeLambda
| * 404e86239e [backport] Prevent infinite recursion in ProdConsAnalyzer
| * 1b0703e74d [backport] SI-9376 don't crash when inlining a closure body that throws.
| * e511375a90 [backport] Fix superclass for Java interface symbols created in JavaMirrors
| * 1b57723169 [backport] `deserializeLambda` should not use encoded class name
| * 8bafa8ed88 [backport] Java parser: default methods in interfaces are not `DEFERRED`
| * 44e2761a9b [backport] SI-6613 fixed in GenBCode
```
```
➜ scala git:(2.12.x) g merge 4c6dcfe934
Auto-merging src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala
Auto-merging doc/License.rtf
Auto-merging doc/LICENSE.md
Auto-merging build.xml
Auto-merging build.sbt
Merge made by the 'recursive' strategy.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
build.sbt | 2 +-
build.xml | 2 +-
doc/LICENSE.md | 4 ++--
doc/License.rtf | 4 ++--
src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala | 2 +-
src/scalap/decoder.properties | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
```
```
* | 4c6dcfe934 Merge pull request #4656 from lrytz/filtersOpenJDK
|\ \
| |/
|/|
| * 0b35bc29aa Ignore OpenJDK warnings in partest filters
* 6eb0812050 Merge pull request #4644 from SethTisue/copyright-2015
* e0aac7c9ef bump copyright year to 2015
```
|
| |\ \ \ \ \ \
| | |_|/ / / /
| |/| | | | | |
SI-9422 Fix incorrect constant propagation
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The ConstantOptimization phase uses abstract interpretation
to track what is known about values, and then to use this information
to optimize away tests with a statically known result.
Constant propagation was added under -optimize in Scala 2.11.0-M3, in
PR #2214.
For example, we might know that a variable must hold one of a set
of values (`Possible`). Or, we could track that it must *not*
be of of a set of value (`Impossible`).
The test case in the bug report was enough to create comparison:
v1 == v2 // where V1 = Possible(Set(true, false))
// V2 = Possible(Set(true, false))
This test was considered to be always true, due to a bug in
`Possible#mightNotEqual`. The only time we can be sure that
`Possible(p1) mightNotEquals Possible(p2)` is if
`p1` and `p2` are the same singleton set. This commit changes
this method to implement this logic.
The starting assumption for all values is currently
`Impossible(Set())`, although it would also be reasonable to represent
an unknown boolean variable as `Possible(Set(true, false))`, given
the finite and small domain.
I tried to change the starting assumption for boolean locals in
exactly this manner, and that brings the bug into sharp focus.
Under this patch:
https://github.com/retronym/scala/commit/e564fe522d
This code:
def test(a: Boolean, b: Boolean) = a == b
Compiles to:
public boolean test(boolean, boolean);
Code:
0: iconst_1
1: ireturn
Note: the enclosed test case does not list `-optimize` in a `.flags`
file, I'm relying on that being passed in by the validation build.
I've tested locally with that option, though.
|
| |\ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-9365 Don't null out dependencies of transient lazy vals
|
| | |/ / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
As per Iulian's analysis:
> When lazy vals are transient, the optimization in SI-720 is invalid,
> leading to NPEs.
These NPEs appear when recomputing the lazy val when deserializaing
the object.
This commit disables the field nulling if the lazy val is marked
transient.
The post-mixin tree in the enclosed test changes as follows:
```
--- sandbox/old.log 2015-07-27 15:48:03.000000000 +1000
+++ sandbox/new.log 2015-07-27 15:47:56.000000000 +1000
@@ -1,61 +1,54 @@
[[syntax trees at end of mixin]] // t9365.scala
package <empty> {
class Test extends Object with Serializable {
@transient @volatile private[this] var bitmap$trans$0: Boolean = false;
private def foo$lzycompute(): Object = {
{
Test.this.synchronized({
if (Test.this.bitmap$trans$0.unary_!())
{
Test.this.foo = Test.this.x.apply();
Test.this.bitmap$trans$0 = true;
()
};
scala.runtime.BoxedUnit.UNIT
});
- Test.this.x = null
+ ()
};
Test.this.foo
};
```
In addition to the test from the ticket, I've added a reflection
based test that directly tests the nulling. This complements the
test added in 449f2a7473, the fix for SI-720, which passes by
virtue of not exhausting the heap.
|
| |\ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-9403 fix ICodeReader for negative BIPUSH / SIPUSH values
|
| | |/ / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The byte value of a BIPUSH instruction and the (byte1 << 8) | byte2
value of a SIPUSH instruction are signed, see [1] and [2].
Similar for the increment value of IINC [3].
[1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.bipush
[2] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.sipush
[3] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.iinc
|
| |\ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
backports from 2.12.x
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
The Scala classfile and java source parsers make Java annotation
classes (which are actually interfaces at the classfile level) look
like Scala annotation classes:
- the INTERFACE / ABSTRACT flags are not added
- scala.annotation.Annotation is added as superclass
- scala.annotation.ClassfileAnnotation is added as interface
This makes type-checking @Annot uniform, whether it is defined in Java
or Scala.
This is a hack that leads to various bugs (SI-9393, SI-9400). Instead
the type-checking should be special-cased for Java annotations.
This commit fixes SI-9393 and a part of SI-9400, but it's still easy
to generate invalid classfiles. Restores the assertions that were
disabled in #4621. I'd like to leave these assertions in: they
are valuable and helped uncovering the issue being fixed here.
A new flag JAVA_ANNOTATION is introduced for Java annotation
ClassSymbols, similar to the existing ENUM flag. When building
ClassBTypes for Java annotations, the flags, superclass and interfaces
are recovered to represent the situation in the classfile.
Cleans up and documents the flags space in the area of "late" and
"anti" flags.
The test for SI-9393 is extended to test both the classfile and the
java source parser.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
A macro in shapeless was generating a tree of the form:
```
{
class C#2
new C#2
}.setType(C#1)
```
This happened due to an error in the macro; it used untypecheck
to try to fix the owner-chain consistency problem, but kept a
reference to the previous version of the block-local class symbol
`C` and used this in the resulting tree.
This commit detects the particular situation we encountered, and
avoids the crash by not creating the `NestedInfo` for the
`BType` corresponding to `C#1`. The code comment discusses why I
think this is safe, and suggests a refactoring that would mean
we only ever try to construct `NestedInfo` when we are going to
need them.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
These cause a crash in the build of Play. We should try to bring
these back once we have suitable annotation awareness. Perhaps
they should only be `devWarning`-s, though.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
As with regular `Apply`-s, we should compute the generated type
based on the function's type, rather than the expected type.
In the test case, the expected type was void. Now, we correctly
use the generated type of `scala/Function1`, which is enough
to generate a subsequent POP instruction.
The tree shape involved was:
```
arg0 = {
{
$anonfun()
};
scala.runtime.BoxedUnit.UNIT
}
```
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Add support in scalap to parse new constant pool entries
- MethodHandle
- MethodType
- InvokeDynamic
Spec: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html
|
| | |/ / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The Java parser should not set the `DEFERRED` flag for
default methods or static methods in interfaces.
Their bytecode doesn't have it either.
Also tightens parsing of Java abstract methods to
disallow a method body.
Here's the log of how Lukas diagnosed this:
```
quick.bin:
...
BUILD FAILED
/Users/luc/scala/scala/build.xml:69: The following error occurred while executing this line:
...
/Users/luc/scala/scala/build-ant-macros.xml:350: Could not create type mk-bin due to
java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at scala.sys.BooleanProp$.keyExists(BooleanProp.scala:72)
at scala.sys.SystemProperties$.bool(SystemProperties.scala:78)
at scala.sys.SystemProperties$.noTraceSupression$lzycompute(SystemProperties.scala:89)
at scala.sys.SystemProperties$.noTraceSupression(SystemProperties.scala:89)
at scala.util.control.NoStackTrace$.<init>(NoStackTrace.scala:31)
at scala.util.control.NoStackTrace$.<clinit>(NoStackTrace.scala)
at scala.util.control.NoStackTrace$class.fillInStackTrace(NoStackTrace.scala:22)
at scala.util.control.BreakControl.fillInStackTrace(Breaks.scala:94)
at java.lang.Throwable.<init>(Throwable.java:250)
at scala.util.control.BreakControl.<init>(Breaks.scala:94)
at scala.util.control.Breaks.<init>(Breaks.scala:29)
at scala.collection.Traversable$.<init>(Traversable.scala:95)
at scala.collection.Traversable$.<clinit>(Traversable.scala)
at scala.package$.<init>(package.scala:40)
at scala.package$.<clinit>(package.scala)
at scala.Predef$.<init>(Predef.scala:89)
at scala.Predef$.<clinit>(Predef.scala)
at scala.tools.ant.ScalaTool.<init>(ScalaTool.scala:58)
[...]
Caused by: java.lang.invoke.LambdaConversionException:
Incorrect number of parameters for static method invokeStatic
scala.sys.BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted:(String)Object;
0 captured parameters, 0 functional interface method parameters, 1 implementation parameters
at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193)
at java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:473)
at java.lang.invoke.CallSite.makeSite(CallSite.java:325)
```
[source code](https://github.com/scala/scala/blob/2.11.x/src/library/scala/sys/BooleanProp.scala#L72):
```
s => s == "" || s.equalsIgnoreCase("true")
```
bytecode:
```
INVOKEDYNAMIC $init$()Lscala/compat/java8/JFunction1; [
// handle kind 0x6 : INVOKESTATIC
java/lang/invoke/LambdaMetafactory.altMetafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
// arguments:
()V,
// handle kind 0x6 : INVOKESTATIC
scala/sys/BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted(Ljava/lang/String;)Ljava/lang/Object;,
(Ljava/lang/String;)Ljava/lang/Object;,
3,
1,
Lscala/Serializable;.class,
0
]
CHECKCAST scala/Function1
```
The mistake seems to be that the Scala compiler incorrectly selects `$init$`
([which is a default method](https://github.com/scala/scala/blob/640ffe7fceb5d573b2c12a7c7da09bfd751036a0/src/library/scala/compat/java8/JFunction1.java#L10))
as the abstract method of `JFunction1`, whereas it should be `apply` (inherited from `Function1`).
Since we're doing mixed compilation, this is almost certainly a problem of the Java parser.
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
When running a 2.11.x validation on JDK 8, there are OpenJDK
warnings that fail tests. Backports a part of 8d2d3c70 to 2.11.x.
The missing filter causes merge commits to fail in PRs that merge
2.11 to 2.12, e.g., https://github.com/scala/scala/pull/4655.
In the future we probably want to trigger an integration build for
merge commits, but this doesn't happen yet AFAICT.
|
|\ \ \ \ \ \
| |_|_|_|_|/
|/| | | | | |
SI-9393 fix modifiers of ClassBTypes for Java annotations
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The Scala classfile and java source parsers make Java annotation
classes (which are actually interfaces at the classfile level) look
like Scala annotation classes:
- the INTERFACE / ABSTRACT flags are not added
- scala.annotation.Annotation is added as superclass
- scala.annotation.ClassfileAnnotation is added as interface
This makes type-checking @Annot uniform, whether it is defined in Java
or Scala.
This is a hack that leads to various bugs (SI-9393, SI-9400). Instead
the type-checking should be special-cased for Java annotations.
This commit fixes SI-9393 and a part of SI-9400, but it's still easy
to generate invalid classfiles. Restores the assertions that were
disabled in #4621. I'd like to leave these assertions in: they
are valuable and helped uncovering the issue being fixed here.
A new flag JAVA_ANNOTATION is introduced for Java annotation
ClassSymbols, similar to the existing ENUM flag. When building
ClassBTypes for Java annotations, the flags, superclass and interfaces
are recovered to represent the situation in the classfile.
Cleans up and documents the flags space in the area of "late" and
"anti" flags.
The test for SI-9393 is extended to test both the classfile and the
java source parser.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-8911 allow serializing Scala Maps wrapped as Java ones
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Added `with Serializable` to `MapWrapper` and `SetWrapper`.
Test verifies that serialization works in the simplest case.
Also updated tests in t8549 to check that serialization works and doesn't change.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-9408 Avoid capturing outer class in local classes.
|
| | |/ / / /
| |/| | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Previously, only local classes declared final would be candidates
for outer pointer elision in the constructor phase.
This commit infers finality of local classes to expand the scope
of this optimization.
== Background ==
This was brought to our attention when shapeless enabled
indylambda and found that a hitherto serializable
data structure started to capture the enclosing class and hence
lost its serializability.
class NotSerializable {
def test = () => {
class C; assertSerializable(new C)
}
}
Under `-Ydelambdafy:inline`, it used to capture the enclosing anon
function class as its outer, which, being final, didn't in turn
capture the enclosing class.
class NotSerializable {
def test = new anonFun$1
}
class anonFun$1 {
def apply = assertSerializable(new C(this))
}
class ...$C(outer$: anonFun)
indylambda perturbs the enclosing structure of the function body.
class NotSerializable {
def anonFun$1 = {class C; assertSerializable(new C()))
def test = lambdaMetaFactory(<<anonFun$1>>)
}
Which leads to:
class NotSerializable$C(outer$: NotSerializable)
|
|\ \ \ \ \ \
| |/ / / / /
|/| | / / /
| | |/ / /
| |/| | | |
merge/2.11.x-to-2.12.x-20152307
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-8502 create PackageClass instead of Class symbol stubs for pkgs
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
https://github.com/scala/scala/pull/4111 creates a stub type symbol
for missing packages, deferring (or avoiding) a crash if a package
is missing.
The symbol created was a ClassSymbol, which could lead to an assertion
failure in flattten:
case TypeRef(pre, sym, args) if isFlattenablePrefix(pre) =>
assert(args.isEmpty && sym.enclosingTopLevelClass != NoSymbol, sym.ownerChain)
`pre` is the stub ClassSymbol, so `isFlattenablePrefix` is true (but
it should be false). The assertion then fails because the enclosing
class of a top-level class defined in a missing package is NoSymbol.
This failed only with GenBCode, which traverses more of the symbol
graph while building ClassBTypes: it looks collects the nested classes
of `Outer` into a `NestedInfo`.
|
| |\ \ \ \ \
| | | | | | |
| | | | | | | |
Fix 23 typos (t-v)
|
| | | |_|/ /
| | |/| | | |
|
| |\ \ \ \ \
| | |_|/ / /
| |/| | | | |
Improve some names (t-v)
|
| | |/ / / |
|
| |\ \ \ \
| | | | | |
| | | | | | |
SI-9370 Xplugin scans plugin path for descriptor
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Keep on scanning if the first entry doesn't yield
a plugin.xml descriptor.
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The implicit classtags required by the Array constructor are not
expressed in the type signature of its constructor, and instead
are summoned by a special case in the typechecker.
This special case entails replacing the `new Array` tree with
`implicitly[T].newArray(size)`, handled in `ArrayInstantiation`.
This tree is recursively typechecked.
However, if the implicit materialization/search fails, an error
is issued to the current reporter and the original tree is marked
with an error type. As above, this is recursively typechecked.
In the normal course of affairs, the recursive typecheck of the
erroneous tree would be a noop (the tree already has a type!).
However, if we are both in silent mode (in which errors are buffered)
and in retyping mode (in which the typer clears the type and symbols
of trees), we were getting into an cycle.
In the enclosed test, retyping mode was trying to recover
from:
Resetting.this.gencastarray_=(new Array[T](0).<ERROR>)
By inserting a suitable a view:
implicitly[Resetting => { def gencastarray_=(AT)}](
Resetting.this
).gencastarray_=(new Array[T](0))
Where AT is the type found by retypechecking the argument.
It is during the argument retypechecking that we fell into cycle.
Crazily enough, in 2.11.0, the ensuing `StackOverflowError` was
being caught and treated as a failure. We would then back out of
the retyping mode, and issue the error from the the very first attempt
at the implicit search.
This fragile state of affairs was disrupted by a refactoring to
the error reporting system in 725c5c9, after which the SOE crashed
the compiler.
This commit avoids recursively typechecking error typed trees.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9383 Improved unused import warning
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Previously, implicit search would mark every import
it touched as a lookup.
Instead, let subsequent type check perform the lookup.
|