Git Product home page Git Product logo

Comments (1)

jusescn avatar jusescn commented on July 17, 2024

I find a jar to fix . a goog jar to fix stream ;

com.sebastian-daschner
jaxrs-analyzer
0.9

core code to fix this bug;
https://1maven.com/classname/com.sebastian-daschner:jaxrs-analyzer:0.9/com.sebastian_daschner.jaxrs_analyzer.analysis.bytecode.collection/InvokeInstructionBuilder/cl

or simple use like this;
ByteCodeCollector collector = new ByteCodeCollector();
List list = collector.buildInstructions(member);
for (Instruction instruction : list) {
if (instruction instanceof InvokeInstruction) {
InvokeInstruction invokeInstruction = (InvokeInstruction) instruction;
MethodIdentifier methodIdentifier = invokeInstruction.getIdentifier();
System.out.println("methodIdentifier:" + methodIdentifier);
}
if (instruction instanceof InvokeDynamicInstruction) {
InvokeDynamicInstruction invokeDynamicInstruction = (InvokeDynamicInstruction) instruction;
MethodIdentifier methodIdentifier = invokeDynamicInstruction.getIdentifier();
System.out.println("methodIdentifier:" + methodIdentifier);
}
}

or if you like ,you can update MemberUsageScanner like this( I do not test them,copy from up.)
MethodInfo methodInfo = member.getMethodInfo();
CodeAttribute codeAttribute = methodInfo.getCodeAttribute();
ConstPool pool = methodInfo.getConstPool();
CodeIterator codeIterator = codeAttribute.iterator();
final int lambdaIndex = pool.getInvokeDynamicNameAndType(index);
final String lambdaSignature = pool.getUtf8Info(pool.getNameAndTypeDescriptor(lambdaIndex));
final String lambdaMethodName = pool.getUtf8Info(pool.getNameAndTypeName(lambdaIndex));
final SignatureAttribute.MethodSignature methodSignature = SignatureAttribute.toMethodSignature(lambdaSignature);
SignatureAttribute.Type lambdaReturnType = methodSignature.getReturnType();
SignatureAttribute.Type[] lambdaParameters = methodSignature.getParameterTypes();

                   final CtClass ctClass;
                   try {
                       ctClass = ClassPool.getDefault().get(pool.getClassName());
                   } catch (NotFoundException e) {
                       throw new IllegalStateException("Could not analyze bytecode");
                   }

                   final BootstrapMethodsAttribute bootstrapMethods = (BootstrapMethodsAttribute) ctClass.getClassFile().getAttribute("BOOTSTRAP_ATTRIBUTE_NAME");
                   final int bootstrapIndex = pool.getInvokeDynamicBootstrap(index);
                   final int actualMethodIndex = bootstrapMethods.getMethods()[bootstrapIndex].arguments[1];
                   final int actualMethodRefIndex = pool.getMethodHandleIndex(actualMethodIndex);
                   final boolean actualMethodStatic = pool.getMethodHandleKind(actualMethodIndex) == ConstPool.REF_invokeStatic;

from reflections.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.