Dominik Dorn
Dominik Dorn

Reputation: 1831

ScalaJs + ZIO: Program works with sbt 1.2.8 but not >= 1.3

I'm trying out scala.js with zio using the sample app at https://github.com/wongelz/zio-scalajs-solarsystem

as soon as I update the sbt version from 1.2.8 to 1.3.13 or 1.4.4 I'm getting the following error:

[error] Referring to non-existent method java.time.LocalTime$.NANOS_PER_SECOND()long
[error]   called from private java.time.LocalDateTime.plusWithOverflow(java.time.LocalDate,long,long,long,long,int)java.time.LocalDateTime
[error]   called from java.time.LocalDateTime.plusNanos(long)java.time.LocalDateTime
[error]   called from java.time.LocalDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.LocalDateTime
[error]   called from java.time.LocalDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.temporal.Temporal
[error]   called from java.time.temporal.ChronoUnit.addTo(java.time.temporal.Temporal,long)java.time.temporal.Temporal
[error]   called from java.time.OffsetDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.OffsetDateTime
[error]   called from java.time.OffsetDateTime.plus(long,java.time.temporal.TemporalUnit)java.time.temporal.Temporal
[error]   called from java.time.Duration.addTo(java.time.temporal.Temporal)java.time.temporal.Temporal
[error]   called from java.time.OffsetDateTime.plus(java.time.temporal.TemporalAmount)java.time.OffsetDateTime
[error]   called from private zio.Schedule$.$anonfun$fixed$2(scala.Option,java.time.OffsetDateTime,long,java.time.Duration,long,scala.runtime.LazyRef)zio.Schedule$Decision
[error]   called from private zio.Schedule$.$anonfun$fixed$1(scala.Option,long,java.time.Duration,long,scala.runtime.LazyRef,java.time.OffsetDateTime,java.lang.Object)zio.ZIO
[error]   called from private zio.Schedule$.loop$23(scala.Option,long,long,java.time.Duration,scala.runtime.LazyRef)scala.Function2
[error]   called from zio.Schedule$.fixed(java.time.Duration)zio.Schedule
[error]   called from private SolarSystemExample$.$anonfun$run$1(SolarSystemExample$SolarSystem)zio.ZIO
[error]   called from SolarSystemExample$.run(scala.collection.immutable.List)zio.ZIO
[error]   called from private zio.App.$anonfun$main$1([java.lang.String)zio.ZIO
[error]   called from zio.App.main([java.lang.String)void
[error]   called from SolarSystemExample$.main([java.lang.String)void
[error]   called from static SolarSystemExample.main([java.lang.String)void
[error]   called from core module module initializers
[error] involving instantiated classes:
[error]   java.time.LocalDateTime
[error]   java.time.temporal.ChronoUnit
[error]   java.time.OffsetDateTime
[error]   java.time.Duration
[error]   zio.Schedule$
[error]   SolarSystemExample$

Why does this bug happen? And where should I report it?

Upvotes: 2

Views: 202

Answers (1)

Dominik Dorn
Dominik Dorn

Reputation: 1831

To answer my own question (for anybody strugling with the same problem):

Make sure you don't have scalajs-java-time (1.0.0) as a dependency in your classpath. It is a incomplete library and if it is picked before scala-java-time you will receive the error posted in the question.

The reason this error occurred, was, that at least on my system, the ordering of the classpath changed from sbt 1.2.8 to sbt 1.3.x, which resulted in the scalajs-java-time library being picked before scala-java-time which resulted in the

Referring to non-existent method java.time.LocalTime$.NANOS_PER_SECOND()long

Error

Upvotes: 1

Related Questions