Still getting class cast exceptions

72 views
Skip to first unread message

David Chase

unread,
Jan 26, 2011, 2:23:14 PM1/26/11
to scala-i...@googlegroups.com
I am using freshly unpacked Helios with a freshly installed scala-ide

http://download.scala-ide.org/nightly-update-helios-trunk

nightly, because I wanted the latest bits with all the bug fixes.

This program (Test.java):

package simple;
import scala.collection.immutable.Nil;
public class Test {
public static void main(String[] args) {
scala.collection.immutable.List<Integer> myList = new Nil();
}
}

causes

Internal compiler error: java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.initializeTypeVariable(BinaryTypeBinding.java:944)

I think this was the same bug I reported some time ago, and I am pretty sure that the cause is the Scala 2.8.1 compiler generated buggy bytecodes, for some extended definition of "buggy", which then causes Eclipse (not Scala-IDE) to choke in some way or another.

See also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=332423 (graceless reporting, but not the bug itself)

See also: https://codereview.scala-lang.org/fisheye/cru/SCL-478 (why a red flag was not raised here, I do not know)

This also affects "Akka", whatever that is.

I pestered one of the guys on the code review list, he implied that the bug had a fix and he had applied it, but so far, I don't see it. I didn't go through normal channels, he seemed a bit miffed, I don't care, this is a bad bug and it needs to be reported (recall that Knuth gave people rewards....)

This is a somewhat higher priority for me, because at the moment my workaround of using 2.8.0 is thwarted by deadlock (same one previously reported, I checked the stack traces) except that this time, deleting cached files and metadata seems not to clear it.

The combination of these two bugs makes it impossible for me to use Scala-IDE on our project -- it either deadlocks or crashes, 100% of the time, before I do anything at all. A fix to either (or a pointer to an already implemented fix) would be lovely.

yours,

David Chase

David Bernard

unread,
Jan 26, 2011, 2:44:02 PM1/26/11
to scala-i...@googlegroups.com
Hi David,

If you want the latest code try update-site
  http://download.scala-ide.org/nightly-update-wip-exp-backport-2.8.1.final

About your bugs, I need to retry/investigate but some change have been done about this exception (IIRC)

/davidB

David Chase

unread,
Jan 26, 2011, 3:21:08 PM1/26/11
to scala-i...@googlegroups.com
Is that for Helios (3.6) or Galileo (3.5)?

David Chase

unread,
Jan 26, 2011, 3:56:11 PM1/26/11
to scala-i...@googlegroups.com
It installed under 3.5.2, I cleaned the test project, the class cast exception remained.

I will experimentally point it at my deadlock-inducing project, and see if it perturbs it enough to let the 2.8.0 scala-ide run normally.

Oh, that is disgusting. It worked (that is, using the exception-throwing Eclipse, I was able to "fix" whatever state was causing the "stable" Eclipse to deadlock).

David


On 2011-01-26, at 2:44 PM, David Bernard wrote:

David Bernard

unread,
Jan 26, 2011, 4:35:07 PM1/26/11
to scala-i...@googlegroups.com
On Wed, Jan 26, 2011 at 21:21, David Chase <dr2c...@gmail.com> wrote:
Is that for Helios (3.6) or Galileo (3.5)?

both

David Bernard

unread,
Jan 26, 2011, 4:39:25 PM1/26/11
to scala-i...@googlegroups.com
On Wed, Jan 26, 2011 at 21:56, David Chase <dr2c...@gmail.com> wrote:
It installed under 3.5.2, I cleaned the test project, the class cast exception remained.


Can you share the test project ?
 
I will experimentally point it at my deadlock-inducing project, and see if it perturbs it enough to let the 2.8.0 scala-ide run normally.

Oh, that is disgusting.  It worked (that is, using the exception-throwing Eclipse, I was able to "fix" whatever state was causing the "stable" Eclipse to deadlock).

Sorry, I'm not native or fluent english reader and I don't understand your last sentence.
Can you explain, rephrase ?

/davidB 

David Chase

unread,
Jan 26, 2011, 4:55:38 PM1/26/11
to scala-i...@googlegroups.com
On 2011-01-26, at 4:39 PM, David Bernard wrote:

> On Wed, Jan 26, 2011 at 21:56, David Chase <dr2c...@gmail.com> wrote:
> It installed under 3.5.2, I cleaned the test project, the class cast exception remained.
>
> Can you share the test project ?

The project (S1) is minimal -- I got it from some other report of this problem:
It contains this file, Test.java, in package "simple":

package simple;
import scala.collection.immutable.Nil;
public class Test {
public static void main(String[] args) {
scala.collection.immutable.List<Integer> myList = new Nil();
}
}

And after I clean it, to be sure I am getting a new build, it reports:

Errors occurred during the build.
Errors running builder 'Scala Builder' on project 'S1'.


org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

with the same stack trace.

>> I will experimentally point it at my deadlock-inducing project, and see if it perturbs it enough to let the 2.8.0 scala-ide run normally.
>>
>> Oh, that is disgusting. It worked (that is, using the exception-throwing Eclipse, I was able to "fix" whatever state was causing the "stable" Eclipse to deadlock).


> Sorry, I'm not native or fluent english reader and I don't understand your last sentence.
> Can you explain, rephrase ?

I had a persistent Eclipse+ScalaIDE deadlock, apparently triggered by something in the project's state, and I was unable to get around the deadlock using tricks that had worked in the past. (And I verified the deadlock with jconsole, and it is the same one.)

Experimentally, I tried pointing Galileo+2.8.1 at the deadlock-triggering workspace, guessing that it might not deadlock, and might "improve" the state of the project, so that I could then start with Helios+2.8.0. And it worked. Not science, not elegant, like hitting electronics to make them work. A tremendous hack. Hence, "disgusting".

However, it worked, so I am going to remember that particular trick.

David

Reply all
Reply to author
Forward
0 new messages