Upgrade to Pro — share decks privately, control downloads, hide ads and more …

APIDiff: Detecting API Breaking Changes (SANER ...

APIDiff: Detecting API Breaking Changes (SANER 2018, Tools Track)

Libraries are commonly used to increase productivity. As most software systems, they evolve over time and changes are required. However, this process may involve breaking compatibility with previous versions, leading clients to fail. In this context, it is important that libraries creators and clients frequently assess API stability in order to better support their maintenance practices. In this paper, we introduce APIDIFF, a tool to identify API breaking and non-breaking changes between two versions of a Java library. The tool detects changes on three API elements: types, methods, and fields. We also report usage scenarios of APIDIFF with four real-world Java libraries.

ASERG, DCC, UFMG

March 21, 2018
Tweet

More Decks by ASERG, DCC, UFMG

Other Decks in Research

Transcript

  1. APIDiff: Detecting API Breaking Changes Aline Brito, Laerte Xavier, Andre

    Hora, Marco Tulio Valente SANER 2018, Tool Track
  2. But, 28% out of 500K API changes break backward compatibility

    Historical and Impact Analysis of API Breaking Changes: A Large-Scale Study SANER, 2017 6
  3. 9 On the client side… Analyze the amount of breaking

    changes over time Select more stable libraries to depend on
  4. Breaking Changes (BC) Changes performed in API elements that may

    break client applications 13 We exclude changes performed on deprecated API elements
  5. 14 Element Breaking Changes (BC) Type REMOVE TYPE, LOST VISIBILITY,

    CHANGE IN SUPERTYPE, ADD FINAL MODIFIER, REMOVE STATIC MODIFIER, RENAME TYPE, MOVE TYPE Method REMOVE METHOD, LOST VISIBILITY, CHANGE IN RETURN TYPE, CHANGE IN PARAMETER LIST, CHANGE IN EXCEPTION LIST, ADD FINAL MODIFIER, REMOVE STATIC MODIFIER, MOVE METHOD, RENAME METHOD, PUSH DOWN METHOD, INLINE METHOD Field REMOVE FIELD, LOST VISIBILITY, CHANGE IN FIELD TYPE, CHANGE IN FIELD DEFAULT VALUE, ADD FINAL MODIFIER, MOVE FIELD, PUSH DOWN FIELD
  6. 20 Element Non-Breaking Changes (NBC) Type ADD TYPE, GAIN VISIBILITY,

    REMOVE FINAL MODIFIER, ADD STATIC MODIFIER, ADD SUPERTYPE, EXTRACT SUPERTYPE, DEPRECATED TYPE Method ADD METHOD, PULL UP METHOD, GAIN VISIBILITY, REMOVE FINAL MODIFIER, ADD STATIC MODIFIER, DEPRECATED METHOD, EXTRACT METHOD Field ADD FIELD, PULL UP FIELD, GAIN VISIBILITY, REMOVE FINAL MODIFIER, DEPRECATED FIELD
  7. 24 An image loading and caching library 20K stars A

    framework to implement unit tests 6K stars
  8. 26 Detecting Changes in Version Histories Useful to analyze several

    commits at once Useful to assess libraries stability
  9. Detecting Changes in Version Histories 27 APIDiff diff = new

    APIDiff( “bumptech/glide”, “https://github.com/bumptech/glide.git”); Result result = diff.detectChangeAllHistory(“master”, Classifier.API);
  10. Detecting Changes in Version Histories 28 APIDiff diff = new

    APIDiff( “bumptech/glide”, “https://github.com/bumptech/glide.git”); Result result = diff.detectChangeAllHistory(“master”, Classifier.API);
  11. 30 Fetching New Commits Useful to monitor changes in a

    repository Contributors are notified shortly after BCs are introduced
  12. Fetching New Commits 31 APIDiff diff = new APIDiff( “bumptech/glide”,

    “https://github.com/bumptech/glide.git”); Result result = diff.fetchAndDetectChange(Classifier.API);
  13. Fetching New Commits 32 APIDiff diff = new APIDiff( “bumptech/glide”,

    “https://github.com/bumptech/glide.git”); Result result = diff.fetchAndDetectChange(Classifier.API);
  14. 34 Detecting Changes in Specific Commits Useful to analyze pull

    requests Useful to detect accidental BCs
  15. Detecting Changes in Specific Commits 35 APIDiff diff = new

    APIDiff( “mockito/mockito”, “https://github.com/mockito/mockito.git”); Result result = diff.detectChangeAtCommit( "4ad5fdc14ca4b979155d10dcea0182c82380aefa", Classifier.API);
  16. Detecting Changes in Specific Commits 36 APIDiff diff = new

    APIDiff( “mockito/mockito”, “https://github.com/mockito/mockito.git”); Result result = diff.detectChangeAtCommit( "4ad5fdc14ca4b979155d10dcea0182c82380aefa", Classifier.API);
  17. Detecting Changes in Specific Commits 37 APIDiff diff = new

    APIDiff( “mockito/mockito”, “https://github.com/mockito/mockito.git”); Result result = diff.detectChangeAtCommit( "4ad5fdc14ca4b979155d10dcea0182c82380aefa", Classifier.API); Category: Add Method Description: Method answersWithDelay(long, Answer<T >) added in class org.mockito.AdditionalAnswers
  18. Result Type 38 - category : String - description :

    String - path : String - element : String - javadoc : Boolean - deprecated : Boolean - breakingChange : Boolean - revCommit: RevCommit Change
  19. 40 Filtering Packages It is also possible to filter in/out

    packages Useful to detect changes in internal implementations
  20. 43

  21. 45 Refactoring Module detects refactoring actions (reused from RefDiff) RefDiff:

    Detecting Refactorings in Version Histories Danilo Silva, Marco Tulio Valente - MSR, 2017
  22. Future Work 48 • Evaluate the precision of APIDiff •

    Support to other programming languages • Feature to analyze changes at release level