Call SpdxModelFactory::init when constructing LicenseCreatorAgent#287
Call SpdxModelFactory::init when constructing LicenseCreatorAgent#287goneall merged 2 commits intospdx:masterfrom
SpdxModelFactory::init when constructing LicenseCreatorAgent#287Conversation
|
It appears that the creation of a I think that this is the only place in the code where this occurs since the other classes which call |
I'm not sure if this path will always be taken - it's possible to create an SPDX model without a reference to a license or listed license I haven't been able to come up with a single entrypoint to hook the init to. |
|
It could still be possible to have it here as a guard to initialize it if it hasn't been initialized already and keep best practices to call it manually. At least for the library code itself, it has to be initialized here or it throws an exception. To put it another way, it has to be initialized by the time we get here, so why not call it rather than fail? As long as it's not being called too early, it seems harmless to me. At least in my usage, it removes the need to call it manually, but as you said, depending upon the use case, the caller may need to do it. |
@dwalluck - I agree with your logic. We should add a comment to this effect in the code - I'll make a proposal in a review comment. |
goneall
left a comment
There was a problem hiding this comment.
Proposed comment clarification
Signed-off-by: Gary O'Neall <[email protected]>
|
I added some documentation in #286 I'll go ahead and merge this PR. |
Is something like this possible? It could remove the need to manually call
SpdxModelFactory::init.