Comments (11)
@andares This is a bug, thanks for reporting. This class is missing in the Scala.js Java library and because all the tests are not run with Scala.js - this bug was not found.
Right now we cannot share tests because we don't have a shared test framework for all three platforms but I would like to find or have a test for this so if you could supply the code you used to create the error it would be helpful.
from sconfig.
I'm glad to be able to support.
here is my code, I have to say I'm a beginner in scala 😹
package example
import org.ekrich.config._
import scala.io.Source
object Test extends App {
def parseFile() = {
// That's not work, need `java.io.File`
val config = ConfigFactory.parseString("main.conf")
println(config.resolve)
// println(config)
}
def parseString() = {
val content = """
_pattern.default.main = "../default/main.conf"
core = {
version: 0.1
extends: [
${_pattern.default.main}
]
}
"""
val config = ConfigFactory.parseString(content)
println(config.resolve) // That's crash
// println(config) // That's ok
}
// --> run test
// parseFile
parseString
}
here is build.sbt content:
import Dependencies._
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "com.example"
ThisBuild / organizationName := "example"
lazy val root = (project in file("."))
.settings(
name := "bhc",
libraryDependencies += scalaTest % Test,
)
// See https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html for instructions on how to publish to Sonatype.
// sconfig
libraryDependencies += "org.ekrich" %%% "sconfig" % "0.9.+"
// scalajs
enablePlugins(ScalaJSPlugin)
scalaJSUseMainModuleInitializer := true
Talk a little more, at the beginning I thought I could get the best support for hocon in scala. but I found Scala relies heavily on java libraries on the jvm platform. I think scalajs is hard to deal with, may be use js lib by interop is better way 🤣
from sconfig.
Scala.js doesn't have any support for java.io.File
so we don't expect that to work but I think you should be able to call resolve
but right now Scala.js doesn't have support for IdentityHashMap
. I may be able to add it locally at first until we can get it added to Scala.js.
from sconfig.
That's ok, thank you for the reply 👍
from sconfig.
Test with working example - https://github.com/ekrich/sconfig/blob/master/sconfig/native/src/test/scala/ConfigFactoryTests.scala#L43-L62
from sconfig.
That's great! I have try it again.
from sconfig.
@andares Sorry, I didn't mean to mislead you. I am still working on the Scala.js support for this feature. I just made a test case that works on Scala Native that I can use to test when finishing development on Scala.js. I will close this ticket out once completed and then will need to make a new release for the Scala.js support of this feature.
from sconfig.
I see, I have parse hocon file with npm lib now, never mind 👌
from sconfig.
I'm sorry you had to resort to that but thanks for reporting and your interest. I have been working on this issue but it requires adding java.util.IdentityHashMap
to Scala.js, first locally and then via a PR to Scala.js. It may be working but I just found out how to do resolve myself. I am not a config expert but have spent a bunch of time porting this library.
If you are using Scala.js you can get help here - https://gitter.im/scala-js/scala-js There is another HOCON lib for Scala.js that is very lightweight. https://github.com/akka-js/shocon I hope you keep using Scala.js.
If you would like to discuss further you can find me here as well. https://gitter.im/ekrich/sconfig
from sconfig.
Thank you for your help indeed. I'll keep trying Scala.js in my project. As compile to js language, use npm lib to resolve problem is also possible 😄 You can close the issue when the work is over.
from sconfig.
Fixed by #57
from sconfig.
Related Issues (20)
- Additional scala-friendly helpers? HOT 1
- Use more standard cross version code and directories HOT 1
- Fix Auto-application and eta-expanded errors for Scala 3 HOT 1
- Resolving doesn't work HOT 6
- Replace spray-json fork with something for longer term
- Avoid using collection-compat on 2.13+ HOT 1
- Can't link on scala-native 0.4.0 HOT 2
- Pick a versioning scheme
- Array is allocated but not used in PathParser HOT 1
- Add Java 17 to CI HOT 1
- ConfigFactory.load(conf) not implemented for Scala Native. HOT 1
- Upgrade scalafmt to support Scala 3 and add to CI HOT 1
- Revert Java 11+ workaround for Character.toString(0) once upstream is resolved
- Recent scalafmt split javadoc style @link across lines HOT 1
- Drop scala-collection-compat special logic
- Avoid the use of Class#newInstance, which is deprecated in Java 9
- Potential excess memory use with getDuration
- Port potential open commits
- Enhance Scala Native docs
- Update Dotty support for Scala.js
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sconfig.