Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

javassist.NotFoundException: java.lang.invoke.BoundMethodHandle when attempting to debug an analysis #1

Open
aianta opened this issue Nov 29, 2021 · 0 comments

Comments

@aianta
Copy link

aianta commented Nov 29, 2021

I get the following stack trace when trying to debug an analysis with visuflow. Running outside the debugger yields no such error.


javassist.NotFoundException: java.lang.invoke.BoundMethodHandle$Species_LL
	at javassist.ClassPool.get(ClassPool.java:452)
	at de.unipaderborn.visuflow.agent.SootFlowAnalysisTransformer.transform(SootFlowAnalysisTransformer.java:33)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
	at sun.misc.Unsafe.defineClass(Native Method)
	at java.lang.invoke.BoundMethodHandle$Factory.generateConcreteBMHClass(BoundMethodHandle.java:707)
	at java.lang.invoke.BoundMethodHandle$Factory$1.apply(BoundMethodHandle.java:492)
	at java.lang.invoke.BoundMethodHandle$Factory$1.apply(BoundMethodHandle.java:489)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at java.lang.invoke.BoundMethodHandle$Factory.getConcreteBMHClass(BoundMethodHandle.java:488)
	at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:386)
	at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:383)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1688)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.get(BoundMethodHandle.java:383)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:378)
	at java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:396)
	at java.lang.invoke.LambdaFormEditor.bindArgumentForm(LambdaFormEditor.java:459)
	at java.lang.invoke.LambdaFormEditor.bindArgumentL(LambdaFormEditor.java:403)
	at java.lang.invoke.BoundMethodHandle.bindArgumentL(BoundMethodHandle.java:99)
	at java.lang.invoke.MethodHandle.bindArgumentL(MethodHandle.java:1317)
	at java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1277)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvertByEditor(MethodHandleImpl.java:221)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:194)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:380)
	at java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:776)
	at java.lang.invoke.MethodHandle.asType(MethodHandle.java:761)
	at java.lang.invoke.Invokers.checkGenericType(Invokers.java:321)
	at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
	at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
	at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
	at soot.Scene.getOrAddRefType(Scene.java:2139)
	at soot.RefType.v(RefType.java:86)
	at soot.SootClass.initializeRefType(SootClass.java:126)
	at soot.SootClass.<init>(SootClass.java:107)
	at soot.SootClass.<init>(SootClass.java:136)
	at soot.SootResolver.makeClassRef(SootResolver.java:124)
	at soot.SootResolver.resolveClass(SootResolver.java:139)
	at soot.Scene.loadClass(Scene.java:1069)
	at soot.Scene.loadClassAndSupport(Scene.java:1054)
	at Analysis.runAnalysis(Analysis.java:37)
	at Analysis.main(Analysis.java:54)
javassist.NotFoundException: java.lang.invoke.BoundMethodHandle$Species_L3
	at javassist.ClassPool.get(ClassPool.java:452)
	at de.unipaderborn.visuflow.agent.SootFlowAnalysisTransformer.transform(SootFlowAnalysisTransformer.java:33)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
	at sun.misc.Unsafe.defineClass(Native Method)
	at java.lang.invoke.BoundMethodHandle$Factory.generateConcreteBMHClass(BoundMethodHandle.java:707)
	at java.lang.invoke.BoundMethodHandle$Factory$1.apply(BoundMethodHandle.java:492)
	at java.lang.invoke.BoundMethodHandle$Factory$1.apply(BoundMethodHandle.java:489)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at java.lang.invoke.BoundMethodHandle$Factory.getConcreteBMHClass(BoundMethodHandle.java:488)
	at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:386)
	at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:383)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.get(BoundMethodHandle.java:383)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:378)
	at java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:396)
	at java.lang.invoke.LambdaFormEditor.makeArgumentCombinationForm(LambdaFormEditor.java:664)
	at java.lang.invoke.LambdaFormEditor.filterArgumentForm(LambdaFormEditor.java:645)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvertByEditor(MethodHandleImpl.java:230)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:194)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:380)
	at java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:776)
	at java.lang.invoke.MethodHandle.asType(MethodHandle.java:761)
	at java.lang.invoke.Invokers.checkGenericType(Invokers.java:321)
	at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
	at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
	at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
	at soot.Scene.getOrAddRefType(Scene.java:2139)
	at soot.RefType.v(RefType.java:86)
	at soot.SootClass.initializeRefType(SootClass.java:126)
	at soot.SootClass.<init>(SootClass.java:107)
	at soot.SootClass.<init>(SootClass.java:136)
	at soot.SootResolver.makeClassRef(SootResolver.java:124)
	at soot.SootResolver.resolveClass(SootResolver.java:139)
	at soot.Scene.loadClass(Scene.java:1069)
	at soot.Scene.loadClassAndSupport(Scene.java:1054)
	at Analysis.runAnalysis(Analysis.java:37)
	at Analysis.main(Analysis.java:54)
javassist.NotFoundException: java.lang.invoke.BoundMethodHandle$Species_L4
	at javassist.ClassPool.get(ClassPool.java:452)
	at de.unipaderborn.visuflow.agent.SootFlowAnalysisTransformer.transform(SootFlowAnalysisTransformer.java:33)
	at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
	at sun.misc.Unsafe.defineClass(Native Method)
	at java.lang.invoke.BoundMethodHandle$Factory.generateConcreteBMHClass(BoundMethodHandle.java:707)
	at java.lang.invoke.BoundMethodHandle$Factory$1.apply(BoundMethodHandle.java:492)
	at java.lang.invoke.BoundMethodHandle$Factory$1.apply(BoundMethodHandle.java:489)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at java.lang.invoke.BoundMethodHandle$Factory.getConcreteBMHClass(BoundMethodHandle.java:488)
	at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:386)
	at java.lang.invoke.BoundMethodHandle$SpeciesData$1.apply(BoundMethodHandle.java:383)
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.get(BoundMethodHandle.java:383)
	at java.lang.invoke.BoundMethodHandle$SpeciesData.extendWith(BoundMethodHandle.java:378)
	at java.lang.invoke.LambdaFormEditor.newSpeciesData(LambdaFormEditor.java:396)
	at java.lang.invoke.LambdaFormEditor.makeArgumentCombinationForm(LambdaFormEditor.java:664)
	at java.lang.invoke.LambdaFormEditor.filterArgumentForm(LambdaFormEditor.java:645)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvertByEditor(MethodHandleImpl.java:230)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:194)
	at java.lang.invoke.MethodHandleImpl.makePairwiseConvert(MethodHandleImpl.java:380)
	at java.lang.invoke.MethodHandle.asTypeUncached(MethodHandle.java:776)
	at java.lang.invoke.MethodHandle.asType(MethodHandle.java:761)
	at java.lang.invoke.Invokers.checkGenericType(Invokers.java:321)
	at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
	at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
	at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
	at soot.Scene.getOrAddRefType(Scene.java:2139)
	at soot.RefType.v(RefType.java:86)
	at soot.SootClass.initializeRefType(SootClass.java:126)
	at soot.SootClass.<init>(SootClass.java:107)
	at soot.SootClass.<init>(SootClass.java:136)
	at soot.SootResolver.makeClassRef(SootResolver.java:124)
	at soot.SootResolver.resolveClass(SootResolver.java:139)
	at soot.Scene.loadClass(Scene.java:1069)
	at soot.Scene.loadClassAndSupport(Scene.java:1054)
	at Analysis.runAnalysis(Analysis.java:37)
	at Analysis.main(Analysis.java:54)

My Analysis code:

import java.io.File;
import java.util.Map;
import soot.Body;
import soot.BodyTransformer;
import soot.G;
import soot.Main;
import soot.PackManager;
import soot.Scene;
import soot.SootClass;
import soot.Transform;
import soot.options.Options;

public class Analysis {
//
	public static String sourceDirectory = "C:\\Users\\aiant\\visuflow-testing\\HelloWorld\\bin";
	//public static String sourceDirectory = System.getProperty("user.dir") + File.separator + "src";
	public static String clsName = "HelloWorld";
	

    public static void runAnalysis() {
        G.reset();
        Transform transform = new Transform("jtp.analysis", new BodyTransformer() {


            @Override
            protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
                IntraproceduralAnalysis ipa = new IntraproceduralAnalysis(b);
                ipa.doAnalysis();
            }

        }
        );
        PackManager.v().getPack("jtp").add(transform);
        Options.v().set_prepend_classpath(true);
        Options.v().set_allow_phantom_refs(true);
        Options.v().set_soot_classpath(sourceDirectory);
        SootClass sc = Scene.v().loadClassAndSupport(clsName);
        sc.setApplicationClass();
        Scene.v().loadNecessaryClasses();
        
        Main.main(new String[] {});
        
        
        SootClass mainClass = Scene.v().getSootClass(clsName);
        System.out.print(mainClass.getName());
        System.out.println("Done!");
        
        
    }

    public static void main(String[] args) {
        
    	System.out.println(sourceDirectory);
    	runAnalysis();
    }

}

Java version: 1.8.0_212
Eclipse: Version: Oxygen (4.7) Build id: I20170612-0950
Plugin was built from the latest version on github (commit: 9928f41cef090330a1dbe61a90362908448f50af) by right-clicking -> Export...-> Deployable Plugins & Fragments and then dropping the produced Jar file into the 'dropins' folder.
Soot version 4.2.1 with dependencies jar (as sourced from here: https://repo1.maven.org/maven2/org/soot-oss/soot/4.2.1/) is being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant