Problems: Extracting the complete Method Call Hierarchy of a complicated Java method. #13951
-
I'm attempting to prompt chatGPT to generate unit tests for a method within the apache/shardingsphere-elasticjob project. For this purpose, I need to
The body of my target method setUpJobConfiguration(String, JobConfiguration) is down below, where you can see it further calls
Two big problems I ran into that cause me only getting an incomplete call graph:
Example Interface method: Example overridden implementation on this interface method:
Below is the codeQL query I wrote to achieve my purpose. I'm currently stuck here and greatly appreciate guidance on these challenges and any enhancements that can be made to my query:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I tried running the query on The missing body of Looking at the documentation it looks like I think the following block is not doing what you need; it finds cases where a // Checks if 'caller' calls an interface method and 'callee' is a potential target of that call.
exists(Callable interfaceMethod, MethodAccess ma |
caller.polyCalls(interfaceMethod) and
ma.getMethod() = interfaceMethod and
ma.getAChildExpr*().(MethodAccess).getMethod() = callee
) |
Beta Was this translation helpful? Give feedback.
-
I think the problem is in the CodeQL database . Some source files are missing and methods resolve to class files instead. For example the definition of the
The same thing happens for the
I have no idea why the database is incomplete, but it explains why you aren't able to get the bodies of those methods. We'll need to investigate this further. |
Beta Was this translation helpful? Give feedback.
The cause of the incomplete database is that CodeQL did not support Lombok and skips any files that import lombok annotations. Support for Lombok is experimental and can be enabled by setting the environment variable
CODEQL_EXTRACTOR_JAVA_RUN_ANNOTATION_PROCESSORS
. You can create a complete database with the CodeQL CLI as follows: