Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the default methods of j.u.Iterator default methods #1937

Merged

Conversation

LeeTibbert
Copy link
Contributor

  • This PR provides the missing remove() default method. This method is used
    by the Scala.js TestMainBase hierarchy. Having this method,
    along with previous PR Add j.l.Iterable.forEach #1934 allows JUnit CollectionsTest.scala
    and others to link and execute, with the expected zero tests run.

  • For completeness, this PR also provides the forEachRemaining()
    default method. It is not used by the TestMainBase hierarchy
    and could be deferred to a separate PR. The overall project cost of
    including it here seemed to be less than the cost of a separate PR.

  • The effective change is in Iterator.scala. Because it now provides
    a default message, a number of other files need overrides. There
    should be no functional change.

  • There is no direct corresponding JUnit test for remove() because
    of circularity. This method is used by the environment which would test any
    standalone file. These changes will be extensively exercised
    by that test environment and defects will become obvious.

  • forEachRemaining() has a test in Scala.js IteratorTest.scala. That
    change in this PR Will become publicly tested when the current work to port
    the TestMainBase environment finishes. Until then, it is being heavily
    exercised in my porting environment.

Documentation:

  • None required

Testing:

Safety -

  • Built and tested ("test-all") in debug mode using sbt 1.3.13 on
    X86_64 only . All tests pass.

Efficacy -

  • Will be shown when the port of the Scala.js TestMainBase environment
    to Scala Native has been accomplished.

  * This PR provides the missing remove() default method. This method is
    used by the Scala.js TestMainBase hierarchy.  Having this method,
    along with previous PR scala-native#1934 allows JUnit CollectionsTest.scala
    and others to link and execute, with the expected zero tests run.

  * For completeness, this PR also provides the forEachRemaining()
    default method.  It is not used by the TestMainBase hierarchy
    and could be deferred to a separate PR.  The overall project cost of
    including it here seemed to be less than the cost of a separate PR.

  * The effective change is in Iterator.scala. Because it now provides
    a default message, a number of other files need overrides.  There
    should be no functional change.

  * There is no direct corresponding JUnit test for remove() because
    of circularity. This method is used by the environment which would test
    any standalone file. These changes will be extensively exercised
    by that test environment and defects will become obvious.

  * forEachRemaining() has a test in Scala.js IteratorTest.scala.  That
    change in this PR Will become publicly tested when the current work to
    port the TestMainBase environment finishes. Until then, it is being
    heavily exercised in my porting environment.

Documentation:

  * None required

Testing:

  Safety -

    + Built and tested ("test-all") in debug mode using sbt 1.3.13 on
      X86_64 only . All tests pass.

  Efficacy -

   + Will be shown when the port of the Scala.js TestMainBase environment
     to Scala Native has been accomplished.
@LeeTibbert LeeTibbert force-pushed the PR_j_u_Iterator_DefaultMethods_2020-10-09 branch from f7a60bb to 7c1bdfc Compare October 9, 2020 16:56
@LeeTibbert LeeTibbert force-pushed the PR_j_u_Iterator_DefaultMethods_2020-10-09 branch from 0bf900d to 8089eab Compare October 9, 2020 23:26
Restart Travis CI. It failed for reasons not related to these
changes.  Out-of-Memory error whilst compiling a scripted test.
@LeeTibbert LeeTibbert force-pushed the PR_j_u_Iterator_DefaultMethods_2020-10-09 branch from 8089eab to 8bc9e10 Compare October 10, 2020 14:13
@sjrd sjrd changed the title Add two j.u.Iterator default methods, similar to recent Scala.js Add the default methods of j.u.Iterator default methods Oct 13, 2020
@sjrd sjrd merged commit 966cdff into scala-native:master Oct 13, 2020
1 check passed
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 15, 2020
This PR builds upon merged PR scala-native#1937 by adding the JavaDefaultMethod
annotation to the trait

IOU: The discerning reader will notice that there is no ListTest.scala
     in this WIP.

     Before this PR can move out of WIP state the corresponding
     Scala.js ListTest.scala should be ported. Currently ScalaNative
     has no ListTest.

     Scala.js ListTest has a number of prerequisites, few of which
     are currently ported (such as TestMainBase).  I believe
     porting those items in a series of separate PRs. Tedious, but
     it will leave a better audit trail.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 15, 2020
This PR builds upon merged PR scala-native#1937 by porting Function.scala and its
corresponding test from Scala.js.

This approach was taken instead of editing the existing file for three
reasons:
  1) This keeps the code and its test consistent.

  2) The implementation in the Scala.js code looks like it allocates
     fewer memory objects.

  3) This makes the Scala Native & Scala.js code identical.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 15, 2020
This PR builds upon merged PR scala-native#1937 by adding the JavaDefaultMethod
annotation to the trait and porting the test for the trait.

Note Well: Scala.js j.u.f.Consumer.scala carries a `@FunctionalInterface`
           annotation.  I did not port that over.  In another pass
	   I will have to figure out if SN needs such an annotation
	   and its implementation.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 16, 2020
…e.scala in

order to pick up the JavaDefaultMethod annotation.

The corresponding test was ported from Scala.js by Lorenzo G (lolgab)
as part of his PR scala-native#1994.  To keep the JavaDefaultMethod changes
together, I am submitting it here by his kind permission. He did
the port; I added a bit of audit trail information at the top.
Thank you Lolgab.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 16, 2020
This PR builds upon merged PR scala-native#1937 by porting Collection.scala and its
corresponding test from Scala.js.

The test was ported from Scala.js by Lorenzo G (lolgab) as
part of his PR scala-native#1994.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after
PR scala-native#1997 (nscplugin), scala-native#2009 (j.l.Iterable), & 2010 (TrivialCollection)
are merged and this PR is re-based.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 17, 2020
This PR builds upon merged PR scala-native#1937 by porting Collection.scala and its
corresponding test from Scala.js.

The test was ported from Scala.js by Lorenzo G (lolgab) as
part of his PR scala-native#1994.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after
PR scala-native#1997 (nscplugin), scala-native#2009 (j.l.Iterable), & 2010 (TrivialCollection)
are merged and this PR is re-based.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 17, 2020
This PR builds upon merged PR scala-native#1937 by adding the JavaDefaultMethod
annotation to the trait

IOU: The discerning reader will notice that there is no ListTest.scala
     in this WIP.

     Before this PR can move out of WIP state the corresponding
     Scala.js ListTest.scala should be ported. Currently ScalaNative
     has no ListTest.

     Scala.js ListTest has a number of prerequisites, few of which
     are currently ported (such as TestMainBase).  I believe
     porting those items in a series of separate PRs. Tedious, but
     it will leave a better audit trail.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 17, 2020
This PR builds upon merged PR scala-native#1937 by adding the JavaDefaultMethod
annotation to the trait and porting the test for the trait.

Note Well: Scala.js j.u.f.Consumer.scala carries a `@FunctionalInterface`
           annotation.  I did not port that over.  In another pass
	   I will have to figure out if SN needs such an annotation
	   and its implementation.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 18, 2020
…e.scala in

order to pick up the JavaDefaultMethod annotation.

The corresponding test was ported from Scala.js by Lorenzo G (lolgab)
as part of his PR scala-native#1994.  To keep the JavaDefaultMethod changes
together, I am submitting it here by his kind permission. He did
the port; I added a bit of audit trail information at the top.
Thank you Lolgab.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 18, 2020
This PR builds upon merged PR scala-native#1937 by porting Function.scala and its
corresponding test from Scala.js.

This approach was taken instead of editing the existing file for three
reasons:
  1) This keeps the code and its test consistent.

  2) The implementation in the Scala.js code looks like it allocates
     fewer memory objects.

  3) This makes the Scala Native & Scala.js code identical.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 18, 2020
This PR builds upon merged PR scala-native#1937 by porting j.u.f.Predicate.scala
and its corresponding PredicateTest from Scala.js.

The previously existing Predicate.scala is overwritten to keep
the source and its test synchronized.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
WojciechMazur pushed a commit that referenced this pull request Nov 18, 2020
This PR builds upon merged PR #1937 by porting j.u.f.Predicate.scala
and its corresponding PredicateTest from Scala.js.

The previously existing Predicate.scala is overwritten to keep
the source and its test synchronized.

See Issue #1972 for background & discussion of JavaDefaultMethod
annotation.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 18, 2020
This PR builds upon merged PR scala-native#1937 by annotating the existing
j.u.f.BiPredicate.scala and porting its corresponding BiPredicateTest
from Scala.js.

The existing file was edited rather than porting the most current
Scala.js commit because the latter uses lambdas and those
do not play well when using Scala Native with Scala 2.11.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 18, 2020
This PR builds upon merged PR scala-native#1937 by porting Collection.scala and its
corresponding test from Scala.js.

The test was ported from Scala.js by Lorenzo G (lolgab) as
part of his PR scala-native#1994.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after
PR scala-native#1997 (nscplugin), scala-native#2009 (j.l.Iterable), & 2010 (TrivialCollection)
are merged and this PR is re-based.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 18, 2020
This PR builds upon merged PR scala-native#1937 by annotating the existing
j.u.f.BiConsumer.scala and porting its corresponding BiConsumerTest
from Scala.js.

The existing file was edited rather than porting the most current
Scala.js commit because the latter uses lambdas and those
do not play well when using Scala Native with Scala 2.11.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
vicopem pushed a commit to vicopem/scala-native that referenced this pull request Nov 19, 2020
vicopem pushed a commit to vicopem/scala-native that referenced this pull request Nov 19, 2020
This PR builds upon merged PR scala-native#1937 by porting j.u.f.Predicate.scala
and its corresponding PredicateTest from Scala.js.

The previously existing Predicate.scala is overwritten to keep
the source and its test synchronized.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
vicopem added a commit to vicopem/scala-native that referenced this pull request Nov 19, 2020
vicopem added a commit to vicopem/scala-native that referenced this pull request Nov 19, 2020
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 28, 2020
This PR builds upon merged PR scala-native#1937 by porting Collection.scala and its
corresponding test from Scala.js.

The test was ported from Scala.js by Lorenzo G (lolgab) as
part of his PR scala-native#1994.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after
PR scala-native#1997 (nscplugin), scala-native#2009 (j.l.Iterable), & 2010 (TrivialCollection)
are merged and this PR is re-based.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 28, 2020
This PR builds upon merged PR scala-native#1937 by adding the JavaDefaultMethod
annotation to the trait and porting the test for the trait.

Note Well: Scala.js j.u.f.Consumer.scala carries a `@FunctionalInterface`
           annotation.  I did not port that over.  In another pass
	   I will have to figure out if SN needs such an annotation
	   and its implementation.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 28, 2020
This PR builds upon merged PR scala-native#1937 by annotating the existing
j.u.f.BiPredicate.scala and porting its corresponding BiPredicateTest
from Scala.js.

The existing file was edited rather than porting the most current
Scala.js commit because the latter uses lambdas and those
do not play well when using Scala Native with Scala 2.11.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 28, 2020
This PR builds upon merged PR scala-native#1937 by annotating the existing
j.u.f.BiConsumer.scala and porting its corresponding BiConsumerTest
from Scala.js.

The existing file was edited rather than porting the most current
Scala.js commit because the latter uses lambdas and those
do not play well when using Scala Native with Scala 2.11.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 28, 2020
This PR builds upon merged PRs scala-native#1937 & scala-native#2040 by annotating the existing
j.u.f.BiFunction.scala and porting its corresponding BiFunctionTest
from Scala.js.

The existing file was edited rather than porting the most current
Scala.js commit because the latter uses lambdas and those
do not play well when using Scala Native with Scala 2.11.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 28, 2020
This PR builds upon merged PR scala-native#1937 by adding the JavaDefaultMethod
annotation to the trait

IOU: The discerning reader will notice that there is no ListTest.scala
     in this WIP.

     Before this PR can move out of WIP state the corresponding
     Scala.js ListTest.scala should be ported. Currently ScalaNative
     has no ListTest.

     Scala.js ListTest has a number of prerequisites, few of which
     are currently ported (such as TestMainBase).  I believe
     porting those items in a series of separate PRs. Tedious, but
     it will leave a better audit trail.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.

This PR is WIP because it will fail to build until after PR scala-native#1997
is merged and this PR re-based upon it.
LeeTibbert added a commit to LeeTibbert/scala-native-fork that referenced this pull request Nov 29, 2020
This PR builds upon merged PR scala-native#1937 by porting Collection.scala and its
corresponding test from Scala.js.

The test was ported from Scala.js by Lorenzo G (lolgab) as
part of his PR scala-native#1994.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod annotation.

This PR is WIP because it will fail to build until after
PR scala-native#1997 (nscplugin), scala-native#2009 (j.l.Iterable), & 2010 (TrivialCollection)
are merged and this PR is re-based.
ekrich pushed a commit to ekrich/scala-native that referenced this pull request May 21, 2021
ekrich pushed a commit to ekrich/scala-native that referenced this pull request May 21, 2021
This PR builds upon merged PR scala-native#1937 by porting j.u.f.Predicate.scala
and its corresponding PredicateTest from Scala.js.

The previously existing Predicate.scala is overwritten to keep
the source and its test synchronized.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
WojciechMazur pushed a commit to WojciechMazur/scala-native that referenced this pull request Aug 25, 2021
WojciechMazur pushed a commit to WojciechMazur/scala-native that referenced this pull request Aug 25, 2021
This PR builds upon merged PR scala-native#1937 by porting j.u.f.Predicate.scala
and its corresponding PredicateTest from Scala.js.

The previously existing Predicate.scala is overwritten to keep
the source and its test synchronized.

See Issue scala-native#1972 for background & discussion of JavaDefaultMethod
annotation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants