summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-07-13175-375/+484
|\ | | | | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20150713 Conflicts: src/eclipse/partest/.classpath src/eclipse/repl/.classpath test/files/run/nothingTypeNoFramesNoDce.scala test/files/run/repl-javap-app.check Also fixup two .classpath files with updated partest, xml and parser combinators JARs.
| * Merge pull request #4604 from vergenzt/update-eclipse-filesAdriaan Moors2015-07-063-3/+3
| |\ | | | | | | Update Eclipse classpath entries
| | * Update Eclipse classpath entriesTim Vergenz2015-07-043-3/+3
| | |
| * | Merge pull request #4605 from janekdb/2.11.x-typos-sDick Wall2015-07-0618-24/+24
| |\ \ | | |/ | |/| Fix 25 typos (s) - LGTM - thanks, smiles
| | * Fix 25 typos (s)Janek Bogucki2015-07-0618-24/+24
| |/
| * Merge pull request #4600 from adriaanm/fixup-4564-checkinitAdriaan Moors2015-07-021-1/+7
| |\ | | | | | | Correct init order between Pasted and ILoop#pasted
| | * Correct init order between Pasted and ILoop#pastedAdriaan Moors2015-07-021-1/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | `testBoth` cannot be a val in `Pasted`, as `Pasted` is inherited by `object paste` in ILoop, which would cause `val testBoth` to be initialized before `val PromptString` was: ``` object paste extends Pasted { val PromptString = prompt.lines.toList.last ``` See https://scala-webapps.epfl.ch/jenkins/job/scala-nightly-checkinit-2.11.x/417. Introduced by #4564.
| * Merge pull request #4596 from janekdb/2.11.x-typos-p-rSeth Tisue2015-07-0121-26/+26
| |\ | | | | | | Fix 27 typos (p-r)
| | * Fix 27 typos (p-r)Janek Bogucki2015-06-3021-26/+26
| | |
| * | Merge pull request #4576 from som-snytt/issue/9206-moreSeth Tisue2015-07-0193-265/+174
| |\ \ | | |/ | |/| SI-9206 REPL custom bits
| | * SI-9206 De-perk the welcome messageSom Snytt2015-06-256-40/+68
| | | | | | | | | | | | | | | The welcome message defaults to a sober header followed by one line of instructions.
| | * SI-9206 Update REPL welcome messageSom Snytt2015-06-2486-219/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Everyone knows that a `help` command will result in `more information`. This commit moves the version string to the second line and adds some verve to the welcome. If anyone can't live without the old banner, they are now able to configure it explicitly, so there is still no blood on our hands. ``` $ scala Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions to have them evaluated. Type :help for more information. scala> :quit $ skala Welcome to Scala! version 2.11.7-20150623-155244-eab44dd092 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions for evaluation. Or try :help. scala> :quit ``` REPL tests now lop off the actual length of the welcome header; or, if necessary, remove the version number from a header embedded in output.
| | * SI-9206 REPL custom continuation promptSom Snytt2015-06-232-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because who doesn't want to customize their continuation prompt? `scala -Dscala.repl.continue="..."` looks especially nice with `-Dscala.color`. Somewhat works when pasting, but the test rig for running a transcript does not seek to support custom secondary prompts.
| | * SI-9206: REPL custom history fileIgor Racic2015-06-231-6/+6
| | | | | | | | | | | | Specify it with -Dscala.shell.histfile=/path/to/file.
| | * SI-9206: REPL custom welcome messageSom Snytt2015-06-237-17/+51
| | | | | | | | | | | | | | | | | | | | | | | | Can be specified by `-Dscala.repl.welcome=Greeting` or in properties file. It takes the same format arguments as the prompt, viz, version, Java version and JVM name. It can be disabled by `-Dscala.repl.welcome` with no text.
| | * SI-9206: No REPL message on :silent, unless -Dscala.repl.infoIgor Racic2015-06-232-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Anyone who doesn't understand why result printing was turned off after they entered `:silent` mode will start the REPL with `-Dscala.repl.debug` and be enlightened. For infotainment purposes, the verbose message is also emitted under info mode.
| * | Merge pull request #4569 from retronym/ticket/6985Adriaan Moors2015-06-309-2/+102
| |\ \ | | | | | | | | SI-6895 Test cases to explain the limitations in tcpoly inference
| | * | SI-8892 Fix incorrect qualification in error messageJason Zaugg2015-06-233-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since beadafa2, we've ended up with nutty error messages for type errors involving aliases that target types in `java.lang` and `scala` packages. I think the intent of that change was to force the error messages to qualify types like `String` when needed, but to leave them unqualified by default. However, this led to this flat out wrong message in the enclosed test. found : B required: C.this.java.lang.B (which expands to) String I've changed the heuristic slightly limit this code to aliases that are eponymous with their targets. Still feels pretty kludgy, but we can at least book a little progress.
| | * | SI-8777 Avoid redundant disambiguation in error messagesJason Zaugg2015-06-234-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When printing types in error messages, we attempt to disambiguate symbol names by qualifying them in various ways. Type paramters symbols are qualified by adding `(in someMethod)`. However, the type errors generated by higher kinded subtyping can contain clones of type parameter symbols, as creater in `isPolySubType`. The disambiguation tries fruitlessly to distinguish them but ended up adding the same suffix to both names repeatedly. ``` found : [F[_]]Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[F,X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] required: Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[[X]Or[String,X],X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] ``` This commit limits the post qualification of type parameter symbols to a single attempt to limit the damage. An alternative might be to mark a clone (we could determine its status by checking whether it is a type parameter of its owner.) But I'm not sure how to present this information in a comphrenensible way, so for now I'm limiting my ambitions to stopping the stutter.
| | * | SI-6895 Test cases to explain the limitations in tcpoly inferenceJason Zaugg2015-06-234-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've determined that the failure in this bug report boils down to SI-2712. Submitting my working as neg tests for posterity. The type error disabmiguator develops a serious stutter with this example. I'll fix that in the following commit.
| * | | Merge pull request #4591 from vsalvis/vsalvis-stringdocSeth Tisue2015-06-302-4/+8
| |\ \ \ | | | | | | | | | | SI-8140 Documentation references java.lang.String directly
| | * | | SI-8140 Documentation references java.lang.String directlyvsalvis2015-06-292-4/+8
| | | | |
| * | | | Merge pull request #4588 from retronym/topic/icodishAdriaan Moors2015-06-292-0/+47
| |\ \ \ \ | | | | | | | | | | | | GenBCode: fix incrementatal compilation by mimicing GenASM
| | * | | | GenBCode: fix incrementatal compilation by mimicing GenASMJason Zaugg2015-06-282-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The incremental compiler in SBT uses an implementation detail of the compiler backend to enumerate the classes that are actually written to disk. This commit mimics this in GenBCode by populating `Run#icode` with an `IClass` for each `ClassDef` processed. We should revisit this by creating a dedicated API for this purpose and migrating SBT to use that. We should also revisit this code as we implement closure elimination in the GenBCode; this commit assumes that all `ClassDef`s that enter the backend will generate classfile products. The enclosed test is extracted from the incrementatl compiler. I've also manually integration tested this with SBT: https://gist.github.com/retronym/fabf6f92787ea9c1ce67
| * | | | | Merge pull request #4586 from som-snytt/issue/missing-argsSeth Tisue2015-06-294-21/+55
| |\ \ \ \ \ | | | | | | | | | | | | | | Improved message for missing argument list
| | * | | | | Improved message for missing argument listSom Snytt2015-06-274-21/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarifies the language and rules for eta-expansion. A missing argument in a list, as opposed to a missing argument list, results in a different message. The comical expansion in parens does not attempt to show what was already applied, but succeeds in showing at a glance the shape of the method in question. ``` scala> def m(i: Int, j: Int)(x: Int) = ??? m: (i: Int, j: Int)(x: Int)Nothing scala> m <console>:12: error: missing argument list for method m Unapplied methods are only converted to functions when a function type is expected. You can make this conversion explicit by writing `m _` or `m(_,_)(_)` instead of `m`. m ^ ``` The original submission was due to sschaef and the wording due to adriaanm, with a minor tweak.
| * | | | | | Merge pull request #4589 from janekdb/2.11.x-method-names-m-oJason Zaugg2015-06-294-8/+8
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | Improve method names (m-o)
| | * | | | | | Improve method names (m-o)Janek Bogucki2015-06-284-8/+8
| | |/ / / / /
| * | | | | | Merge pull request #4587 from janekdb/2.11.x-typos-m-oDick Wall2015-06-2818-23/+23
| |\ \ \ \ \ \ | | |/ / / / / | |/| | | | | Fix 23 typos (m-o)
| | * | | | | Fix 23 typos (m-o)Janek Bogucki2015-06-2818-23/+23
| |/ / / / /
* | | | | | Merge pull request #4561 from jdevelop/io-source-fromclasspath-2.12Adriaan Moors2015-07-072-0/+14
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7514 Introduce Source.fromResource(...) method
| * | | | | | [ SI-7514 ] Introduce Source.fromClassPath(resource) methodEugene Dzhurinsky2015-07-072-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Creates Source from named classpath resource. Simplifies val src = io.Source.fromInputStream(classOf[ClassInst].getResourceAsStream("/name")) to val src = io.Source.fromClassPath("/name")
* | | | | | | Merge pull request #4603 from lrytz/lambdaSpectestAdriaan Moors2015-07-062-72/+78
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-9373 Restore the test for t8960 with IndyLamba enabled
| * | | | | | | SI-9373 Restore the test for t8960 with IndyLamba enabledLukas Rytz2015-07-032-72/+78
| | | | | | | |
* | | | | | | | Merge pull request #4606 from lrytz/scalap52Adriaan Moors2015-07-063-0/+22
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | Support methodHandle / invokeDynamic constant pool entries in scalap
| * | | | | | | Support methodHandle / invokeDynamic constant pool entries in scalapLukas Rytz2015-07-063-0/+22
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | | Merge pull request #4601 from som-snytt/issue/9377Lukas Rytz2015-07-033-5/+12
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-9377 ScalaVersion init no longer fails if versionless
| * | | | | | | SI-9377 Update ScalaVersion error textSom Snytt2015-07-023-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplify and sweeten the message.
| * | | | | | | SI-9377 ScalaVersion init no longer fails if versionlessSom Snytt2015-07-022-0/+6
| |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the version string was empty, ScalaVersion would indignantly refuse to initialize. Now it takes a missing property as "none".
* | | | | | | Merge pull request #4544 from som-snytt/topic/reporterAdriaan Moors2015-07-027-26/+70
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | SI-9350 Command option -Xreporter
| * | | | | | SI-9350 Preserve exceptionsSom Snytt2015-07-021-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On error, rethrow the exception or `IllegalArgumentException`.
| * | | | | | SI-9350 Command option -XreporterSom Snytt2015-06-297-26/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a setting to take a custom Reporter. Example of reporter that discounts deprecations for purposes of (not) failing the build: ``` import scala.tools.nsc.Settings import scala.tools.nsc.reporters.ConsoleReporter import scala.reflect.internal.util._ class MyReporter(ss: Settings) extends ConsoleReporter(ss) { var deprecationCount = 0 override def warning(pos: Position, msg: String): Unit = { if (msg contains "is deprecated") deprecationCount += 1 super.warning(pos, msg) } override def hasWarnings: Boolean = count(WARNING) - deprecationCount > 0 override def reset() = { deprecationCount = 0 ; super.reset() } } ``` Invoked as: ``` $ scalac -toolcp . -Xreporter myrep.MyReporter -Xfatal-warnings -deprecation test.scala test.scala:8: warning: class C in package tester is deprecated: Don't use me Console println s"${new C}" ^ one warning found ``` where the reporter class is in the current directory, placed on the tool class path. Also flush on early-reported errors.
* | | | | | | Merge pull request #4599 from lrytz/reifyJFunctionAdriaan Moors2015-07-0217-1/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix superclass for Java interface symbols created in JavaMirrors
| * | | | | | | Fix superclass for Java interface symbols created in JavaMirrorsLukas Rytz2015-07-0217-1/+2
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the spec [1] the superclass of an interface is always Object. Restores the tests that were moved to pending in bf951ec1, fixex part of SI-9374. [1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1
* | | | | | | Merge pull request #4597 from adriaanm/rebase-4594Lukas Rytz2015-07-02193-401/+3480
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Rebase 4594
| * | | | | | | Fix some tests, move others to pending/Lukas Rytz2015-07-0141-323/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move run/t8960 to pending It tests the serialVersionUID field on closure classes. The field doesn't exist for indyLambda closures. See https://issues.scala-lang.org/browse/SI-9373 Move some reify tests to pending They fail at runtime in GenBCode since scala is built with indyLambda enabled: java.lang.AssertionError: assertion failed: Bad superClass for trait JFunction1: class Any at scala.tools.nsc.Global.assert(Global.scala:261) at scala.tools.nsc.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:228) Noted in https://issues.scala-lang.org/browse/SI-9374 force t6546 to GenASM - no closure elimination in GenBCode yet Noted in https://issues.scala-lang.org/browse/SI-9364. Fix or disable some tests that fail because of the old optimizer The old inliner fails more often when the library is built with indylambda. Noted in https://issues.scala-lang.org/browse/SI-9374. Example: List.foreach ➜ sandbox git:(jfun) ✗ qs -Ybackend:GenASM -optimize -Yinline-warnings Welcome to Scala version 2.12.0-20150630-220939-1cb032d806 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). Type in expressions to have them evaluated. Type :help for more information. scala> List(1,2,3).foreach(x => x + 1) <console>:11: warning: Could not inline required method foreach because bytecode unavailable. List(1,2,3).foreach(x => x + 1) ^ <console>:11: warning: At the end of the day, could not inline @inline-marked method foreach List(1,2,3).foreach(x => x + 1) ^ Upate a number of tests for having indyLambda enabled The delambdafyLambdaClassNames tests was removed, there's nothing to tests with indyLambda.
| * | | | | | | Include sources for scala-java8-compat instead of jarLukas Rytz2015-07-01139-41/+3316
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e1895d64f87dc3c699a3ccbc8a3143b18d3b5bb1, titled "Add scala-java8-compat to scala-library.jar". Move SAM functions and `LambdaDeserializer` (from scala/scala-java8-compat@9253ed9) into `scala.runtime.java8` package under `src/library`. (The package name is the only diff -- they were in `scala.compat.java8` before). The original LambdaDeserializer: https://github.com/scala/scala-java8-compat/blob/c0732e6/src/main/java/scala/compat/java8/runtime/LambdaDeserializer.scala
| * | | | | | | Prepare build for inclusion of java8-compatLukas Rytz2015-07-0112-31/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <h1>Allow mixed builds in ant</h1> The `JFunction` classes depend on the `FunctionN` traits, so the Java compiler needs the Scala library on the classpath. At the same time, while compiling the Scala library, the symbols for `JFunction` classes need to be available to emit indy-lambda closures. Therefore we pass the `JFunctions` as Java sources while compiling the Scala library. <h1>Upgrade versions of osgi tools</h1> Set the required java version in bnd files (JavaSE-1.8). Introduce `scala-swing.version.osgi` as a quick hack to allow manually deriving an osgi-friendly version number for the `scala-swing.version.number`. The latter is used to resolve the artifact, the osgi version is just so we can generate a bundle that osgi will accept. Bnd 1.50 doesn't work with Java 8 classfiles, so upgrade to 2.4.1. Also upgrade all other tools to make tests pass. For `org.eclipse.osgi` we moved to the group ID `org.eclipse.tycho`, where there's a newer version available. The osgi tests would fail with the most recent version available in the `org.eclipse.osgi` groupID. The new version of bnd only copies *classfiles* from the original into the resulting jar, while the old version also copied all other files. This caused osgi test failure with a `NoClassDefFound`, which was really due to a `NumberFormatException` in `ScalaVersion`, as it couldn't find the properties file to parse the version in... Include resources from source jar into osgi bundle as follows: ``` Include-Resource: @@SOURCE_JARNAME@ ``` This makes bnd copy all resources from the source jar. I ran the following on the osgi artifacts of this branch, and on 2.11.x: ``` for f in `find build/osgi -name '*.jar' -a -not -name '*src.jar'`; do unzip -l $f | grep -v '\.class' ; done ``` Comparing the two file lists, things look OK: https://gist.github.com/lrytz/be08db051a53eded192d
| * | | | | | | `deserializeLambda` should not use encoded class nameLukas Rytz2015-07-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `javaBinaryName` returns the internal name of a class. Also used in BTypesFromsymbols.classBTypeFromSymbol. Weirdly, this was discovered due to a bizarre osgi bnd error: ``` [bnd] # addAll '/Users/luc/scala/scala/build/pack/lib/scala-library.jar' with :, [bnd] # addAll '/Users/luc/scala/scala/build/osgi/scala-library.bnd' with , [bnd] 1 ERRORS [bnd] The default package '.' is not permitted by the Import-Package syntax. [bnd] This can be caused by compile errors in Eclipse because Eclipse creates [bnd] valid class files regardless of compile errors. [bnd] The following package(s) import from the default package [scala.collection.generic, scala.sys.process, scala.collection.parallel.mutable, scala.util, scala.collection.parallel.immutable, scala.reflect, scala.concurrent.impl, scala.util.hashing, scala.collection.parallel, scala.collection.convert, scala.io, scala, scala.collection.concurrent, scala.util.control, scala.beans, scala.concurrent.duration, scala.collection, scala.runtime, scala.math, scala.collection.mutable, scala.concurrent, scala.sys, scala.collection.immutable, scala.ref, scala.util.matching] [bnd] /Users/luc/scala/scala/build/osgi/scala-library.bnd: bnd failed ``` Lukas diagnosed it as a problem of the generated `$deserializeLambda$` function: One example is `scala/App$class`. Its bytecode contains this: ``` private static synthetic $deserializeLambda$(Ljava/lang/invoke/SerializedLambda;)Ljava/lang/Object; GETSTATIC scala$divApp$class.$deserializeLambdaCache$ : Ljava/util/Map; [...] ``` so it's a static field read of a top-level class. `$div` should obviously be `/` (which this commit rectifies)
| * | | | | | | Java parser: default methods in interfaces are not `DEFERRED`Lukas Rytz2015-07-012-4/+6
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.