Skip to content

Commit da81eeb

Browse files
committed
Support native methods when resolving dynamic calls
ref: #22 author: @matthieu-vergne
1 parent 1bb5cb9 commit da81eeb

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/main/java/gr/gousiosg/javacg/stat/DynamicCallManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class DynamicCallManager {
7070
* @see #linkCalls(Method)
7171
*/
7272
public void retrieveCalls(Method method, JavaClass jc) {
73-
if (method.isAbstract()) {
73+
if (method.isAbstract() || method.isNative()) {
7474
// No code to consider
7575
return;
7676
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#Author: matthieu.vergne@gmail.com
2+
Feature: Native
3+
I want to identify all native methods within the analyzed code.
4+
5+
Scenario: Retrieve native method call
6+
Given I have the class "NativeTest" with code:
7+
"""
8+
public class NativeTest {
9+
public void methodA() {
10+
methodB();
11+
}
12+
13+
public native void methodB();
14+
}
15+
"""
16+
When I run the analyze
17+
Then the result should contain:
18+
"""
19+
M:NativeTest:methodA() (M)NativeTest:methodB()
20+
"""

0 commit comments

Comments
 (0)