Comments (4)
@nicoweidner Excellent catch - thanks for the review!
For most of the cases, the previous check for contains will return true even if it is a IndividualUriValue
. The extra check is primarily for external references (the enum implementations will likely be caught by the previous check).
I'm thinking we could fix this specific issue by changing the class check from:
if (!(comp instanceof SimpleUriValue)) {
to:
if (!(comp instanceof IndividualUriValue)) {
Looking further, some of the other implementations of IndividualUriValue
should also override equals and hashcode to use the URI value so that it will be equal to a SimpleUriValue
with the same URI.
Probably needs a bit more review and thought before committing the changes - let me know what you think.
As far as making the check symmetric - I agree this is a possible issue.
from spdx-java-library.
After thinking about this a bit more, I'm pretty convinced anything that implements IndividualUriValue
should override equals/hashcode to use the URI value for equality. The one exception is is the class implementing IndividualUriValue
inherits from ModelObject
which already overrides equals
using the ID for equality.
@nicoweidner I'll create a PR with the changes for this. If you have some time, feel free to tackle the symmetric issue.
from spdx-java-library.
@nicoweidner I created a PR to update equals for IndividualUriValue
s.
In thinking about this some more, SimpleUriValue
is typically only used when storing a property - when it is re-inflated back to a model object, it is typically cast to the appropriate type. So this it will not likely cause a problem in practice. That being said, it is a bug since the SimpleUriValue
may be used for other purposes and the semantics of IndividaulUriValue
should be equal if the URI's are equal.
I did go ahead and update the ModelObject
s that implement IndividualUriValue
to override equals.
The only implemenations of IndividualUriValue
I did not update was the enumerations. Since the equals
method in enums are final, I could not override the method.
Please check out the PR and let me know if my logic and updates make sense.
from spdx-java-library.
For most of the cases, the previous check for contains will return true even if it is a IndividualUriValue. The extra check is primarily for external references (the enum implementations will likely be caught by the previous check).
Ah, you are right that the previous check should catch various IndividualUriValue
implementations. I completely missed that when looking at the two lines about IndividualUriValue
in isolation 😅 . In the end, it boils down to how the equals
method works in each case. All enum implementations should be fine.
I will think about how the other cases behave. It probably makes more sense to comment directly on the PR since you already made changes there, so I will do that.
from spdx-java-library.
Related Issues (20)
- Update POM file to use release plugin HOT 1
- Enhancement: caching version of org.spdx.storage.listedlicense.SpdxListedLicenseWebStore and associated classes HOT 27
- tools-java should issue an error for absolute FileName HOT 5
- Need to update optional fields handling for cases with filesAnalyzed=true HOT 2
- Do we have a release schedule? HOT 4
- Performance enhancement: only download and parse license & exception JSON files once
- Exceptions aren't always passed on, making troubleshooting difficult
- Update CI to flag any new quality issues
- LicenseCompareHelper: EPL-2.0 license text published by Eclipse Foundation not recognised HOT 3
- LicenseCompareHelper: BSD-2-Clause license text not recognised HOT 2
- In need of a canonical way to add license texts for licenseRefs / Maybe bugged? HOT 4
- LicenseCompareHelper: GPL-2.0 license text not recognised HOT 2
- Question HOT 2
- Refactor nonOptionalTextToPatterns HOT 2
- Verify error when license exceptions are used in an expression in LicenseConcluded but not in LicenseInfoInFile HOT 2
- Official Apache-1.1 license text is not being matched correctly by LicenseCompareHelper.matchingStandardLicenseIdsWithinText() HOT 1
- Official GPL-1.0 license text is not being matched correctly by LicenseCompareHelper.isTextStandardLicense() HOT 1
- Potential enhancement: LicenseCompareHelper.isTextStandardLicense().getDifferenceMessage() should sort by line then column
- Official CC-BY-4.0 license text is not being matched correctly by LicenseCompareHelper.isTextStandardLicense() HOT 3
- Inconsistent behaviour between LicenseCompareHelper methods when called with official MIT license text HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spdx-java-library.