public static XMethod createXMethod ( InvokeInstruction invokeInstruction , ConstantPoolGen cpg ) { String className = invokeInstruction . getClassName ( cpg ) ; String methodName = invokeInstruction . getName ( cpg ) ; String methodSig = invokeInstruction . getSignature ( cpg ) ; if ( invokeInstruction instanceof INVOKEDYNAMIC ) { // XXX the lambda representation makes no sense for XMethod // "classical" instruction attributes are filled with garbage, causing // the code later to produce crazy errors (looking for non existing types etc) // We should NOT be called here from our code, but 3rd party code still may // use this method. So *at least* provide a valid class name, which is // (don't ask me why) is encoded in the first argument type of the lambda // className = invokeInstruction.getArgumentTypes(cpg)[0].toString(); className = Values . DOTTED_JAVA_LANG_OBJECT ; } return createXMethod ( className , methodName , methodSig , invokeInstruction . getOpcode ( ) == Const . INVOKESTATIC ) ; }
Create an XMethod object from an InvokeInstruction .