Name: tb29552 Date: 06/17/97
The JDK 1.1.2 javac compiler hangs when compiling a particluarly
complicated piece of code which uses many inner/anonymous classes.
I have been able to isolate the problem to the following code
example (which is not a runnable program).
public class DSUser {
interface MessageHandler {
void handle(Object resource);
}
abstract class InvokeHandler implements MessageHandler {
abstract boolean checkMessage(Object resource);
public void handle(Object resource) {
checkMessage(resource);
}
}
private void invoke() {
class DSAMessageHandler extends InvokeHandler {
boolean checkMessage(Object resource) {
return false;
}
}
}
private void login() {
while(true) {
(new Thread(new Runnable() {
public void run() {
invoke();
}
})).start();
}
}
}
Here is the output from the compiler in verbose mode:
adams:~/java/javac-innerclass-bug>javac -verbose DSUser.java
[parsed DSUser.java in 548 ms]
[loaded /usr/dist/jdk1.1.2/bin/../lib/classes.zip(java/lang/Object.class) in 79 ms]
[checking class DSUser]
[checking class DSUser. 1$DSAMessageHandler]
[loaded /usr/dist/jdk1.1.2/bin/../lib/classes.zip(java/lang/Thread.class) in 61 ms]
[loaded /usr/dist/jdk1.1.2/bin/../lib/classes.zip(java/lang/Runnable.class) in 4 ms]
[checking class DSUser. 1]
[loaded /usr/dist/jdk1.1.2/bin/../lib/classes.zip(java/lang/String.class) in 69 ms]
This is the thread dump (which is different depending on when
I perform the dump):
Full thread dump:
"Finalizer thread" (TID:0xee598220, sys_thread_t:0xee2c1de0, state:R) prio=1
"Async Garbage Collector" (TID:0xee5981d8, sys_thread_t:0xee2f1de0, state:R) prio=1
"Idle thread" (TID:0xee598190, sys_thread_t:0xee3c1de0, state:R) prio=0
"Clock" (TID:0xee5980d0, sys_thread_t:0xee3f1de0, state:CW) prio=12
"main" (TID:0xee5980a8, sys_thread_t:0x40e30, state:R) prio=5 *current thread*
sun.tools.tree.Context.checkBackBranch(Context.java)
sun.tools.tree.WhileStatement.check(WhileStatement.java)
sun.tools.tree.Statement.checkBlockStatement(Statement.java)
sun.tools.tree.CompoundStatement.check(CompoundStatement.java)
sun.tools.tree.Statement.checkMethod(Statement.java)
sun.tools.javac.SourceField.check(SourceField.java)
sun.tools.javac.SourceClass.checkFields(SourceClass.java)
sun.tools.javac.SourceClass.checkInternal(SourceClass.java)
sun.tools.javac.SourceClass.check(SourceClass.java)
sun.tools.javac.Main.compile(Main.java)
sun.tools.javac.Main.main(Main.java)
Monitor Cache Dump:
sun.tools.javac.Main@EE59D3E0/EE753278: owner "main" (0x40e30, 1 entry)
Registered Monitor Dump:
Thread queue lock: <unowned>
Name and type hash table lock: <unowned>
String intern lock: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class loading lock: <unowned>
Java stack lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Has finalization queue lock: <unowned>
Finalize me queue lock: <unowned>
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
"Clock"
Sbrk lock: <unowned>
Monitor cache expansion lock: <unowned>
Monitor registry: owner "main" (0x40e30, 1 entry)
Thread Alarm Q:
company - Visigenic Software, Inc. , email - ###@###.###
======================================================================
- duplicates
-
JDK-4051281 Problem compiling when inner class references a private method
-
- Closed
-
- relates to
-
JDK-4059604 javac hangs
-
- Closed
-
-
JDK-4059545 javac hangs with inner class code
-
- Closed
-
-
JDK-4059619 Compiler hangs (no output) on given source code (anon. inner classes + serial?)
-
- Closed
-