java-systemd icon indicating copy to clipboard operation
java-systemd copied to clipboard

Problem using methods that returns tuples

Open larsdunemark opened this issue 3 years ago • 1 comments

In ManagerInterface there is some methods that returns a Tuples

Ex: EnableUnitFiles, ReenableUnitFiles, PresetUnitFiles etc.

This doesn't work in current version and throws an exception when trying to map the result back to List<UnitFileChange> There exists a similar function reenableUnitFiles that returns List<UnitFileInstallChange> but that also fails to run.

@DBusMemberName(value = "EnableUnitFiles")
List<UnitFileChange> enableUnitFiles(List<String> names, boolean runtime, boolean force);

The return signature for this functions is ba(sss) so it should probably be changed to something like:

PairTuplet<Boolean, List<UnitFileChange>> enableUnitFiles(List<String> names, boolean runtime, boolean force);

Where PairTuplet extends Tuplet. For some reason it seems only to work when using parameterized typed class otherwise it would probably only need to change to:

UnitFileInstallChange enableUnitFiles(List<String> names, boolean runtime, boolean force);

And that UnitFileInstallChange holds an List of UnitFileChanges instead of only one UnitFileChanges as it is today. But we didn't get that one to work.

larsdunemark avatar May 28 '21 12:05 larsdunemark

Thanks for the report. I do confirm the issue, after doing a quick test.

Unfortunately, I'm short on free time at the moment, thus fixing this can take a while...

thjomnx avatar Jun 08 '21 19:06 thjomnx