[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Soot looking for array classfiles



Jon Nall wrote:
> >I've run across this exception using Soot:
> >
> >    Exception in thread "main" java.lang.RuntimeException: 
> >    Aborting: can't find classfile[Ljava.rmi.server.Operation;
> >	at soot.Scene.getSootClass(Scene.java:300)
> >	at soot.coffi.CFG.generateJimple(CFG.java:4434)
> >	at soot.coffi.CFG.jimplify(CFG.java:1463)
> >	at soot.coffi.CFG.jimplify(CFG.java:1126)
> >	at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:98)
> >	at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:79)
> >	at soot.SootMethod.retrieveActiveBody(SootMethod.java:274)
> >
> >The class that is being analysed was generated by jikes 1.18.
> >I don't see this with jikes 1.15 generated class files.
> >
> >My guess is the following CONSTANT_Methodref entry in the constant pool
> >of the class file:
> >
> > [21]	class "[Ljava/rmi/server/Operation;"
> >	method "clone"
> >	descriptor "()Ljava/lang/Object;"
> >
> >Jikes has put in a reference to an Object method as an array class
> >method instead of an Object method.
> >
> >Would this cause such behavior in Soot? Is there an easy fix??
> 
> i am having a similar problem with code compiled by the eclipse JDT compiler and an int[]:
> 
> Exception in thread "main" java.lang.RuntimeException:
> Aborting: can't find classfile[I
>         at soot.Scene.getSootClass(Scene.java:300)
>         at soot.coffi.CFG.generateJimple(CFG.java:4434)
>         at soot.coffi.CFG.jimplify(CFG.java:1463)
>         at soot.coffi.CFG.jimplify(CFG.java:1126)
>         at soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:98)
>         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:79)
>         at soot.SootMethod.retrieveActiveBody(SootMethod.java:274)
> 
> could someone shed some light as to what's going on here? is anyone looking at this?

This is fixed in CVS, or with the patch below.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


diff -urN src.orig/soot/coffi/CFG.java src/soot/coffi/CFG.java
--- src.orig/soot/coffi/CFG.java	Mon Sep 29 11:05:59 2003
+++ src/soot/coffi/CFG.java	Fri Apr 16 14:24:52 2004
@@ -4431,6 +4431,9 @@
             String methodDescriptor = ((CONSTANT_Utf8_info) (constant_pool[i.descriptor_index])).
                 convert();
 
+	    if (className.charAt(0) == '[')
+	    	className = "java.lang.Object";
+
             SootClass bclass = cm.getSootClass(className);
 
             Local[] parameters;
@@ -4659,6 +4662,9 @@
                 String methodName = ((CONSTANT_Utf8_info) (constant_pool[i.name_index])).convert();
                 String methodDescriptor = ((CONSTANT_Utf8_info) (constant_pool[i.descriptor_index])).
                     convert();
+
+		if (className.charAt(0) == '[')
+		    className = "java.lang.Object";
 
                 SootClass bclass = cm.getSootClass(className);