Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on May 22, 2015
  1. @lrytz

    Merge pull request #4513 from retronym/topic/indylambda-bump-compat

    lrytz authored
    Update to scala-java8-compat 0.5.0
  2. @retronym

    Update to scala-java8-compat 0.5.0

    retronym authored
    This contains LambdaDeserializer, which we refer to in our
    synthetic `$deserializeLambda$` method under -target:jvm-1.8.
    
    Note: this library is only reference in the Ant build under a
    non-standard build flag that includes that library into
    scala-library.jar. This is only for our internal use in running
    partest for indylambda. The SBT build doesn't have the same
    option at the moment.
Commits on May 21, 2015
  1. @adriaanm

    Merge pull request #4477 from retronym/ticket/9286

    adriaanm authored
    SI-9286 Check subclass privates for "same type after erasure"
  2. @adriaanm

    Merge pull request #4501 from retronym/topic/indylambda-serialization

    adriaanm authored
    [indylambda] Support lambda {de}serialization
Commits on May 20, 2015
  1. @lrytz

    Merge pull request #4508 from retronym/topic/uncurry-specialized

    lrytz authored
    Avoid inefficient specialied lambdas w. delambdafy jvm-1.8, GenASM
  2. @lrytz

    Merge pull request #4509 from retronym/topic/man

    lrytz authored
    Document -target:jvm-1.8 in the man page
  3. @retronym

    Document -target:jvm-1.8 in the man page

    retronym authored
    We neglected to do this earlier.
  4. @retronym

    Avoid inefficient specialied lambdas w. delambdafy jvm-1.8, GenASM

    retronym authored
    A previous change disabled -Ydelambdafy:method for specialized
    lambdas, as `DelambdafyTransformer` made no attempt to emit
    the requisite machinery to avoid boxing.
    
    This was loosened to allow them under `-target:jvm-1.8`, in the
    knowledge that `indylambda` would do the right thing.
    
    However, this wasn't quite right: indylambda is only supported
    in `GenBCode`, so we should consider that setting as well.
  5. @retronym

    Merge pull request #4506 from scala/readme-git

    retronym authored
    Update README.md
Commits on May 19, 2015
  1. @retronym

    Update README.md

    retronym authored
Commits on May 18, 2015
  1. @retronym

    SI-9286 Check subclass privates for "same type after erasure"

    retronym authored
    The overriding pairs cursor used to detect erased signature clashes
    was turning a blind eye to any pair that contained a private method.
    
    However, this could lead to a `VerifyError` or `IllegalAccessError`.
    
    Checking against javac's behaviour in both directions:
    
    ```
    % cat sandbox/Test.java
    public abstract class Test {
      class C { int foo() { return 0; } }
      class D extends C { private <A> int foo() { return 1; } }
    }
    
    % javac sandbox/Test.java
    sandbox/Test.java:3: error: name clash: <A>foo() in Test.D and foo() in Test.C have the same erasure, yet neither overrides the other
      class D extends C { private <A> int foo() { return 1; } }
                                          ^
      where A is a type-variable:
        A extends Object declared in method <A>foo()
    1 error
    ```
    
    ```
    % cat sandbox/Test.java
    public abstract class Test {
      class C { private int foo() { return 0; } }
      class D extends C { <A> int foo() { return 1; } }
    }
    
    % javac sandbox/Test.java
    %
    ```
    
    This commit only the exludes private symbols from the superclass
    from the checks by moving the test from `excludes` to `matches`.
Commits on May 17, 2015
  1. @retronym

    [indylambda] Enable caching for lambda deserialization

    retronym authored
    We add a static field to each class that defines lambdas that
    will hold a `ju.Map[String, MethodHandle]` to cache references to
    the constructors of the classes originally created by
    `LambdaMetafactory`.
    
    The cache is initially null, and created on the first deserialization.
    
    In case of a race between two threads deserializing the first
    lambda hosted by a class, the last one to finish will clobber
    the one-element cache of the first.
    
    This lack of strong guarantees mirrors the current policy in
    `LambdaDeserializer`.
    
    We should consider whether to strengthen the combinaed guarantee here.
    A useful benchmark would be those of the invokedynamic instruction,
    which allows multiple threads to call the boostrap method in parallel,
    but guarantees that if that happens, the results of all but one will
    be discarded:
    
    > If several threads simultaneously execute the bootstrap method for
    > the same dynamic call site, the Java Virtual Machine must choose
    > one returned call site object and install it visibly to all threads.
    
    We could meet this guarantee easily, albeit excessively, by
    synchronizing `$deserializeLambda$`. But a more fine grained
    approach is possible and desirable.
    
    A test is included that shows we are able to garbage collect
    classloaders of classes that have hosted lambda deserialization.
  2. @retronym

    [indylambda] Support lambda {de}serialization

    retronym authored
    To support serialization, we use the alternative lambda metafactory
    that lets us specify that our anonymous functions should extend the
    marker interface `scala.Serializable`. They will also have a
    `writeObject` method added that implements the serialization proxy
    pattern using `j.l.invoke.SerializedLamba`.
    
    To support deserialization, we synthesize a `$deserializeLamba$`
    method in each class with lambdas. This will be called reflectively by
    `SerializedLambda#readResolve`. This method in turn delegates to
    `LambdaDeserializer`, currently defined [1] in `scala-java8-compat`,
    that uses `LambdaMetafactory` to spin up the anonymous class and
    instantiate it with the deserialized environment.
    
    Note: `LambdaDeserializer` can reuses the anonymous class on subsequent
    deserializations of a given lambda, in the same spirit as an
    invokedynamic call site only spins up the class on the first time
    it is run. But first we'll need to host a cache in a static field
    of each lambda hosting class. This is noted as a TODO and a failing
    test, and will be updated in the next commit.
    
    `LambdaDeserializer` will be moved into our standard library in
    the 2.12.x branch, where we can introduce dependencies on the
    Java 8 standard library.
    
    The enclosed test cases must be manually run with indylambda enabled.
    Once we enable indylambda by default on 2.12.x, the test will
    actually test the new feature.
    
    ```
    % echo $INDYLAMBDA
    -Ydelambdafy:method -Ybackend:GenBCode -target:jvm-1.8 -classpath .:scala-java8-compat_2.11-0.5.0-SNAPSHOT.jar
    % qscala $INDYLAMBDA -e "println((() => 42).getClass)"
    class Main$$anon$1$$Lambda$1/1183231938
    % qscala $INDYLAMBDA -e "assert(classOf[scala.Serializable].isInstance(() => 42))"
    % qscalac $INDYLAMBDA test/files/run/lambda-serialization.scala && qscala $INDYLAMBDA Test
    ```
    
    This commit contains a few minor refactorings to the code that
    generates the invokedynamic instruction to use more meaningful
    names and to reuse Java signature generation code in ASM rather
    than the DIY approach.
    
    [1] scala/scala-java8-compat#37
Commits on May 16, 2015
  1. @retronym

    Merge pull request #4497 from retronym/topic/indylambda-diy-boxing

    retronym authored
    [indylambda] Relieve LambdaMetafactory of boxing duties [ci: last-only]
Commits on May 15, 2015
  1. @adriaanm

    Merge pull request #4502 from cneijenhuis/documentation/try-example-d…

    adriaanm authored
    …eprecated
    
    Fixed deprecation warning in scaladoc example of Try
  2. @cneijenhuis
  3. @retronym

    [indylambda] Relieve LambdaMetafactory of boxing duties

    retronym authored
    `LambdaMetafactory` generates code to perform a limited number
    of type adaptations when delegating from its implementation of
    the functional interface method to the lambda target method.
    
    These adaptations are: numeric widening, casting, boxing and unboxing.
    
    However, the semantics of unboxing numerics in Java differs to Scala:
    they treat `UNBOX(null)` as cause to raise a `NullPointerException`,
    Scala (in `BoxesRuntime.unboxTo{Byte,Short,...}`) reinterprets the
    null as zero.
    
    Furthermore, Java has no idea how to adapt between a value class and
    its wrapped type, nor from a void return to `BoxedUnit`.
    
    This commit detects when the lambda target method would require
    such adaptation. If it does, an extra method, `$anonfun$1$adapted` is
    created to perform the adaptation, and this is used as the target
    of the lambda.
    
    This obviates the use of `JProcedureN` for `Unit` returning
    lambdas, we know use `JFunctionN` as the functional interface
    and bind this to an `$adapted` method that summons the instance
    of `BoxedUnit` after calling the `void` returning lambda target.
    
    The enclosed test cases fail without boxing changes. They don't
    execute with indylambda enabled under regular partest runs yet,
    you need to add scala-java8-compat to scala-library and pass
    the SCALAC_OPTS to partest manually to try this out, as described
    in #4463. Once we enable indylambda
    by default, however, this test will exercise the code in this patch
    all the time.
    
    It is also possible to run the tests with:
    
    ```
    % curl https://oss.sonatype.org/content/repositories/releases/org/scala-lang/modules/scala-java8-compat_2.11/0.4.0/scala-java8-compat_2.11-0.4.0.jar > scala-java8-compat_2.11-0.4.0.jar
    % export INDYLAMBDA="-Ydelambdafy:method -Ybackend:GenBCode -target:jvm-1.8 -classpath .:scala-java8-compat_2.11-0.4.0.jar"
    qscalac $INDYLAMBDA test/files/run/indylambda-boxing/*.scala && qscala $INDYLAMBDA Test
    ```
Commits on May 12, 2015
  1. @lrytz

    Merge pull request #4499 from lrytz/removeAsm

    lrytz authored
    Move ASM out of the repository [ci: last-only]
Commits on May 11, 2015
  1. @lrytz

    Remove ASM sources

    lrytz authored
  2. @lrytz

    intellij project files for ASM removal

    lrytz authored
    ij fix
  3. @lrytz
  4. @lrytz

    Include ASM as a dependency in ANT build

    lrytz authored
    The classfiles are still integrated into scala-compiler.jar.
  5. @retronym
Commits on May 8, 2015
  1. @adriaanm

    Merge pull request #4496 from adriaanm/artifactory-bintray

    adriaanm authored
    Subst repo.typesafe -> dl.bintray, use jcenter cache
  2. @adriaanm

    Subst repo.typesafe -> dl.bintray, use jcenter cache

    adriaanm authored
    Switch to https while we're at it,
    and remove duplicate entry for sbt-plugin-releases
    (NOTE: 'organization' <-> 'organisation',
     see http://ant.apache.org/ivy/history/latest-milestone/concept.html#patterns)
  3. @retronym

    Merge pull request #4492 from lrytz/scriptsBackport

    retronym authored
    Backport releas script fixes to 2.11.x
  4. @retronym

    Merge pull request #4495 from ceedubs/updated-throws

    retronym authored
    Add @throws annotation to GenSeqLike.updated
Commits on May 7, 2015
  1. @ceedubs

    Add @throws annotation to GenSeqLike.updated

    ceedubs authored
    Similarly to GenSeqLike.apply, GenSeqLike.updated can throw
    IndexOutOfBoundsException.
    
    For example, the following throws IndexOutOfBoundsException:
    Vector.empty[String].updated(0, "foo")
Commits on May 6, 2015
  1. @lrytz
  2. @lrytz
  3. @adriaanm @lrytz

    [backport] Revert back to Scalacheck 1.11.x, fixes to bootstrap script

    adriaanm authored lrytz committed
    Scalacheck 1.12.x cross-compiles to JS and will take more work to
    integrate.
    
    Make sure we never attempt to publish scalacheck to sonatype.
    
    Force checkout module refs in case of dirty workspace.
    
    Backport of f238586
  4. @lrytz
  5. @lrytz

    [backport] Update versions.properites

    lrytz authored
    The tagged revisions of the modules integrate the latest release of
    the sbt-scala-modules sbt plugin. This enables building with a new
    scala binary version (e.g. 2.12.0-M1) without failinig MiMa.
    
    Also updates the other external dependencies.
    
    Backport of 8da073c
  6. @lrytz
  7. @lrytz

    [backport] Comments in versions.properties

    lrytz authored
    Backport of f915361
Something went wrong with that request. Please try again.