0

My Constraints are, I got a api.jar from client which I can not edit. The java code pasted below is from the test class which I wrote to test the api.jar.

Consumer<DemoAdapter> callbackLogin = demoAdapter -> { 
if (webBrowser != null) { 
webBrowser.stop(); 
} 
}; 
Consumer<DemoAdapter> callbackLogout = demoAdapter -> { 
if (webBrowser != null) { 
webBrowser.stop(); 
} 
}; 

// Create 
AdapterConfig config = Builder.buildConfig(); 

//Constructor which I need to call from C++;Issue is with above to consumer. 
keycloakAdapterApplication = new KeycloakAdapterApplication(callbackLogin,callbackLogout, config);

Now same jar(api.jar) I want to use from C++.So I am supposed to write the test class in C++ using JNI.

I wrote the test class for all the methods which doesn't involve Consumer & BiConsumer of java in their call.

The parameters mentioned above (callbackLogin,callbackLogout) receives callbacks in test class.

Please help me on how to create these two parameters at C++ side?

kunal
  • 187
  • 1
  • 2
  • 12
  • I even tried creating Manual lambdas(using JNI) as mentioned on below link https://stackoverflow.com/questions/23595136/get-a-list-of-classes-lambdas/23606688#23606688 – kunal Dec 08 '17 at 05:17
  • I used below approach to create manual lambda but I am getting NullpointerException on CallStaticObjectMethod(methodHandlesClassId , lookupMethodId); – kunal Dec 08 '17 at 06:04

0 Answers0