- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
2.8.1.RC3 possible issue, 'implicitNotFound not found'
Fri, 2010-10-22, 05:31
This is something that showed up when compiling 2.8.0 projects with an
ENSIME built against 2.8.1.RC3. In short, it seems the 2.8.1 compiler is
trying to find a 2.8.1-only annotation class on the compilation
classpath which won't be found when compiling a 2.8.0 project.
Compile the following driver with 2.8.1.RC3
-----------------------------------------------
import scala.tools.nsc.Settings
import scala.tools.nsc.reporters.ConsoleReporter
import scala.tools.nsc.interactive.Global
object Main{
def main(args:Array[String]){
val settings = new Settings(Console.println)
settings.processArguments(
List("-verbose",
"-classpath",".:/home/aemon/lib/scala-2.8.0/lib/scala-library.jar",
"-sourcepath","."), false)
settings.usejavacp.value = false
println("\nPresentation Compiler settings:")
System.out.println(settings.toString)
println("")
val reporter = new ConsoleReporter(settings)
val c = new Global(settings, reporter)
val x = new c.Response[Unit]()
c.askReload(List(c.getSourceFile("ImplicitTest.scala")),x)
x.get
}
}
-------------------------------
ImplicitTest.scala, which will be loaded at runtime, is pasted below
-----------------------------------
import java.util._
import scala.collection.generic._
object ImplicitTest{
def main{
doImplicitely
}
def doImplicitely (implicit thing :
CanBuildFrom[String,Int,List[Int]]) = println(greeting)
}
---------------------------------------------
Now run the driver. For some reason running with the 'scala' command
causes the -usejavacp=false directive to be ignored, so I run as follows
to make sure the embedded compiler has a clean classpath, i.e. doesn't
include the 2.8.1 jars.
java -classpath
.:/home/aemon/lib/scala-2.8.1.RC3/lib/scala-library.jar:/home/aemon/lib/scala-2.8.1.RC3/lib/scala-compiler.jar
Main
Here's the output:
----------------------------------
[Classpath =
/usr/lib/jvm/java-6-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/gnome-java-bridge.jar:.:/home/aemon/lib/scala/lib/scala-library.jar]
[loaded package loader resources.jar in 856ms]
[loaded package loader java in 2ms]
[loaded package loader lang in 36ms]
[loaded package loader reflect in 26ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/package.class) in 203ms]
[loaded package loader scala in 408ms]
[loaded package loader runtime in 26ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/lang/Object.class) in 12ms]
[loaded package loader io in 7ms]
[loaded package loader util in 17ms]
[loaded package loader nio in 4ms]
[loaded package loader charset in 1ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/lang/String.class) in 107ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/package.class)
in 16ms]
[loaded package loader collection in 63ms]
[dropping dependency on node with no phase object: msil]
[promote the dependency of explicitouter: tailcalls => specialize]
[parsing ImplicitTest.scala]
[loaded package loader annotation in 1ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/Predef.class) in 31ms]
[parsing ImplicitTest.scala]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/ScalaObject.class) in 1ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/package.class)
in 16ms]
[loaded package loader generic in 21ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/ClassfileAnnotation.class)
in 9ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/Annotation.class) in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/StaticAnnotation.class) in
1ms]
[loaded package loader immutable in 20ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/immutable/List.class)
in 16ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/SeqFactory.class)
in 5ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/TraversableFactory.class)
in 8ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/GenericCompanion.class)
in 1ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/Array.class) in 15ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/LowPriorityImplicits.class)
in 3ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/CanBuildFrom.class)
in 1ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/util/List.class) in 20ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/Function1.class) in 7ms]
[loaded package loader mutable in 29ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/mutable/ArrayOps.class)
in 62ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/immutable/IndexedSeq.class)
in 12ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/immutable/Seq.class)
in 7ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/IndexedSeq.class)
in 5ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/GenericTraversableTemplate.class)
in 2ms]
[loaded package loader unchecked in 0ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/IndexedSeqLike.class)
in 6ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/immutable/Iterable.class)
in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/Seq.class)
in 3ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/SeqLike.class)
in 6ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/immutable/Traversable.class)
in 9ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/Iterable.class)
in 5ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/IterableLike.class)
in 4ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/Traversable.class)
in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/TraversableLike.class)
in 8ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/HasNewBuilder.class)
in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/generic/FilterMonadic.class)
in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/TraversableOnce.class)
in 6ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/annotation/unchecked/uncheckedVariance.class)
in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/TypeConstraint.class)
in 1ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/Immutable.class) in 1ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/Equals.class) in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/PartialFunction.class)
in 2ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/util/Collection.class)
in 6ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/lang/Iterable.class) in 2ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/collection/mutable/WrappedArray.class)
in 9ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/lang/Comparable.class)
in 1ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/io/Serializable.class)
in 1ms]
[loaded class file
/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar(java/lang/CharSequence.class)
in 1ms]
[loaded class file
/home/aemon/lib/scala/lib/scala-library.jar(scala/runtime/AnyValCompanion.class)
in 40ms]
scala.tools.nsc.MissingRequirementError: class
scala.annotation.implicitNotFound not found.
at
scala.tools.nsc.symtab.Definitions$definitions$.getModuleOrClass(Definitions.scala:517)
at
scala.tools.nsc.symtab.Definitions$definitions$.getClass(Definitions.scala:475)
at
scala.tools.nsc.symtab.Definitions$definitions$.ImplicitNotFoundClass(Definitions.scala:123)
at
scala.tools.nsc.symtab.Symbols$Symbol.implicitNotFoundMsg(Symbols.scala:465)
at
scala.tools.nsc.typechecker.Typers$Typer.errorMessage$1(Typers.scala:188)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:214)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$1.apply(Typers.scala:201)
at
scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at
scala.tools.nsc.typechecker.Typers$Typer.applyImplicitArgs(Typers.scala:201)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$adapt$1.apply(Typers.scala:844)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$adapt$1.apply(Typers.scala:844)
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:722)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:844)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4208)
at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1949)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3894)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
at
scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:4348)
at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1789)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3862)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2128)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
at scala.collection.immutable.List.loop$1(List.scala:115)
at scala.collection.immutable.List.mapConserve(List.scala:132)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2196)
at
scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1549)
at
scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1348)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3856)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2128)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$20.apply(Typers.scala:2196)
at scala.collection.immutable.List.loop$1(List.scala:115)
at scala.collection.immutable.List.mapConserve(List.scala:132)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2196)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3849)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4252)
at
scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:85)
at
scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:282)
at
scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply(Global.scala:282)
at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:282)
at
scala.tools.nsc.interactive.Global$TyperRun$$anonfun$applyPhase$1$$anonfun$apply$mcV$sp$1.apply(Global.scala:614)
at
scala.tools.nsc.interactive.Global$TyperRun$$anonfun$applyPhase$1$$anonfun$apply$mcV$sp$1.apply(Global.scala:614)
at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:103)
at
scala.tools.nsc.interactive.Global$TyperRun$$anonfun$applyPhase$1.apply(Global.scala:614)
at
scala.tools.nsc.interactive.Global$TyperRun$$anonfun$applyPhase$1.apply(Global.scala:614)
at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
at scala.tools.nsc.interactive.Global$TyperRun.applyPhase(Global.scala:613)
at scala.tools.nsc.interactive.Global$TyperRun.typeCheck(Global.scala:567)
at
scala.tools.nsc.interactive.Global$$anonfun$recompile$2.apply(Global.scala:299)
at
scala.tools.nsc.interactive.Global$$anonfun$recompile$2.apply(Global.scala:296)
at
scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.tools.nsc.interactive.Global.recompile(Global.scala:296)
at
scala.tools.nsc.interactive.Global.scala$tools$nsc$interactive$Global$$backgroundCompile(Global.scala:262)
at scala.tools.nsc.interactive.Global$$anon$3.run(Global.scala:225)
Fatal Error: scala.tools.nsc.MissingRequirementError: class
scala.annotation.implicitNotFound not found.
-----------------------------------------------------------------------------------------
I don't understand why the annotation is not loaded from the hosting
JVM's classpath.
Thanks!
Aemon
Fri, 2010-10-22, 07:57
#2
Re: 2.8.1.RC3 possible issue, 'implicitNotFound not found'
has anyone
On Fri, Oct 22, 2010 at 6:30 AM, Aemon Cannon wrote:
> This is something that showed up when compiling 2.8.0 projects with an
> ENSIME built against 2.8.1.RC3. In short, it seems the 2.8.1 compiler is
> trying to find a 2.8.1-only annotation class on the compilation classpath
> which won't be found when compiling a 2.8.0 project.
There are some library classes which are tightly bound to the compiler
(that's what Definitions is about). Or in other words, the compiler
needs particular library classes to be around, i.e. passed to the
compiler with the compile classpath.
I'm a bit surprised that this should work, mixing 2.8.1 compiler and
2.8.0 library files. I don't think binary compatibility stretches this
fat. As I understand it, what should work is compiling with 2.8.1
compiler and libraries and *run* it against a 2.8.0 library or the
other way round.
> scala.tools.nsc.MissingRequirementError: class
> scala.annotation.implicitNotFound not found.
> at
> scala.tools.nsc.symtab.Definitions$definitions$.getModuleOrClass(Definitions.scala:517)
> at
> scala.tools.nsc.symtab.Definitions$definitions$.getClass(Definitions.scala:475)
> at
> scala.tools.nsc.symtab.Definitions$definitions$.ImplicitNotFoundClass(Definitions.scala:123)
That's an error message from the compiler not from the JVM running the
compiler. So this
> I don't understand why the annotation is not loaded from the hosting JVM's
> classpath.
should be clear then, because you explicitly stated with
usejavacp=false that you don't want that to happen.
But we can phrase a new question: Why does the compiler need some
class-files around for compiling, which the program will never need at
runtime? My guess is, that it was probably easier to enter them into
the symbol table by using the normal mechanism (i.e. compiled source
code distributed with the library) than to enter it manually
somewhere.
BTW: This ImplicitNotFound annotation seems like a cool new feature,
was it announced somewhere?
Fri, 2010-10-22, 09:37
#3
Re: Re: 2.8.1.RC3 possible issue, 'implicitNotFound not found'
On Fri, Oct 22, 2010 at 7:55 AM, Johannes Rudolph <johannes.rudolph@googlemail.com> wrote:
As usual, commit messages are a good source of information:
https://lampsvn.epfl.ch/trac/scala/changeset/22804
I am not aware of any other announcement.
Best,Ismael
BTW: This ImplicitNotFound annotation seems like a cool new feature,
was it announced somewhere?
As usual, commit messages are a good source of information:
https://lampsvn.epfl.ch/trac/scala/changeset/22804
I am not aware of any other announcement.
Best,Ismael
Fri, 2010-10-22, 09:47
#4
Re: Re: 2.8.1.RC3 possible issue, 'implicitNotFound not found'
Yep, that's the one I read as well. I've to get back to the habit of
glancing over new commits regularly...
On Fri, Oct 22, 2010 at 10:31 AM, Ismael Juma wrote:
> On Fri, Oct 22, 2010 at 7:55 AM, Johannes Rudolph
> wrote:
>>
>> BTW: This ImplicitNotFound annotation seems like a cool new feature,
>> was it announced somewhere?
>
> As usual, commit messages are a good source of information:
> https://lampsvn.epfl.ch/trac/scala/changeset/22804
> I am not aware of any other announcement.
> Best,
> Ismael
Fri, 2010-10-22, 19:27
#5
Re: 2.8.1.RC3 possible issue, 'implicitNotFound not found'
Replying to a reply in scala.internals, which I can't reply to:
Johannes Rudolph wrote:
>There are some library classes which are tightly bound to the compiler
>(that's what Definitions is about). Or in other words, the compiler
>needs particular library classes to be around, i.e. passed to the
>compiler with the compile classpath.
>I'm a bit surprised that this should work, mixing 2.8.1 compiler and
>2.8.0 library files. I don't think binary compatibility stretches this
>fat. As I understand it, what should work is compiling with 2.8.1
>compiler and libraries and *run* it against a 2.8.0 library or the
>other way round.
Hmmm, I wouldn't have guessed that the compiler would have dependencies
on a particular library version being on the compilation classpath; just
that the binaries on the classpath are binary-compatible with the
compiler (which they should be in this case).
If this is the case, I'll need to maintain separate 2.8.0 and a 2.8.1
versions of ENSIME.
Thanks,
Aemon
On 10/21/2010 09:30 PM, Aemon Cannon wrote:
Oops, typo in the input file. Should be
--------------------
import java.util._
import scala.collection.generic._
object ImplicitTest{
def main{
val str = "helloooooooo!"
doImplicitely
}
def doImplicitely (implicit thing :
CanBuildFrom[String,Int,List[Int]]) = println(thing)
}