Re: [scala-ide-user] Presentation compiler crashed while type checking this file: scala.tools.nsc.FatalError: object List does not have a member apply

727 views
Skip to first unread message

iulian dragos

unread,
Jun 19, 2012, 4:27:07 AM6/19/12
to scala-i...@googlegroups.com
On Tue, Jun 19, 2012 at 12:46 AM, Brett Hoerner <bretth...@gmail.com> wrote:
> Hi,
>
> The first line in my files (a package statement) shows an error and when I
> hover I see,
>
>   Presentation compiler crashed while type checking this file:
> scala.tools.nsc.FatalError: object List does not have a member apply
>
> What odd is that sbt compile works fine, the project has been in production
> for a while, and the Eclipse project was generated with "sbt eclipse." I
> assume you may need more information, but I'm not sure what -- how can I
> help?

It be good if you can tell us the following:

- full version string of the plugin and compiler bundles (you can
retrieve them from the Scala/Report a bug menu)
- enable the DEBUG level on the Scala/Logging preferences page
- enable Ypresentation-verbose and Ypresentation-debug on the compiler
options page
- send us the log file

Preferably, the workspace on which you try these things should have
just the problematic project open.

thanks,
iulian

>
> Thanks,
> Brett



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

Mirco Dotta

unread,
Jun 19, 2012, 4:31:39 AM6/19/12
to scala-i...@googlegroups.com
On Jun 19, 2012, at 10:27 AM, iulian dragos wrote:

On Tue, Jun 19, 2012 at 12:46 AM, Brett Hoerner <bretth...@gmail.com> wrote:
Hi,

The first line in my files (a package statement) shows an error and when I
hover I see,

  Presentation compiler crashed while type checking this file:
scala.tools.nsc.FatalError: object List does not have a member apply

What odd is that sbt compile works fine, the project has been in production
for a while, and the Eclipse project was generated with "sbt eclipse." I
assume you may need more information, but I'm not sure what -- how can I
help?

It be good if you can tell us the following:

- full version string of the plugin and compiler bundles (you can
retrieve them from the Scala/Report a bug menu)
- enable the DEBUG level on the Scala/Logging preferences page

That can only if you are currently using the 2.1 (Helium) nightlies


If you are on 2.0.x, then you should fire up eclipse using the terminal, all debug information 
are printed in the sysout.
- enable Ypresentation-verbose and Ypresentation-debug on the compiler
options page
- send us the log file

Preferably, the workspace on which you try these things should have
just the problematic project open.

thanks,
iulian


Thanks,
Brett



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais


---------------
Mirco Dotta
Typesafe - The software stack for applications that scale
PSE-D, 1015 Lausanne, Switzerland
Twitter: @mircodotta








James Moore

unread,
Jun 19, 2012, 11:19:37 AM6/19/12
to scala-i...@googlegroups.com
On Mon, Jun 18, 2012 at 3:46 PM, Brett Hoerner <bretth...@gmail.com> wrote:
Hi,

The first line in my files (a package statement) shows an error and when I hover I see,

  Presentation compiler crashed while type checking this file: scala.tools.nsc.FatalError: object List does not have a member apply

Do you do any preprocessing of the scala-library.jar file?

Users of the AndroidProguardScala plugin reported the same problem.  In that case, it was because a version of scala-library.jar that had been run through ProGuard was on the classpath before the classpath container for the Scala IDE.  You might want to double-check your $PROJECT/classpath file and make sure it's not pointing to multiple scala libraries.  Wouldn't affect sbt builds if that were the problem.

(In the plugin, I fixed it by altering the classpath order when you attach the plugin nature to the project.  I just moved the scala ide classpath container to be the first entry in the classpath.)

--
James Moore
ja...@restphone.com
http://blog.restphone.com/
http://www.linkedin.com/in/jamesmmooreiv

Brett Hoerner

unread,
Jun 19, 2012, 10:16:17 PM6/19/12
to scala-i...@googlegroups.com
I can't find the "Report a Bug" menu to get the full list of software, but I think this includes them:

From console when I run Eclipse:

[ScalaPlugin] [scalaLibBundle] Found 1 bundles: org.scala-ide.scala.library_2.9.2.v20120330-163119-949a4804e4-vfinal [206]
[StartupDiagnostics$] startup diagnostics: previous version = 2.0.1.v-2_09-201204232213-dae5cd4
[StartupDiagnostics$] startup diagnostics: CURRENT version = 2.0.1.v-2_09-201204232213-dae5cd4
[ScalaPlugin] Scala compiler bundle: reference:file:../../../home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.scala-ide.scala.compiler_2.9.2.v20120330-163119-949a4804e4-vfinal.jar

[...snip...]

[ScalaProject] SOURCEPATH: /home/brett/Development/mr/streamer/src/main/scala
/home/brett/Development/mr/streamer/src/main/java
/home/brett/Development/mr/streamer/src/test/scala
/home/brett/Development/mr/streamer/src/test/java
[ScalaProject] setting additional paramters: 
[ScalaSourceFile] [Streamer] buildStructure for L/Streamer/src/main/scala/com/massrel/streamer/ControlStreamer.scala
[ScalaPlugin] open ControlStreamer.scala
[ControlStreamer.scala]: exception during background compile: scala.tools.nsc.FatalError: object List does not have a member apply
scala.tools.nsc.FatalError: object List does not have a member apply
at scala.tools.nsc.symtab.Definitions$definitions$.getMember(Definitions.scala:623)
at scala.tools.nsc.symtab.Definitions$definitions$.List_apply(Definitions.scala:320)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2458)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3373)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4106)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.collection.immutable.List.loop$1(List.scala:148)
at scala.collection.immutable.List.mapConserve(List.scala:164)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1919)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3953)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4333)
at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1758)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3921)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.collection.immutable.List.loop$1(List.scala:148)
at scala.collection.immutable.List.mapConserve(List.scala:164)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1512)
at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1278)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3912)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:2100)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$24.apply(Typers.scala:2184)
at scala.collection.immutable.List.loop$1(List.scala:148)
at scala.collection.immutable.List.mapConserve(List.scala:164)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:2184)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3908)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4273)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4333)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:94)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:329)
at scala.tools.nsc.interactive.Global$TyperRun$$anonfun$applyPhase$1.apply(Global.scala:1054)
at scala.tools.nsc.interactive.Global$TyperRun$$anonfun$applyPhase$1.apply(Global.scala:1054)
at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:95)
at scala.tools.nsc.interactive.Global$TyperRun.applyPhase(Global.scala:1054)
at scala.tools.nsc.interactive.Global$TyperRun.typeCheck(Global.scala:1047)
at scala.tools.nsc.interactive.Global.scala$tools$nsc$interactive$Global$$typeCheck(Global.scala:556)
at scala.tools.nsc.interactive.Global$$anonfun$backgroundCompile$5$$anonfun$apply$7.apply(Global.scala:473)
at scala.tools.nsc.interactive.Global$$anonfun$backgroundCompile$5.apply(Global.scala:469)
at scala.tools.nsc.interactive.Global$$anonfun$backgroundCompile$5.apply(Global.scala:469)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:743)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:76)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:742)
at scala.tools.nsc.interactive.Global.backgroundCompile(Global.scala:469)
at scala.tools.nsc.interactive.PresentationCompilerThread.run(PresentationCompilerThread.scala:25)
[ControlStreamer.scala] marking unit as crashed (crashedFiles: Set(/home/brett/Development/mr/streamer/src/main/scala/com/massrel/streamer/ControlStreamer.scala))

Brett Hoerner

unread,
Jun 19, 2012, 10:18:54 PM6/19/12
to scala-i...@googlegroups.com
On Tuesday, June 19, 2012 10:19:37 AM UTC-5, James Moore wrote:
Do you do any preprocessing of the scala-library.jar file?

No, I'm not doing anything funny that I know of. I don't see multiple scala-library jars included, either.

I don't, however, see a classpath file in project/. The only file with classpath in the name I see in my project dir is $ROOT/.classpath, and I didn't have any dupes or fancy/weird libraries in it, either.

Thanks,
Brett

iulian dragos

unread,
Jun 20, 2012, 1:59:08 AM6/20/12
to scala-i...@googlegroups.com
On Wed, Jun 20, 2012 at 4:16 AM, Brett Hoerner <bretth...@gmail.com> wrote:
> I can't find the "Report a Bug" menu to get the full list of software, but I
> think this includes them:
>
> From console when I run Eclipse:
>
> [ScalaPlugin] [scalaLibBundle] Found 1 bundles:
> org.scala-ide.scala.library_2.9.2.v20120330-163119-949a4804e4-vfinal [206]
> [StartupDiagnostics$] startup diagnostics: previous version =
> 2.0.1.v-2_09-201204232213-dae5cd4
> [StartupDiagnostics$] startup diagnostics: CURRENT version =
> 2.0.1.v-2_09-201204232213-dae5cd4
> [ScalaPlugin] Scala compiler bundle:
> reference:file:../../../home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.scala-ide.scala.compiler_2.9.2.v20120330-163119-949a4804e4-vfinal.jar
>
> [...snip...]
>
> [ScalaProject] SOURCEPATH:
> /home/brett/Development/mr/streamer/src/main/scala
> /home/brett/Development/mr/streamer/src/main/java
> /home/brett/Development/mr/streamer/src/test/scala
> /home/brett/Development/mr/streamer/src/test/java

Thanks Brett. Can you please include a bit more information from the
log file? You snipped a bit too early. Just above the SOURCEPATH one
would see the classpath, and that's the important bit: it looks like
it doesn't have the 'correct' Scala library.

iulian

Brett Hoerner

unread,
Jun 20, 2012, 8:32:51 AM6/20/12
to scala-i...@googlegroups.com
Sorry, here's the full output.

Interestingly, the first time I launched Eclipse this morning it hung indefinitely: https://gist.github.com/6c767d99cd151567d2d8

After that I killed it and tried again and it worked (incase the output is different): https://gist.github.com/bbdfb1870513d3d79e1f

Brett

James Moore

unread,
Jun 20, 2012, 9:20:02 AM6/20/12
to scala-i...@googlegroups.com
My fault - that was a typo.  I meant the same .classpath file you see.

Brett Hoerner

unread,
Jun 20, 2012, 10:51:31 AM6/20/12
to scala-i...@googlegroups.com
If it helps, here is my .classpath:

iulian dragos

unread,
Jun 20, 2012, 11:35:21 AM6/20/12
to scala-i...@googlegroups.com
On Wed, Jun 20, 2012 at 2:32 PM, Brett Hoerner <bretth...@gmail.com> wrote:
> Sorry, here's the full output.
>
> Interestingly, the first time I launched Eclipse this morning it hung
> indefinitely: https://gist.github.com/6c767d99cd151567d2d8
>
> After that I killed it and tried again and it worked (incase the output is
> different): https://gist.github.com/bbdfb1870513d3d79e1f

It definitely has the scala library jar in there. Can you please send
me the sha hash of the file?

shasum /home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar

and also the result of

javap -classpath
/home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar
scala.collection.immutable.List$ (you may need to escape the $ on the
command line)

thanks,
iulian

Brett Hoerner

unread,
Jun 20, 2012, 11:37:43 AM6/20/12
to scala-i...@googlegroups.com
On Wed, Jun 20, 2012 at 10:35 AM, iulian dragos <jagu...@gmail.com> wrote:
> It definitely has the scala library jar in there. Can you please send
> me the sha hash of the file?
>
> shasum /home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar

055cf429e92d45524a548929a9d6e790205a0e61
/home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar



> and also the result of
>
> javap -classpath
> /home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar
> scala.collection.immutable.List$


$ javap -classpath
/home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar
scala.collection.immutable.List$
Compiled from "List.scala"
public final class scala.collection.immutable.List$ extends
scala.collection.generic.SeqFactory implements scala.ScalaObject{
public static final scala.collection.immutable.List$ MODULE$;
public static {};
public scala.collection.generic.CanBuildFrom canBuildFrom();
public scala.collection.mutable.Builder newBuilder();
public scala.collection.immutable.List empty();
public scala.collection.immutable.List apply(scala.collection.Seq);
public scala.collection.immutable.List range(int, int, scala.Function1);
public scala.collection.immutable.List make(int, java.lang.Object);
public scala.collection.immutable.List
flatten(scala.collection.immutable.List);
public scala.Tuple2 unzip(scala.collection.immutable.List);
public scala.Tuple2 unzip(scala.collection.Iterable);
public scala.collection.immutable.List lefts(scala.collection.Iterable);
public scala.collection.immutable.List rights(scala.collection.Iterable);
public scala.Tuple2 separate(scala.collection.Iterable);
public scala.collection.immutable.List
fromIterator(scala.collection.Iterator);
public scala.collection.immutable.List fromArray(java.lang.Object);
public scala.collection.immutable.List fromArray(java.lang.Object,
int, int);
public scala.collection.immutable.List fromString(java.lang.String, char);
public java.lang.String toString(scala.collection.immutable.List);
public scala.collection.immutable.List
mapConserve(scala.collection.immutable.List, scala.Function1);
public scala.collection.immutable.List
map2(scala.collection.immutable.List, scala.collection.immutable.List,
scala.Function2);
public scala.collection.immutable.List
map3(scala.collection.immutable.List, scala.collection.immutable.List,
scala.collection.immutable.List, scala.Function3);
public boolean forall2(scala.collection.immutable.List,
scala.collection.immutable.List, scala.Function2);
public boolean exists2(scala.collection.immutable.List,
scala.collection.immutable.List, scala.Function2);
public scala.collection.immutable.List
transpose(scala.collection.immutable.List);
public scala.collection.GenTraversable apply(scala.collection.Seq);
public scala.collection.GenTraversable empty();
}

iulian dragos

unread,
Jun 20, 2012, 11:58:38 AM6/20/12
to scala-i...@googlegroups.com
Thanks. It's the right one. 

It was a bit hard to figure out, but the classpath contains these entries before the scala-library:

[Streamer] classpath: merged classpath (directory classpath: <JDK classes snipped>,
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/classes
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/test-classes
directory classpath: /home/brett/Development/mr/streamer/lib/sbt-launch-0.11.2.jar
directory classpath: /home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar

It happens that Sbt ships a reduced Scala library inside sbt-launch.jar, and that's the first hit for `scala.collection.immutable.List`. That one does not have an `apply` method. James, you were right about a truncated scala library, just that it wasn't proguard who did it!

scalap -classpath /Users/dragos/bin/sbt-launch.jar scala.collection.immutable.List
package scala.collection.immutable;
abstract class List extends scala.AnyRef with scala.collection.LinearSeqOptimized with scala.collection.LinearSeq with scala.Product {
 def this(): scala.Unit;
 def take(scala.Int): scala.Any;
 ...

Try removing sbt-launch from the project's classpath, or move it below the Scala library container. Recent nightly builds are a bit smarter about the Scala library, and put it in front of the other entries, so you could give it a try.

cheers,
iulian

Mirco Dotta

unread,
Jun 20, 2012, 12:05:44 PM6/20/12
to scala-i...@googlegroups.com
On Jun 20, 2012, at 5:58 PM, iulian dragos wrote:

Thanks. It's the right one. 

It was a bit hard to figure out, but the classpath contains these entries before the scala-library:

[Streamer] classpath: merged classpath (directory classpath: <JDK classes snipped>,
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/classes
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/test-classes
directory classpath: /home/brett/Development/mr/streamer/lib/sbt-launch-0.11.2.jar
directory classpath: /home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar

It happens that Sbt ships a reduced Scala library inside sbt-launch.jar, and that's the first hit for `scala.collection.immutable.List`. That one does not have an `apply` method. James, you were right about a truncated scala library, just that it wasn't proguard who did it!

scalap -classpath /Users/dragos/bin/sbt-launch.jar scala.collection.immutable.List
package scala.collection.immutable;
abstract class List extends scala.AnyRef with scala.collection.LinearSeqOptimized with scala.collection.LinearSeq with scala.Product {
 def this(): scala.Unit;
 def take(scala.Int): scala.Any;
 ...

Try removing sbt-launch from the project's classpath, or move it below the Scala library container. Recent nightly builds are a bit smarter about the Scala library, and put it in front of the other entries, so you could give it a try.


Wow, that definitely looks like something we should add to our FAQ


Anyone up for a contribution ;)

Brett Hoerner

unread,
Jun 20, 2012, 12:19:50 PM6/20/12
to scala-i...@googlegroups.com
On Wed, Jun 20, 2012 at 10:58 AM, iulian dragos <jagu...@gmail.com> wrote:
> Try removing sbt-launch from the project's classpath, or move it below the
> Scala library container. Recent nightly builds are a bit smarter about the
> Scala library, and put it in front of the other entries, so you could give
> it a try.

This did it, thanks. To be clear, do you mean the nightlies of the sbt
eclipse generator, or the scala-ide plugin itself?

Thanks,
Brett

iulian dragos

unread,
Jun 20, 2012, 12:34:57 PM6/20/12
to scala-i...@googlegroups.com
The Scala IDE itself. Are you using sbteclipse to generate the project files?

iulian
 

Thanks,
Brett

Brett Hoerner

unread,
Jun 20, 2012, 12:36:12 PM6/20/12
to scala-i...@googlegroups.com
On Wed, Jun 20, 2012 at 11:34 AM, iulian dragos <jagu...@gmail.com> wrote:
> The Scala IDE itself. Are you using sbteclipse to generate the project
> files?

I am indeed, is that recommended?

Iulian Dragos

unread,
Jun 20, 2012, 12:38:52 PM6/20/12
to scala-i...@googlegroups.com
Yes, i was just wondering. I dont think it's a bug, but I'd ask on
their mailing list as well.

James Moore

unread,
Jun 21, 2012, 12:37:49 PM6/21/12
to scala-i...@googlegroups.com
It might be useful to modify the "More than one scala library found in the build path" code in ClasspathManagement to actually print out the names of the scala libraries that it's worried about.  Might lead people to the solution on their own.  (I'm assuming that the warning message was showing up for any project that had these symptoms). 

And if someone's in there touching that code, I'd personally like a way to turn off that warning.  The problem is that Android really does want two Scala libraries on the build path, and I know that one of them is generated from the other one.  

Or maybe have a flag we can set in the minified scala-library.jar file that says "I am a strict subset of the scala-library.jar that (has this checksum?  has this path?)"

 - James

Ben Wing

unread,
Jun 26, 2012, 11:24:01 PM6/26/12
to scala-i...@googlegroups.com


On Wednesday, June 20, 2012 12:05:44 PM UTC-4, Mirco Dotta wrote:

On Jun 20, 2012, at 5:58 PM, iulian dragos wrote:

Thanks. It's the right one. 

It was a bit hard to figure out, but the classpath contains these entries before the scala-library:

[Streamer] classpath: merged classpath (directory classpath: <JDK classes snipped>,
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/classes
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/test-classes
directory classpath: /home/brett/Development/mr/streamer/lib/sbt-launch-0.11.2.jar
directory classpath: /home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar

It happens that Sbt ships a reduced Scala library inside sbt-launch.jar, and that's the first hit for `scala.collection.immutable.List`. That one does not have an `apply` method. James, you were right about a truncated scala library, just that it wasn't proguard who did it!

scalap -classpath /Users/dragos/bin/sbt-launch.jar scala.collection.immutable.List
package scala.collection.immutable;
abstract class List extends scala.AnyRef with scala.collection.LinearSeqOptimized with scala.collection.LinearSeq with scala.Product {
 def this(): scala.Unit;
 def take(scala.Int): scala.Any;
 ...

Try removing sbt-launch from the project's classpath, or move it below the Scala library container. Recent nightly builds are a bit smarter about the Scala library, and put it in front of the other entries, so you could give it a try.


Wow, that definitely looks like something we should add to our FAQ


Anyone up for a contribution ;)


Hi.  I'd like to add, I ran into the same problem when I just tried to get Eclipse+Scala IDE working for the first time with an existing project that's built with SBT.  In my case I didn't use sbt-eclipse, just created an Eclipse project and set the working directory to the directory of my existing project.  I suspect this bug will happen with *every* SBT project.  This suggests to me that incorporating the fix that Iulian mentions (put the Scala library) first is high priority and should definitely go into release 2.0.2.

ben

 


cheers,
iulian

On Wed, Jun 20, 2012 at 5:37 PM, Brett Hoerner wrote:

Ben Wing

unread,
Jun 26, 2012, 11:25:27 PM6/26/12
to scala-i...@googlegroups.com


On Tuesday, June 26, 2012 11:24:01 PM UTC-4, Ben Wing wrote:


On Wednesday, June 20, 2012 12:05:44 PM UTC-4, Mirco Dotta wrote:

On Jun 20, 2012, at 5:58 PM, iulian dragos wrote:

Thanks. It's the right one. 

It was a bit hard to figure out, but the classpath contains these entries before the scala-library:

[Streamer] classpath: merged classpath (directory classpath: <JDK classes snipped>,
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/classes
directory classpath: /home/brett/Development/mr/streamer/target/scala-2.9.2/test-classes
directory classpath: /home/brett/Development/mr/streamer/lib/sbt-launch-0.11.2.jar
directory classpath: /home/brett/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/org.eclipse.osgi/bundles/206/1/.cp/lib/scala-library.jar

It happens that Sbt ships a reduced Scala library inside sbt-launch.jar, and that's the first hit for `scala.collection.immutable.List`. That one does not have an `apply` method. James, you were right about a truncated scala library, just that it wasn't proguard who did it!

scalap -classpath /Users/dragos/bin/sbt-launch.jar scala.collection.immutable.List
package scala.collection.immutable;
abstract class List extends scala.AnyRef with scala.collection.LinearSeqOptimized with scala.collection.LinearSeq with scala.Product {
 def this(): scala.Unit;
 def take(scala.Int): scala.Any;
 ...

Try removing sbt-launch from the project's classpath, or move it below the Scala library container. Recent nightly builds are a bit smarter about the Scala library, and put it in front of the other entries, so you could give it a try.


Wow, that definitely looks like something we should add to our FAQ


Anyone up for a contribution ;)


Hi.  I'd like to add, I ran into the same problem when I just tried to get Eclipse+Scala IDE working for the first time with an existing project that's built with SBT.  In my case I didn't use sbt-eclipse, just created an Eclipse project and set the working directory to the directory of my existing project.  I suspect this bug will happen with *every* SBT project.  This suggests to me that incorporating the fix that Iulian mentions (put the Scala library) first is high priority and should definitely go into release 2.0.2.

ben

Blah, somehow the right paren migrated.  Should say "(put the Scala library first) ..."

iulian dragos

unread,
Jun 27, 2012, 4:04:20 AM6/27/12
to scala-i...@googlegroups.com
On Thu, Jun 21, 2012 at 6:37 PM, James Moore <ja...@restphone.com> wrote:
It might be useful to modify the "More than one scala library found in the build path" code in ClasspathManagement to actually print out the names of the scala libraries that it's worried about.  Might lead people to the solution on their own.  (I'm assuming that the warning message was showing up for any project that had these symptoms).  

And if someone's in there touching that code, I'd personally like a way to turn off that warning.  The problem is that Android really does want two Scala libraries on the build path, and I know that one of them is generated from the other one.  

That's a good idea. Would you like to give it a go? :) BTW, if Android projects have a specific nature, this warning could be tailored (or disabled) automatically for them.

iulian
 

Or maybe have a flag we can set in the minified scala-library.jar file that says "I am a strict subset of the scala-library.jar that (has this checksum?  has this path?)"

 - James

James Moore

unread,
Jun 29, 2012, 12:49:19 PM6/29/12
to scala-i...@googlegroups.com
On Wed, Jun 27, 2012 at 1:04 AM, iulian dragos <jagu...@gmail.com> wrote:
And if someone's in there touching that code, I'd personally like a way to turn off that warning.  The problem is that Android really does want two Scala libraries on the build path, and I know that one of them is generated from the other one.  

That's a good idea. Would you like to give it a go? :) BTW, if Android projects have a specific nature, this warning could be tailored (or disabled) automatically for them.

Sure, I'll put this on my todo list.  I'm at GoogleIO this week, and I talked to one of the guys on the ADT team about the problem; they think it might be useful to fix on their side too.  (The problem could be solved if the Android build system had a way to say "use this version of the library for code completion, and this other version for dex'ing")

James Moore

unread,
Jul 18, 2012, 12:17:04 AM7/18/12
to scala-i...@googlegroups.com
On Wed, Jun 27, 2012 at 1:04 AM, iulian dragos <jagu...@gmail.com> wrote:
>> And if someone's in there touching that code, I'd personally like a way to
>> turn off that warning. The problem is that Android really does want two
>> Scala libraries on the build path, and I know that one of them is generated
>> from the other one.
>
>
> That's a good idea. Would you like to give it a go? :) BTW, if Android
> projects have a specific nature, this warning could be tailored (or
> disabled) automatically for them.

Something like this?

https://github.com/banshee/scala-ide/commit/84af570d162dcc29f46f4cc8968291b1af247b9f

Put a version number in parent.version in library.properties, and if
that parent version is identical to the version number of the
libraries on the classpath, don't warn.

Seemed like that would be better than special code for the Android library.

iulian dragos

unread,
Jul 27, 2012, 3:18:38 PM7/27/12
to scala-i...@googlegroups.com
On Wed, Jul 18, 2012 at 6:17 AM, James Moore <ja...@restphone.com> wrote:
On Wed, Jun 27, 2012 at 1:04 AM, iulian dragos <jagu...@gmail.com> wrote:
>> And if someone's in there touching that code, I'd personally like a way to
>> turn off that warning.  The problem is that Android really does want two
>> Scala libraries on the build path, and I know that one of them is generated
>> from the other one.
>
>
> That's a good idea. Would you like to give it a go? :) BTW, if Android
> projects have a specific nature, this warning could be tailored (or
> disabled) automatically for them.

Something like this?

https://github.com/banshee/scala-ide/commit/84af570d162dcc29f46f4cc8968291b1af247b9f

Put a version number in parent.version in library.properties, and if
that parent version is identical to the version number of the
libraries on the classpath, don't warn.

Looks good! Sorry for taking so long, I missed this email. For this sort of things, it's better to issue a pull-request directly. Less likely to be missed :)

thanks,
iulian
 

Seemed like that would be better than special code for the Android library.
Reply all
Reply to author
Forward
0 new messages