ultimate-pa / ultimate

The Ultimate program analysis framework.
https://ultimate-pa.org/
200 stars 41 forks source link

Add support for YAML-witnesses #643

Closed schuessf closed 1 year ago

schuessf commented 1 year ago

The main goal of this PR is to add support for the new YAML-witness format. This includes the following:

Additionally I made some other changes/refactorings:

There are still some limitations/open issues:

schuessf commented 1 year ago

You can check if eo-yaml provides support for annotations which we could use to annotate fields of a YAML witness element class to automatically build YAML serializers. This would reduce further maintenance if YAML generation must be extended for new/changed entry types. Is such a feature also available for parsing?

I am not fully aware how to do this. I however just found out that objects can be dumped to YAML at the very least: https://github.com/decorators-squad/eo-yaml/wiki/Java-Bean-To-YAML

How should platform-specific elements (e.g., file paths) encoded in a YAML witness files?

I guess platform-specific file paths are fine and I don't think anything else in the witnesses are platform-specific. Also it is more an info for the user, we don't use this for validation.

Should YAML multi-document witness files also supported?

Why should we generate multiple YAML files? We just want to have one witness and if (in the very future) multi-files projects are supported, the format already has the option to provide multiple source files.

schuessf commented 1 year ago

You can check if eo-yaml provides support for annotations which we could use to annotate fields of a YAML witness element class to automatically build YAML serializers. This would reduce further maintenance if YAML generation must be extended for new/changed entry types. Is such a feature also available for parsing?

I am not fully aware how to do this. I however just found out that objects can be dumped to YAML at the very least: https://github.com/decorators-squad/eo-yaml/wiki/Java-Bean-To-YAML

While this works, it is not quite suitable for us. It extracts all methods using reflections and adds them as keys to YAML, therefore we also have e.g. hashCode and toString keys. Therefore I decided to implement this on my own in 5eb799a. This extracts all getters using reflections and builds a map with them (slightly renamed) as keys.