Libelektra: bindings java: HelloElektra.java errors

Created on 26 Mar 2019  ·  3Comments  ·  Source: ElektraInitiative/libelektra

The problem is related to the guide: https://www.libelektra.org/bindings/jna

Firstly, I cloned the Elektra source code from git and has compiled it, so I've got my build folder. Secondly, I followed a guide under https://www.libelektra.org/bindings/jna just to test the binding.

As a result, IntellijIDEA has thrown me a few errors. The error appears on the lines 8, 12 and 38.

final Key key = Key.create("user/hello_world", Key.KEY_VALUE, "Hello World", Key.KEY_END);

final KeySet ks = KeySet.create(10, Key.create("user/hello_world2", Key.KEY_VALUE, "Hello World2", Key.KEY_END), key, KeySet.KS_END);

final Key b = Key.create("user/boolean", Key.KEY_VALUE, "true", Key.KEY_END);

The IntellijIDEA reported me, that it cannot resolve the method _create_ on each of the lines, that I specified.

I spent some time to understand if I have done something wrong while following the guide. Eventually I looked into the class implementation and saw, that the arguments of those lines don't match any _create_ method. After some little workaround, I have managed to fix the problem, so I believe, that the parameters, which are sent in the HelloElektra.java must be changed.

Please correct me, if I am wrong. Also could this issue be considered as a home work? If yes, please assign me to it, so I can add it to my list of issues.

bug

All 3 comments

Thank you for this issue!

I spent some time to understand if I have done something wrong while following the guide.

You should not assume that you did something wrong. Maybe the guide simply does not cover your installation/Java setup/... Or maybe there is even something wrong in the guide or the code (In this case it seems like the problem is in the code, see below).

I have managed to fix the problem, so I believe, that the parameters, which are sent in the HelloElektra.java must be changed.

Yes. The create method was improved in 9643232a64a9bbca782587840385fbb40c7e5346 (to make them more safe). But it seems like the "HelloElektra.java" was not updated. Please do that in a PR. A longer HelloElektra.java with more comments is highly appreciated.

Seems to be fixed now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sanssecours picture sanssecours  ·  3Comments

mpranj picture mpranj  ·  3Comments

markus2330 picture markus2330  ·  3Comments

sanssecours picture sanssecours  ·  4Comments

e1528532 picture e1528532  ·  4Comments