spdx / Spdx-Java-Library

Java library which implements the Java object model for SPDX and provides useful helper functions
Apache License 2.0
37 stars 36 forks source link

A canonical way to create ExtractedLicenseInfo (Helper method and documentation, Issue #215) #216

Closed jkrae-metaeffekt closed 11 months ago

jkrae-metaeffekt commented 1 year ago

Adds a helper class in ModelObject for correct creation of ExtractedLicenseInfo objects. This should resolve #215.

I also added documentation and comments regarding correct use of such objects. These may need correction:

It appeared to me that instances ExtractedLicenseInfo and an SpdxDocument become inherently linked after construction and are only assumed to produce correct behaviour when used together. I tried to document this, since it's a detail critical to data integrity but remains intransparent to me due to the complex workings of *ModelStore.: https://github.com/jkrae-metaeffekt/Spdx-Java-Library/blob/fbfd9acdc9aa81a2f17c7e5dff101c1fec495412/src/main/java/org/spdx/library/model/ModelObject.java#L1420C2-L1422 .

Please correct me on this. In case of correction, the other added javadocs may need adjustment, too.

edit: formatting fix

jkrae-metaeffekt commented 1 year ago

Timeline? Huh. "ASAP" is just about the most useless comment to that question, i guess.

I'm now using the correct constructor as a workaround for now (see #216). So my code works now. It would undoubtedly be nice to have in the next release, though.