Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SwingUtilities.invokeLater(new Runnable(){....

5 views
Skip to first unread message

Mary Waller

unread,
Dec 7, 2000, 9:59:35 AM12/7/00
to
Hi all,
I'm having problems compiling when I attempt to make a timer-event into
a separate thread. If I add the following to a method in my main class:

SwingUtilities.invokeLater(new Runnable(){
public void run(){
// original code here
}
}
);

I get the following output:
An exception has occurred in the compiler (1.3.0_01). Please file a bug
at the Java Developer Connection
(http://java.sun.com/cgi-bin/bugreport.cgi). Include your program and
the following diagnostic in your report. Thank you.
java.lang.InternalError: assertion failed
at com.sun.tools.javac.v8.util.Util.assert(Util.java:25)
at com.sun.tools.javac.v8.code.Code.resolve(Code.java:617)
at com.sun.tools.javac.v8.code.Code.resolvePending(Code.java:639)
at com.sun.tools.javac.v8.code.Code.emitop(Code.java:350)
at com.sun.tools.javac.v8.code.Code.emitop(Code.java:376)
at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java:482)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:452)
at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:441)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:375)
at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java:1366)
at com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java:302)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:407)
at com.sun.tools.javac.v8.Main.compile(Main.java:247)
at com.sun.tools.javac.Main.main(Main.java:16)
Process completed.

My question is, is this because I've implemented it wrong or is there a
problem with the compiler? I've tried JDK1.3 and 1.3.0_1 (Windows2000)
(yes I know there's a bug database, but searching it at the speed of our
network connection is v. painful!)

Mary

Chris Smith

unread,
Dec 7, 2000, 12:04:58 PM12/7/00
to
Mary,

Your second guess is correct. What you are seeing is an error message that
indicates a compiler bug. While I've never seen this in javac, it happens
all the time in other compilers, like Visual C++, and the solution is to try
playing around with the code until something fixes it. Maybe you can move
this to a different place in your method. Try declaring the new Runnable
and assigning it to a temporary Runnable reference, which you then pass into
the invokeLater method. For example,

Runnable tmprun = new Runnable() {
public void run()
{
/* code here */
}
});

SwingUtilities.invokeLater(tmprun);

As a last resort, download Jikes from IBM and compile with that. It's
another compiler, implemented from scratch without any javac code, so it's
highly unlikely to duplicate the bug.

Also, you may consider doing exactly as it says and filing a bug report in
JDC Bug Parade. This will get it fixed eventually, if probably not soon
enough for you.

Chris Smith

Chris Smith

unread,
Dec 8, 2000, 10:44:21 AM12/8/00
to
Mary Waller <mwa...@mpc-data.co.uk> wrote ...
> Thanks for the reply - unfortunately the temporary Runnable reference
> made no difference. I'm just glad it is the compiler and not some coding
> error on my part!

Mary,

What compiler version and platform are you using?

Chris Smith

Jason Trenouth

unread,
Dec 8, 2000, 9:27:13 AM12/8/00
to
On Fri, 08 Dec 2000 09:30:34 +0000, Mary Waller <mwa...@mpc-data.co.uk> wrote:

> Thanks for the reply - unfortunately the temporary Runnable reference
> made no difference. I'm just glad it is the compiler and not some coding
> error on my part!

That is not something you can necessarily deduce. It may be both. You may have
some buggy code that confuses the compiler and/or runtime. So instead of giving
you a nice error message about your code it gets an error of its own.

__Jason

Mary Waller

unread,
Dec 8, 2000, 11:59:56 AM12/8/00
to

Windows2000, same problem with JDK1.3 and JDK1.3.0_01.
It even happens if I try to use the following instead:
Thread t = new Thread() {
public void run() {
//code here
}
};
t.start();

Mary

0 new messages