Skip to content

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Feb 11, 2020

Previously it could lead to "contract violations", for example consider this:

A = Library{ Name:"A", Types: ["Sensors"] }
B = Library{ Name:"B", Types: null }
C = Library{ Name:"C", Types: ["Arduino"] }

it results in:

A<B (because B has Types==null and compareName("A","B")<0)
B<C (because B has Types==null and compareName("B","C")<0)
C<A (becuase C has Types=="Arduino" and the comparator returns -1 directly)

This commit fix this behavior.

Fix #9738

Previously it could lead to contract violations for example consider
this:

A = Library{ Name:"A", Types: ["Sensors"] }
B = Library{ Name:"B", Types: null        }
C = Library{ Name:"C", Types: ["Arduino"] }

it results in:

A<B (because B has Types==null and compare("A","B")<0)
B<C (because B has Types==null and compare("B","C")<0)
C<A (becuase C has Types=="Arduino" and the comparator returns -1)

This commit fix this behavior
@cmaglie cmaglie added Type: Bug Component: Board/Lib Manager Boards Manager or Library Manager labels Feb 11, 2020
@cmaglie cmaglie added this to the Release 1.8.12 milestone Feb 11, 2020
@cmaglie cmaglie self-assigned this Feb 11, 2020
@cmaglie cmaglie merged commit 8793a6d into arduino:master Feb 12, 2020
@cmaglie cmaglie deleted the fix-libs-comparator-logic branch February 12, 2020 08:54
@cmaglie cmaglie mentioned this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Board/Lib Manager Boards Manager or Library Manager Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arduino 1.8.11 Library Manager: Comparison method violates its original contract.
2 participants