DO NOT REPLY [Bug 24273] New: - ReferenceType.getFirstCommonSuperclass: Does not recognize UninitializedObjectType

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24273>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24273

ReferenceType.getFirstCommonSuperclass: Does not recognize UninitializedObjectType

           Summary: ReferenceType.getFirstCommonSuperclass: Does not
                    recognize UninitializedObjectType
           Product: BCEL
           Version: 5.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Here's a little gem that causes BCEL's verifier to crash:
(Compile the following with the bytecode assembler Jasmin)

.class public Test47
.super java/lang/Object

.method public foo(B)V
	.limit stack 10
	.limit locals 10
	
	iload_1
	ifne ELSE_0
		new java/io/BufferedInputStream
		goto ENDIF_0
	ELSE_0:
		new java/io/FilterInputStream
	ENDIF_0:
	pop
	
	return
.end method

The error generated is as follows:

Exception in thread "main" org.apache.bcel.verifier.exc.AssertionViolatedException: INTERNAL 
ERROR: Some RuntimeException occured while verify()ing class 'Test47', method 'public void 
foo(byte arg1)'. Original RuntimeException's stack trace:
---
java.lang.ClassCastException
        at 
org.apache.bcel.generic.ReferenceType.getFirstCommonSuperclass(ReferenceType.java:256)
        at org.apache.bcel.verifier.structurals.OperandStack.merge(OperandStack.java:254)
        at 
org.apache.bcel.verifier.structurals.ControlFlowGraph$InstructionContextImpl.mergeInFrames(Cont
rolFlowGraph.java:246)
        at 
org.apache.bcel.verifier.structurals.ControlFlowGraph$InstructionContextImpl.execute(ControlFlow
Graph.java:189)
        at org.apache.bcel.verifier.structurals.Pass3bVerifier.circulationPump(Pass3bVerifier.java:228)
        at org.apache.bcel.verifier.structurals.Pass3bVerifier.do_verify(Pass3bVerifier.java:342)
        at org.apache.bcel.verifier.PassVerifier.verify(PassVerifier.java:108)
        at org.apache.bcel.verifier.Verifier.doPass3b(Verifier.java:133)
        at ClassVerifier.verify(ClassVerifier.java:33)
        at ClassInfo.verify(ClassInfo.java:51)
        at Main.main(Main.java:7)
---

        at org.apache.bcel.verifier.structurals.Pass3bVerifier.do_verify(Pass3bVerifier.java:356)
        at org.apache.bcel.verifier.PassVerifier.verify(PassVerifier.java:108)
        at org.apache.bcel.verifier.Verifier.doPass3b(Verifier.java:133)
        at ClassVerifier.verify(ClassVerifier.java:33)
        at ClassInfo.verify(ClassInfo.java:51)
        at Main.main(Main.java:7)

It appears that ReferenceType.getFirstCommonSuperclass() is not designed to handle the 
org.apache.bcel.verifier.structurals.UninitializedObjectType ReferenceType that is used by BCEL's 
verifier.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.