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

Re: Phantom classes and analysis



In your stack trace, you have ClassHierarchy.java:84 at one point. In
the version of the code that I have, the stuff around line 84 looks like
this:

83:    if (!soot.Main.isJ2ME()) {
84:      CLONEABLE = typeNode(RefType.v("java.lang.Cloneable"));
85:      SERIALIZABLE = typeNode(RefType.v("java.io.Serializable"));
86:    } else {
87:      CLONEABLE = null;
88:      SERIALIZABLE = null;
89:    }

If soot.Main.isJ2ME is false, then line 84 shouldn't even execute. Can
you have a closer look at what is going on at this program point?

Ondrej

On Wed, Jan 22, 2003 at 04:17:48PM -0000, Eric Bodden wrote:
> > Things don't really work right if Cloneable isn't found; I'm 
> > sure that one of your classes implements Cloneable.  If we don't have
> a 
> > SootClass for java.lang.Cloneable, type inference usually won't work.
> We 
> > don't like not having type inference, so we don't allow phantom refs
> to be 
> > arbitrarily created.
> 
> But when all I want just is getting some line numbers I think resolving
> down through the whole JRE is really a little bit overkill! Of course
> some classes are implementing Clonable. But I think for providing a
> static analysis just on the source files I provide, it must be possible
> somehow, to prevent soot from tying to resolve these (not loaded)
> classes and maybe instead create empty phantom classes or am I wrong?
> 
> > If you do what Feng said and hardcode allowPhantomRefs to 
> > true, then your classes should jimplify, but you won't get great
> things out of it.
> I already had that set. That did not change anything at all. I always
> get...
> 
> Exception in thread "main" java.lang.RuntimeException:
> Aborting: can't find classfilejava.lang.Cloneable
>         at soot.Scene.getSootClass(Scene.java:386)
>         at soot.RefType.getSootClass(RefType.java:95)
>         at soot.jimple.toolkits.typing.TypeNode.<init>(TypeNode.java:85)
>         at
> soot.jimple.toolkits.typing.ClassHierarchy$ConstructorChooser.caseRefTyp
> e(ClassHierarchy.java:240)
>         at soot.RefType.apply(RefType.java:136)
>         at
> soot.jimple.toolkits.typing.ClassHierarchy$ConstructorChooser.typeNode(C
> lassHierarchy.java:233)
>         at
> soot.jimple.toolkits.typing.ClassHierarchy.typeNode(ClassHierarchy.java:
> 129)
>         at
> soot.jimple.toolkits.typing.ClassHierarchy.<init>(ClassHierarchy.java:84
> )
>         at
> soot.jimple.toolkits.typing.ClassHierarchy.classHierarchy(ClassHierarchy
> .java:107)
>         at
> soot.jimple.toolkits.typing.TypeResolver.<init>(TypeResolver.java:157)
>         at
> soot.jimple.toolkits.typing.TypeResolver.resolve(TypeResolver.java:180)
>         at
> soot.jimple.toolkits.typing.TypeAssigner.internalTransform(TypeAssigner.
> java:59)
>         at soot.BodyTransformer.transform(BodyTransformer.java:58)
>         at soot.BodyTransformer.transform(BodyTransformer.java:80)
>         at soot.jimple.JimpleBody.applyPhaseOptions(JimpleBody.java:118)
>         at
> soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:108)
>         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:89)
>         at soot.SootMethod.retrieveActiveBody(SootMethod.java:305)
>         at analysis.ToolKit.extractLineNumber(ToolKit.java:106)
>         at
> analysis.ClassTreeSupplier.setData(ClassTreeSupplier.java:103)
>         at
> gui.main.MainForm.classComboBoxActionPerformed(MainForm.java:384)
>         at gui.main.MainForm.access$200(MainForm.java:49)
>         at gui.main.MainForm$3.actionPerformed(MainForm.java:144)
>         at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1196)
>         at javax.swing.JComboBox.contentsChanged(JComboBox.java:1267)
>         at
> javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java
> :100)
>         at
> javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.ja
> va:88)
>         at
> javax.swing.DefaultComboBoxModel.addElement(DefaultComboBoxModel.java:12
> 6)
>         at javax.swing.JComboBox.addItem(JComboBox.java:690)
>         at gui.main.MainForm.setClassComboBoxItems(MainForm.java:532)
>         at
> gui.main.MainForm.packageComboBoxActionPerformed(MainForm.java:394)
>         at gui.main.MainForm.access$100(MainForm.java:49)
>         at gui.main.MainForm$2.actionPerformed(MainForm.java:136)
>         at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1196)
>         at javax.swing.JComboBox.contentsChanged(JComboBox.java:1267)
>         at
> javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java
> :100)
>         at
> javax.swing.DefaultComboBoxModel.setSelectedItem(DefaultComboBoxModel.ja
> va:88)
>         at
> javax.swing.DefaultComboBoxModel.addElement(DefaultComboBoxModel.java:12
> 6)
>         at javax.swing.JComboBox.addItem(JComboBox.java:690)
>         at gui.main.MainForm.setPackageComboBoxItems(MainForm.java:524)
>         at gui.main.MainForm.updateComboBoxes(MainForm.java:508)
>         at jpt.main(jpt.java:25)
> 
> So do you know what I could change to make Soot behave in the way I
> want?
> 
> Cheers,
> Eric
>