This page is no longer maintained — Please continue to the home page at www.scala-lang.org

jdk6 javac cannot process scala generated classfiles

2 replies
Daniel Mahler
Joined: 2009-05-25,
User offline. Last seen 1 year 24 weeks ago.

The jdk6 compiler is sometimes used to process compiled classfiles as in

javac -Xprint mypkg.Myclass
javac -proc:only -Xlint:-processing -processor MyProcessor mypkg.Myclass

However if I try this with Scala classfiles I get

+++++++++++++++++++++++++++++++++++++++++++++++++
error: cannot access mypkg.MyClass.$anon$4
bad class file: mypkg/MyClass$$anon$4.class
undeclared type variable: A
Please remove or make sure it appears in the correct subdirectory of
the classpath.
+++++++++++++++++++++++++++++++++++++++++++++++++

Is there a way to make this work? I need to be able to post-process
Scala classfiles
in order to use scala in a Java based project.

thanks
Daniel

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: jdk6 javac cannot process scala generated classfiles

On Sun, Mar 21, 2010 at 4:18 AM, Daniel Mahler wrote:
> Is there a way to make this work? I need to be able to post-process
> Scala classfiles

You have to provide more details, starting with the Scala version
you're using. If it's 2.7.x, try with 2.8.0.Beta1 and/or nightly. If
the latter, then steps to reproduce with a small example would help in
a resolution (assuming that a bug for it doesn't already exist in
trac).

Best,
Ismael

Daniel Mahler
Joined: 2009-05-25,
User offline. Last seen 1 year 24 weeks ago.
Re: jdk6 javac cannot process scala generated classfiles

On Sun, Mar 21, 2010 at 9:42 AM, Ismael Juma wrote:
> On Sun, Mar 21, 2010 at 4:18 AM, Daniel Mahler wrote:
>> Is there a way to make this work? I need to be able to post-process
>> Scala classfiles
>
> You have to provide more details, starting with the Scala version
> you're using. If it's 2.7.x, try with 2.8.0.Beta1 and/or nightly. If
> the latter, then steps to reproduce with a small example would help in
> a resolution (assuming that a bug for it doesn't already exist in
> trac).

Sorry, it was late ...

I am using 2.8.0.r21010-b2010022802013

The problem can be reproduced on the scala libraries. eg:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
$ javac -cp scala-library.jar -Xprint scala.actors.Actor
error: cannot access scala.actors.Actor.$anonfun$receiveWithin$1
class file for scala.actors.Actor$$anonfun$receiveWithin$1 not found
1 error
+++++++++++++++++++++++++++++++++++++++++++++++++++++++

thanks
Daniel

> Best,
> Ismael
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland