I've spent a good few hours googling for something to allow me to open Zip files in Scala (I know you can just use the Java API, but I was hoping to find a Scala friendly wrapper for it instead of faffing about writing Buffered/FileInputstream and so on)
So I was just messing about in the REPL and found this package
scala.tools.nsc.io.ZipArchive
Which after some digging and using this scala.tools.nsc.io.File, I managed to open a zip archive with all of the Scala niceness (being able to foreach etc)
The thing is I can't see any mention of this package in the official Scala 2.8.1 API document, so I was just wondering why there's no documentation on it? What is it?
this package contains Compiler-related classes. It's mainly used (as far as I know) for Plugin creation.
Due to it being related to Scala compiler, I'm not sure to which point it is a "stable" package and how much may it change between Scala versions, so be careful there.
Related
I'm working on a Scala project and wanted to play around with Hunspell. Since Hunspell seems to compile to native, it seems I need a JNA/JNI based API to deal with it. The link to the JNA version offered on the original Hunspell site is broken, though I managed to get the JNI version.
I've heard that JNA tends to be easier to use, which is what I'm looking for right now. I did find this repo: https://github.com/dren-dk/HunspellJNA, but it hasn't been updated in several years, so I'm not sure if it's a good idea to use it. I can't tell if it's a good version, or just someone's pet project that they abandoned halfway through.
My questions:
Is it a good idea to use this repo I found?
Does anyone know of a better way to use Hunspell with a Scala project?
I ended up using the BridJ version.
It seems to be a much simpler, bare bones version that's available on Maven Central, so I simply added the following line to my build.sbt.
"com.atlascopco" % "hunspell-bridj" % "1.0.4"
Github:
https://github.com/thomas-joiner/HunspellBridJ
Maven:
http://search.maven.org/#artifactdetails%7Ccom.atlascopco%7Chunspell-bridj%7C1.0.4%7Cjar
Looking for a stable Scala implementation (or something similar) of JGit.
Has anyone worked with anything like it?
I've found scala-git but it's not what I'm looking for.
I did the same search some time ago, but I concluded that it was preferable to use JGit (even if it's a Java library) in Scala. It's used by products with lots of users (eclipse, netbeans, gerrit,...) and even some Scala products like Gitbucket use it.
Its API can be easily called from Scala, and does not result in ugly code, nor needs heavy wrappers.
Personally I prefer using a Java lib widely used than a pure Scala lib for which I don't know the roadmap nor if it's still maintained. I thought to ScalaGit but it seemed really young (only 67 commits) and not actively maintained (last commit on Apr 21, 2014).
Any java library (like jgit) is perfectly usable in scala as scala run in the java runtime environment. Is there any reason why you can't use it?
I've been searching for a long time now to find a decent IDE for Scala.
Eclipse is not satisfying at all, as auto completion doesn't work, somehow. Also, I can't modify the libraries at all in the build path e.g. set the docs/source.
IntelliJ seems better, however, there are some major bugs:
When the drop down menu appears that lists all the function, some of them are sometimes just not shown! I think it's because of scala-library / scala-compiler, it mixes them up or something...
The docs cannot be fetched, I get this message over and over again (here the functions are listed, strange enough...):
This is the library window:
The dependencies and the compiler are set right, I strongly suppose.
Does anyone know what the problem is? And how to fix it? Or is it a known bug?
Is there an IDE that can handle Scala?
Regards!
Typically, searching for names (values/classes/functions/etc.) for auto-complete can be quite slow compared to Java in IntelliJ simply because the automatically imported namespace can be quite large, and it also searches through all implicit conversions. However, I've never seen it refuse to show functions like your screenshot, what version of IntelliJ and Scala plugin are you using?
I've never gotten the pop-up docs to work via attaching JavaDocs (I haven't tried remote fetching), so I'd recommend just ctrl+click to go through to the source to read the documentation there. (However, the function/type definition does popup correctly when sources are attached). I'd suggest posting an issue at http://youtrack.jetbrains.com/issues/SCL if you have the opportunity.
To your final question, the answer is unfortunately no. The tooling for Scala is nowhere near that of Java, but both Scala IDE for Eclipse and IntelliJ are making great progress in changing that, and both are strong in some areas while weak in others. In the end, you'll get limited support either way, so choose whichever fits you best.
I have found the solution to the problem:
The bug was caused by Java Decompiler Plugin. It tried to decompile the binaries of Scala's class-files, which obviously failed. This led to that error message and further led to the Scala plugin not working as it should, thus not displaying some of the functions.
This took me a long time to figure out, I installed 2 other versions of IntelliJ (which apparently imported the JD plugin), NetBeans and downloaded several builds of the Scala Plugin, only to discover this cause. Deactivating Java Decompiler solved it.
Regards.
I'm having a hard time finding some classes in Lucene.NET. I'm using v. 2.9.2 and cannot find the Highliter, QueryScorer classes. (referenced in this question as well: Highlighting whole sentence in Lucene.net 2.9.2)
I've searched through the source and such and cannot find them, but somehow I keep coming across people who are using it.
You can download the source from here using SVN. But there is no binary, you have to compile it by yourself.
I am new to Scala. However, I a created a medium size program with Scala 2.9.0. Now I want to use an open source library which is only available for Scala 2.7.7.
Is it possible to use this 2.7.7 library in my Scala 2.9.0 program? How can I do it? I had already a look at sbt but did not really succeed. Has someone a hello world example for this?
It should be possible in principle using a custom classloader for the 2.7.7 jar and custom wrappers. But practically, since the library is open source, it's very likely that it would be less work to recompile it with 2.9 and make those changes which are required. (There usually aren't many.)
Typesafe has an early preview of a migration manager (http://typesafe.com/technology/migration-manager) which promises to report on and resolve binary incompatibilities. Apparently the early preview only report on incompatibilities, but it might be worth a shot.
The best approach would be to either use a maintained library or to update the code.
If you take the second option, compile the code with the flags -deprecation and -Xmigration.
This tells you what you need to change between versions.