MethodMatcher not finding methods from all Types


(Benjamin Kohler) #1

I am extending AbstractMethodDetection and in getMethodInvocationMatchers() I have:

return Arrays.asList(MethodMatcher.create()

I wrote this for testing purposes because it wasn’t finding my methods.

I have found that this line hits on something like java.lang.String calls to equals(Object), but not on for example, calls to equals(Object).

Any idea what is going on here?

(Michael Gumowski) #2


Are you providing the bytecode of the class to your test? If the bytecode of all your dependencies used in your test file is not provided, the semantic engine won’t be able to resolve the method. Consequently, the MethodMatcher won’t trigger.


(Benjamin Kohler) #3

I think I am providing the bytecode.
I am passing a List of jar Files to the verifier that are all located in the target/dependency directory.

I do get a warning when I run the unit test that some classes were not found during the analysis (even though containing jar files are in the target/dependency directory), however, Text is not one of the listed missing classes.

(Michael Gumowski) #4

Hello @bkohler13,

Sorry for the very late ping. Did you solve the issue with the MethodMatchers?
If it’s the case I would be curious to know how (if you remember).


(Benjamin Kohler) #5

Hey @Michael,

I did get this working. I don’t remember exactly where I was at with this when I asked the question, but it was definitely related to providing the bytecode of the libraries properly.

One I had everything passed to the maven-dependency-plugin properly using artifactItems in the pom, it all worked out.

Thanks for checking in!