SlideShare a Scribd company logo
DRONE: A Tool to Detect and Repair
Directive Defects in Java APIs
Documentation
Sebastiano
Panichella
Xin
Yan
Taolue
Chen
Harald
Gall
Yu
Zhou
Outline
2
DRONE
Context:
Proposed Solution based on:
Case Study:
APIs Usage in OSS

and Industrial Projects
- NLP Approaches;

- Static Analysis Techniques; 

- Logic reasoning;
Assessment of DRONE on 

Documentation and Code 

8 Java Libraries

Documentation Code
Open Source (OS)
and Industrial Projects
3
“Social networks like Facebook or Pinterest, or utilities like 
Google Maps or Dropbox are popular examples of APIs providers.”
Open Source (OS)
and Industrial Projects
4
“Social networks like Facebook or Pinterest, or utilities like 
Google Maps or Dropbox are popular examples of APIs providers.”
Open Source (OS)
and Industrial Projects
5“APIs are great time savers for Developers…”
6
Difficult
to Understand
describe
Information
Needed
						Ideally….		
	
“API documents represent one of the most
important references for developers…”
Source Code
APIs Documents
Application Programming
Interface (API) Documents
7
Software Changes over the Time
“…as consequence the original documentation tend to be
incomplete and inconsistent with the source code…”
Insufficient
Information
Source Code
Difficult
to Understand
APIs Documents
Inconsistent withComing	back		
to	the	reality...	
Inconsistent/
Incomplete
8
Source Code
APIs Documents
Inconsistent/
Incomplete
API Document Defect: Example 1
Class:
TextLayout.

Method:
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
API Document JDK-1.8
9
Source Code
APIs Documents
Inconsistent/
Incomplete
API Document Defect: Example 1
Class:
TextLayout.

Method:
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
API Document JDK-1.8
https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
10
Source Code
APIs Documents
Inconsistent/
Incomplete
API Document Defect: Example 1
API Document JDK-1.8
Class:
TextLayout.

Method:
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
11
Source Code
APIs Documents
Inconsistent/
Incomplete
API Document Defect: Example 1
API Document JDK-1.8
Class:
TextLayout.

Method:
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
12
Source Code
APIs Documents
Inconsistent/
Incomplete
API Document Defect: Example 1
API Document JDK-1.8
Class:
TextLayout.

Method:
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
————————————-—————————————-

————————————-—————————————-
https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
13
Source Code
APIs Documents
Inconsistent/
Incomplete
API Document Defect: Example 1
API Document JDK-1.8
Class:
TextLayout.

Method:
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
————————————-—————————————-

————————————-—————————————-
https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
14
Source Code
APIs Documents
Incomplete
API Document Defect: Example 1
API Document JDK-1.8
Class:
TextLayout.

Method:
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
————————————-—————————————-

————————————-—————————————-
https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
————————————-—————————————-

————————————-—————————————-
15
Source Code
APIs Documents
Inconsistent
API Document Defect: Example 2
API Document JDK-1.8
Class:
InputEvent

Method:
getMaskForButton(int button)
https://docs.oracle.com/javase/8/docs/api/java/awt/event/InputEvent.html
16
Source Code
APIs Documents
Inconsistent
API Document Defect: Example 2
API Document JDK-1.8
Class:
InputEvent

Method:
getMaskForButton(int button)
————————————-—————————————-

————————————-—————————————-
https://docs.oracle.com/javase/8/docs/api/java/awt/event/InputEvent.html
17
Source Code
APIs Documents
Inconsistent
API Document Defects are Frequent
API Document JDK-1.8
Class:
InputEvent

Method:
getMaskForButton(int button)
————————————-—————————————-

————————————-—————————————-
https://docs.oracle.com/javase/8/docs/api/java/awt/event/InputEvent.html
“…and tend to be discovered and fixed after long time…”
http://stackoverflow.com/questions/2967303/inconsistency-in-java-util-concurrent-future
18
DRONE
Detect and Repair of dOcumentatioN dEfects)
Code
API
Document
Software
Artifacts
AST Parsing
Pre-Process
and POS
Tagging
Defect
Reports
Control Flow-
Based Constraint
Analysis
SMT
Solver
Dependency
Parsing and
Pattern Analysis
Code Constraint
FOL Generating
Doc Constraint
FOL Generating
HeuristicsHeuristics
19
DRONE
DetectoR of dOcumentatioN dEfects
20
DRONE
DetectoR of dOcumentatioN dEfects
“…we consider 4 cases of parameter usage constraints”
21
DRONE
DetectoR of dOcumentatioN dEfects
“…we consider 4 cases of parameter usage constraints”
1) “Nullness not allowed” 2) “Nullness allowed” NULL
22
DRONE
DetectoR of dOcumentatioN dEfects
“…we consider 4 cases of parameter usage constraints”
1) “Nullness not allowed” 2) “Nullness allowed”
3) “Type restriction” 4) “Range limitation”
NULL
T
Previous Work
ICSE 2017 TSE 2018
24
Step 1. Construct AST
25
Step 1. Construct AST
Source Code
26
Step 1. Construct AST
Source Code
c
c(i+1)
…….
…….
27
Step 1. Construct AST
1) for each method “m” the 2) its code call graph G
c(i+1);
c
= { call(m,c) }
c(i+1)
…….
…….
“…and extracts”
27
28
Step 1. Construct AST
28
1) for each method “m” the 2) its code call graph G
c(i+1);
c
= { call(m,c) }
c(i+1)
…….
“…and extracts”
29
Step 1. Construct AST
29
30
Step 1. Construct AST
30
c
For each
31
Step 1. Construct AST
31
c
For each
we collect
32
Step 1. Construct AST
32
c(i+1);c(i+1)
…….
…….
c
For each
we classify the
1) “Nullness not allowed”
2) “Nullness allowed”
3) “Type restriction”
NULL
T
33
Step 1. Construct AST
33
c(i+1);c(i+1)
…….
…….
1) “Nullness not allowed”
2) “Nullness allowed”
3) “Type restriction”
NULL
T
4) “Range limitation”
34
Extract Constraints from Directives in
API Documents
Natural Language
Parsing
35
Extract Constraints from Directives in
API Documents
Natural Language
Parsing
“Recurrent Linguistic Patterns (LPs)…”
Di Sorbo et al. ASE 2015
36
Example
“ @exception NullPointerException if the item’s value
is equal to < code> null< /code>”
“Recurrent Linguistic Patterns (LPs)…”
Di Sorbo et al. ASE 2015
Class: InputEvent java.awt.Choice Method: addItem(String item)
37
Example
“ @exception NullPointerException if the item’s value
is equal to < code> null< /code>”
{@exception NullPointerException }
Class: InputEvent java.awt.Choice Method: addItem(String item)
“Linguistic Pattern (LP)…”
“item equal
to null”
Di Sorbo et al. ASE 2015
38
Definition of NLP Heuristic
“Linguistic Pattern (LP)…”
“item equal
to null”
Steps:

1) Considering the relevant details;
2) Generalizing some information;
3) Ignoring useless information
NLP Heuristic:
Di Sorbo et al. ASE 2015
NLP Heuristic:
1) if the item’s value is equal to null”
39
Definition of NLP Heuristic
{@exception NullPointerException }
“Linguistic Pattern (LP)…”
“item equal
to null”
Steps:

1) Considering the relevant details;
2) Generalizing some information;
3) Ignoring useless information
NLP Heuristic:
1) if the item’s value is equal to null”
Di Sorbo et al. ASE 2015
40
Definition of NLP Heuristic
{@exception NullPointerException }
“Linguistic Pattern (LP)…”
“item equal
to null”
Steps:

1) Considering the relevant details;
2) Generalizing some information;
3) Ignoring useless information
NLP Heuristic:
1) if the item’s value is equal to null”
2) if the (subj)’s value is equal to null”
Di Sorbo et al. ASE 2015
2) if the (subj)’s value is equal to null”
41
Definition of NLP Heuristic
{@exception NullPointerException }
“Linguistic Pattern (LP)…”
“item equal
to null”
Steps:

1) Considering the relevant details;
2) Generalizing some information;
3) Ignoring useless information
NLP Heuristic:
1) if the item’s value is equal to null”
3) if the (subj)’s value is equal to null”
Di Sorbo et al. ASE 2015
2) if the (subj)’s value is equal to null”
42
Definition of NLP Heuristic
“Linguistic Pattern (LP)…”
“item equal
to null”
NLP Heuristic:
1) if the item’s value is equal to null”
3) if the (subj)’s value is equal to null”
64 NLP Heuristics
Steps:

1) Considering the relevant details;
2) Generalizing some information;
3) Ignoring useless information
Di Sorbo et al. ASE 2015
3) if the (subj)’s value is equal to null”
2) if the (subj)’s value is equal to null”
43
NLP Heuristic:
1) if the item’s value is equal to null”
64 NLP Heuristics
3) if the (subj)’s value is equal to null”
Steps:

1) Considering the relevant details;
2) Generalizing some information;
3) Ignoring useless information
Generation of FOL Constraints
3) if the (subj)’s value is equal to null”
2) if the (subj)’s value is equal to null”
44
Generation of FOL Constraints
NLP Heuristic:
1) if the item’s value is equal to null”
64 NLP Heuristics
3) if the (subj)’s value is equal to null”
(subj) = null
Steps:

1) Considering the relevant details;
2) Generalizing some information;
3) Ignoring useless information
45
?
SMT Solver
46
DRONE
Demo
DRONE UI—defect detection view !
47
Defects Repair:!
Based on the defect report generated from the previous part,
DRONE gives repair recommendations based on the predefined
templates.!
Repair Recommendation
Templates!
DRONE
Demo
48
DRONE
DRONE UI—defect repair view !
49
Case Studies
Documentation Code
50
Two Case Studies
Case Study 1
8 JDK Libraries
Case Study 2
Android APIs
51
Case Study 1
8 JDK Libraries
Android APIs
52
8 JDK Libraries
Results of Case Study 1: JDK APIs
Case Study 1
DRONE
?
1540 Potential Defects
Android APIs
53
8 JDK Libraries
Results of Case Study 1: JDK APIs
Case Study 1
1291 Real Defects
DRONE
?
1540 Potential Defects
Android APIs
54
8 JDK Libraries
Results of Case Study 1: JDK APIs
Case Study 1
1291 Real Defects
DRONE
?
1540 Potential Defects
Precision > 0.76
Recall > 0.84
F-measure > 0.80
Android APIs
55
Case Study 2
Questions Designed to Evaluate
Repair Recommendation
56
Case Study 2
Result Distribution
Questions Designed to Evaluate
Repair Recommendation
Conclusion & Future Work
“API documents represent one of the most
important references for developers…”
Conclusion & Future Work
Documentation Code
“API documents represent one of the most
important references for developers…”
“Analyzing APIs Documentation and Code to Detect Directive Defects”. ICSE 2017
DRONE
Conclusion & Future Work
Documentation Code
With DRONE we analyzed
8 java libraries and The Android APIs
detecting around 1291 of
API documentation defects, providing
repair solutions for them.
with high precision, recall, and F-
measure
“API documents represent one of the most
important references for developers…”
DRONE

More Related Content

PDF
My life as a cyborg
PPT
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)Patterns
PDF
PDF
Runtime Behavior of JavaScript Programs
PPTX
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...
PDF
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
PPTX
Mining Code Examples with Descriptive Text from Software Artifacts
PPTX
Finding Help with Programming Errors: An Exploratory Study of Novice Software...
My life as a cyborg
Are RESTful APIs Well-designed? Detection of their Linguistic (Anti)Patterns
Runtime Behavior of JavaScript Programs
Exploratory Study of Slack Q&A Chats as a Mining Source for Software Engineer...
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
Mining Code Examples with Descriptive Text from Software Artifacts
Finding Help with Programming Errors: An Exploratory Study of Novice Software...

What's hot (19)

PDF
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
PDF
Search Quality Evaluation: a Developer Perspective
PDF
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
PDF
Building a Dynamic Bidding system for a location based Display advertising Pl...
PPTX
Linkset quality (LWDM 2013)
PDF
Rated Ranking Evaluator (RRE) Hands-on Relevance Testing @Chorus
PDF
Mining Fix Patterns for FindBugs Violations
PDF
Put Your Hands in the Mud: What Technique, Why, and How
PPTX
Extracting Archival-Quality Information from Software-Related Chats
PDF
Evaluating Your Learning to Rank Model: Dos and Don’ts in Offline/Online Eval...
PDF
Software Birthmark for Detecting Theft of JavaScript Programs
PDF
Opinion Mining for Software Engineering
PDF
Software Analytics: Towards Software Mining that Matters
PDF
Vissoft21.ppt
PDF
Explainability for Learning to Rank
PPTX
PDF
Haystack London - Search Quality Evaluation, Tools and Techniques
PDF
Learning to Spot and Refactor Inconsistent Method Names
PDF
How to Build your Training Set for a Learning To Rank Project - Haystack
PyCon 2013 - Experiments in data mining, entity disambiguation and how to thi...
Search Quality Evaluation: a Developer Perspective
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Building a Dynamic Bidding system for a location based Display advertising Pl...
Linkset quality (LWDM 2013)
Rated Ranking Evaluator (RRE) Hands-on Relevance Testing @Chorus
Mining Fix Patterns for FindBugs Violations
Put Your Hands in the Mud: What Technique, Why, and How
Extracting Archival-Quality Information from Software-Related Chats
Evaluating Your Learning to Rank Model: Dos and Don’ts in Offline/Online Eval...
Software Birthmark for Detecting Theft of JavaScript Programs
Opinion Mining for Software Engineering
Software Analytics: Towards Software Mining that Matters
Vissoft21.ppt
Explainability for Learning to Rank
Haystack London - Search Quality Evaluation, Tools and Techniques
Learning to Spot and Refactor Inconsistent Method Names
How to Build your Training Set for a Learning To Rank Project - Haystack
Ad

Similar to DRONE: A Tool to Detect and Repair Directive Defects in Java APIs Documentation (20)

PDF
Analyzing APIs Documentation and Codeto Detect Directive Defects
PDF
Neal Gafter Java Evolution
PDF
[Quality Meetup] Piotr Wittchen - Fixing a billion dollar mistake
PDF
NLJUG University Sessie: Java Reborn, Powered by Ordina
PDF
Enabling White-Box Reuse in a Pure Composition Language
KEY
2 the essentials of effective java
PDF
Eclipse Day India 2015 - Keynote - Stephan Herrmann
PPTX
Modern_Java_Workshop manjunath np hj slave
PDF
Property based tests and where to find them - Andrzej Jóźwiak - TomTom Webina...
PPTX
2010 06-24 karlsruher entwicklertag
PDF
The Kotlin Programming Language, Svetlana Isakova
PDF
Светлана Исакова «Язык Kotlin»
PDF
Writing usableap isinpractice
PDF
Refactoring annotations
PPTX
Scala Back to Basics: Type Classes
PDF
A Field Guide to DSL Design in Scala
PDF
Domain specific languages and Scala
PDF
Java for android developers
KEY
Refactoring RIA Unleashed 2011
PDF
Software Design in Practice (with Java examples)
Analyzing APIs Documentation and Codeto Detect Directive Defects
Neal Gafter Java Evolution
[Quality Meetup] Piotr Wittchen - Fixing a billion dollar mistake
NLJUG University Sessie: Java Reborn, Powered by Ordina
Enabling White-Box Reuse in a Pure Composition Language
2 the essentials of effective java
Eclipse Day India 2015 - Keynote - Stephan Herrmann
Modern_Java_Workshop manjunath np hj slave
Property based tests and where to find them - Andrzej Jóźwiak - TomTom Webina...
2010 06-24 karlsruher entwicklertag
The Kotlin Programming Language, Svetlana Isakova
Светлана Исакова «Язык Kotlin»
Writing usableap isinpractice
Refactoring annotations
Scala Back to Basics: Type Classes
A Field Guide to DSL Design in Scala
Domain specific languages and Scala
Java for android developers
Refactoring RIA Unleashed 2011
Software Design in Practice (with Java examples)
Ad

More from Sebastiano Panichella (20)

PDF
ICST/SBFT Tool Competition 2025 - UAV Testing Track
PDF
NL-based Software Engineering (NLBSE) '25
PDF
ICST Tool Competition 2025 Self-driving Car Testing Track
PDF
ICST Awards: 18th IEEE International Conference on Software Testing, Verifica...
PDF
ICST Panel: 18th IEEE International Conference on Software Testing, Verificat...
PDF
ICST Closing: 18th IEEE International Conference on Software Testing, Verific...
PDF
ICST Opening: 18th IEEE International Conference on Software Testing, Verific...
PDF
ICST/SBFT Tool Competition 2025 UAV Testing Track
PDF
Announcement of 18th IEEE International Conference on Software Testing, Verif...
PDF
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
PDF
International Workshop on Artificial Intelligence in Software Testing
PDF
The 3rd Intl. Workshop on NL-based Software Engineering
PDF
Diversity-guided Search Exploration for Self-driving Cars Test Generation thr...
PDF
SBFT Tool Competition 2024 -- Python Test Case Generation Track
PDF
SBFT Tool Competition 2024 - CPS-UAV Test Case Generation Track
PDF
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
PDF
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
PDF
COSMOS: DevOps for Complex Cyber-physical Systems
PDF
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
PDF
An Empirical Characterization of Software Bugs in Open-Source Cyber-Physical ...
ICST/SBFT Tool Competition 2025 - UAV Testing Track
NL-based Software Engineering (NLBSE) '25
ICST Tool Competition 2025 Self-driving Car Testing Track
ICST Awards: 18th IEEE International Conference on Software Testing, Verifica...
ICST Panel: 18th IEEE International Conference on Software Testing, Verificat...
ICST Closing: 18th IEEE International Conference on Software Testing, Verific...
ICST Opening: 18th IEEE International Conference on Software Testing, Verific...
ICST/SBFT Tool Competition 2025 UAV Testing Track
Announcement of 18th IEEE International Conference on Software Testing, Verif...
Doctoral Symposium at the 17th IEEE International Conference on Software Test...
International Workshop on Artificial Intelligence in Software Testing
The 3rd Intl. Workshop on NL-based Software Engineering
Diversity-guided Search Exploration for Self-driving Cars Test Generation thr...
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 - CPS-UAV Test Case Generation Track
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Testing with Fewer Resources: Toward Adaptive Approaches for Cost-effective ...
COSMOS: DevOps for Complex Cyber-physical Systems
Testing and Development Challenges for Complex Cyber-Physical Systems: Insigh...
An Empirical Characterization of Software Bugs in Open-Source Cyber-Physical ...

Recently uploaded (20)

PDF
natwest.pdf company description and business model
PPTX
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
PPTX
BIOLOGY TISSUE PPT CLASS 9 PROJECT PUBLIC
PPTX
Lesson-7-Gas. -Exchange_074636.pptx
PPTX
2025-08-10 Joseph 02 (shared slides).pptx
PPTX
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx
PPTX
fundraisepro pitch deck elegant and modern
PPTX
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
PPTX
FINAL TEST 3C_OCTAVIA RAMADHANI SANTOSO-1.pptx
PDF
Swiggy’s Playbook: UX, Logistics & Monetization
PPTX
Hydrogel Based delivery Cancer Treatment
PPTX
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
PPTX
Introduction-to-Food-Packaging-and-packaging -materials.pptx
PDF
Yusen Logistics Group Sustainability Report 2024.pdf
PPTX
An Unlikely Response 08 10 2025.pptx
PPTX
Human Mind & its character Characteristics
PPTX
The Effect of Human Resource Management Practice on Organizational Performanc...
PPTX
Relationship Management Presentation In Banking.pptx
PPTX
NORMAN_RESEARCH_PRESENTATION.in education
DOCX
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"
natwest.pdf company description and business model
INTERNATIONAL LABOUR ORAGNISATION PPT ON SOCIAL SCIENCE
BIOLOGY TISSUE PPT CLASS 9 PROJECT PUBLIC
Lesson-7-Gas. -Exchange_074636.pptx
2025-08-10 Joseph 02 (shared slides).pptx
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx
fundraisepro pitch deck elegant and modern
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
FINAL TEST 3C_OCTAVIA RAMADHANI SANTOSO-1.pptx
Swiggy’s Playbook: UX, Logistics & Monetization
Hydrogel Based delivery Cancer Treatment
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
Introduction-to-Food-Packaging-and-packaging -materials.pptx
Yusen Logistics Group Sustainability Report 2024.pdf
An Unlikely Response 08 10 2025.pptx
Human Mind & its character Characteristics
The Effect of Human Resource Management Practice on Organizational Performanc...
Relationship Management Presentation In Banking.pptx
NORMAN_RESEARCH_PRESENTATION.in education
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"

DRONE: A Tool to Detect and Repair Directive Defects in Java APIs Documentation

  • 1. DRONE: A Tool to Detect and Repair Directive Defects in Java APIs Documentation Sebastiano Panichella Xin Yan Taolue Chen Harald Gall Yu Zhou
  • 2. Outline 2 DRONE Context: Proposed Solution based on: Case Study: APIs Usage in OSS and Industrial Projects - NLP Approaches; - Static Analysis Techniques; - Logic reasoning; Assessment of DRONE on Documentation and Code 8 Java Libraries Documentation Code
  • 3. Open Source (OS) and Industrial Projects 3 “Social networks like Facebook or Pinterest, or utilities like  Google Maps or Dropbox are popular examples of APIs providers.”
  • 4. Open Source (OS) and Industrial Projects 4 “Social networks like Facebook or Pinterest, or utilities like  Google Maps or Dropbox are popular examples of APIs providers.”
  • 5. Open Source (OS) and Industrial Projects 5“APIs are great time savers for Developers…”
  • 6. 6 Difficult to Understand describe Information Needed Ideally…. “API documents represent one of the most important references for developers…” Source Code APIs Documents Application Programming Interface (API) Documents
  • 7. 7 Software Changes over the Time “…as consequence the original documentation tend to be incomplete and inconsistent with the source code…” Insufficient Information Source Code Difficult to Understand APIs Documents Inconsistent withComing back to the reality... Inconsistent/ Incomplete
  • 8. 8 Source Code APIs Documents Inconsistent/ Incomplete API Document Defect: Example 1 Class: TextLayout. Method: getBlackBoxBounds(int firstEndpoint, int secondEndpoint) API Document JDK-1.8
  • 9. 9 Source Code APIs Documents Inconsistent/ Incomplete API Document Defect: Example 1 Class: TextLayout. Method: getBlackBoxBounds(int firstEndpoint, int secondEndpoint) API Document JDK-1.8 https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
  • 10. 10 Source Code APIs Documents Inconsistent/ Incomplete API Document Defect: Example 1 API Document JDK-1.8 Class: TextLayout. Method: getBlackBoxBounds(int firstEndpoint, int secondEndpoint) https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
  • 11. 11 Source Code APIs Documents Inconsistent/ Incomplete API Document Defect: Example 1 API Document JDK-1.8 Class: TextLayout. Method: getBlackBoxBounds(int firstEndpoint, int secondEndpoint) https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
  • 12. 12 Source Code APIs Documents Inconsistent/ Incomplete API Document Defect: Example 1 API Document JDK-1.8 Class: TextLayout. Method: getBlackBoxBounds(int firstEndpoint, int secondEndpoint) ————————————-—————————————- ————————————-—————————————- https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
  • 13. 13 Source Code APIs Documents Inconsistent/ Incomplete API Document Defect: Example 1 API Document JDK-1.8 Class: TextLayout. Method: getBlackBoxBounds(int firstEndpoint, int secondEndpoint) ————————————-—————————————- ————————————-—————————————- https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
  • 14. 14 Source Code APIs Documents Incomplete API Document Defect: Example 1 API Document JDK-1.8 Class: TextLayout. Method: getBlackBoxBounds(int firstEndpoint, int secondEndpoint) ————————————-—————————————- ————————————-—————————————- https://docs.oracle.com/javase/8/docs/api/java/awt/font/TextLayout.html
  • 15. ————————————-—————————————- ————————————-—————————————- 15 Source Code APIs Documents Inconsistent API Document Defect: Example 2 API Document JDK-1.8 Class: InputEvent Method: getMaskForButton(int button) https://docs.oracle.com/javase/8/docs/api/java/awt/event/InputEvent.html
  • 16. 16 Source Code APIs Documents Inconsistent API Document Defect: Example 2 API Document JDK-1.8 Class: InputEvent Method: getMaskForButton(int button) ————————————-—————————————- ————————————-—————————————- https://docs.oracle.com/javase/8/docs/api/java/awt/event/InputEvent.html
  • 17. 17 Source Code APIs Documents Inconsistent API Document Defects are Frequent API Document JDK-1.8 Class: InputEvent Method: getMaskForButton(int button) ————————————-—————————————- ————————————-—————————————- https://docs.oracle.com/javase/8/docs/api/java/awt/event/InputEvent.html “…and tend to be discovered and fixed after long time…” http://stackoverflow.com/questions/2967303/inconsistency-in-java-util-concurrent-future
  • 18. 18 DRONE Detect and Repair of dOcumentatioN dEfects) Code API Document Software Artifacts AST Parsing Pre-Process and POS Tagging Defect Reports Control Flow- Based Constraint Analysis SMT Solver Dependency Parsing and Pattern Analysis Code Constraint FOL Generating Doc Constraint FOL Generating HeuristicsHeuristics
  • 20. 20 DRONE DetectoR of dOcumentatioN dEfects “…we consider 4 cases of parameter usage constraints”
  • 21. 21 DRONE DetectoR of dOcumentatioN dEfects “…we consider 4 cases of parameter usage constraints” 1) “Nullness not allowed” 2) “Nullness allowed” NULL
  • 22. 22 DRONE DetectoR of dOcumentatioN dEfects “…we consider 4 cases of parameter usage constraints” 1) “Nullness not allowed” 2) “Nullness allowed” 3) “Type restriction” 4) “Range limitation” NULL T
  • 25. 25 Step 1. Construct AST Source Code
  • 26. 26 Step 1. Construct AST Source Code c c(i+1) ……. …….
  • 27. 27 Step 1. Construct AST 1) for each method “m” the 2) its code call graph G c(i+1); c = { call(m,c) } c(i+1) ……. ……. “…and extracts” 27
  • 28. 28 Step 1. Construct AST 28 1) for each method “m” the 2) its code call graph G c(i+1); c = { call(m,c) } c(i+1) ……. “…and extracts”
  • 30. 30 Step 1. Construct AST 30 c For each
  • 31. 31 Step 1. Construct AST 31 c For each we collect
  • 32. 32 Step 1. Construct AST 32 c(i+1);c(i+1) ……. ……. c For each we classify the 1) “Nullness not allowed” 2) “Nullness allowed” 3) “Type restriction” NULL T
  • 33. 33 Step 1. Construct AST 33 c(i+1);c(i+1) ……. ……. 1) “Nullness not allowed” 2) “Nullness allowed” 3) “Type restriction” NULL T 4) “Range limitation”
  • 34. 34 Extract Constraints from Directives in API Documents Natural Language Parsing
  • 35. 35 Extract Constraints from Directives in API Documents Natural Language Parsing “Recurrent Linguistic Patterns (LPs)…” Di Sorbo et al. ASE 2015
  • 36. 36 Example “ @exception NullPointerException if the item’s value is equal to < code> null< /code>” “Recurrent Linguistic Patterns (LPs)…” Di Sorbo et al. ASE 2015 Class: InputEvent java.awt.Choice Method: addItem(String item)
  • 37. 37 Example “ @exception NullPointerException if the item’s value is equal to < code> null< /code>” {@exception NullPointerException } Class: InputEvent java.awt.Choice Method: addItem(String item) “Linguistic Pattern (LP)…” “item equal to null” Di Sorbo et al. ASE 2015
  • 38. 38 Definition of NLP Heuristic “Linguistic Pattern (LP)…” “item equal to null” Steps: 1) Considering the relevant details; 2) Generalizing some information; 3) Ignoring useless information NLP Heuristic: Di Sorbo et al. ASE 2015 NLP Heuristic: 1) if the item’s value is equal to null”
  • 39. 39 Definition of NLP Heuristic {@exception NullPointerException } “Linguistic Pattern (LP)…” “item equal to null” Steps: 1) Considering the relevant details; 2) Generalizing some information; 3) Ignoring useless information NLP Heuristic: 1) if the item’s value is equal to null” Di Sorbo et al. ASE 2015
  • 40. 40 Definition of NLP Heuristic {@exception NullPointerException } “Linguistic Pattern (LP)…” “item equal to null” Steps: 1) Considering the relevant details; 2) Generalizing some information; 3) Ignoring useless information NLP Heuristic: 1) if the item’s value is equal to null” 2) if the (subj)’s value is equal to null” Di Sorbo et al. ASE 2015
  • 41. 2) if the (subj)’s value is equal to null” 41 Definition of NLP Heuristic {@exception NullPointerException } “Linguistic Pattern (LP)…” “item equal to null” Steps: 1) Considering the relevant details; 2) Generalizing some information; 3) Ignoring useless information NLP Heuristic: 1) if the item’s value is equal to null” 3) if the (subj)’s value is equal to null” Di Sorbo et al. ASE 2015
  • 42. 2) if the (subj)’s value is equal to null” 42 Definition of NLP Heuristic “Linguistic Pattern (LP)…” “item equal to null” NLP Heuristic: 1) if the item’s value is equal to null” 3) if the (subj)’s value is equal to null” 64 NLP Heuristics Steps: 1) Considering the relevant details; 2) Generalizing some information; 3) Ignoring useless information Di Sorbo et al. ASE 2015
  • 43. 3) if the (subj)’s value is equal to null” 2) if the (subj)’s value is equal to null” 43 NLP Heuristic: 1) if the item’s value is equal to null” 64 NLP Heuristics 3) if the (subj)’s value is equal to null” Steps: 1) Considering the relevant details; 2) Generalizing some information; 3) Ignoring useless information Generation of FOL Constraints
  • 44. 3) if the (subj)’s value is equal to null” 2) if the (subj)’s value is equal to null” 44 Generation of FOL Constraints NLP Heuristic: 1) if the item’s value is equal to null” 64 NLP Heuristics 3) if the (subj)’s value is equal to null” (subj) = null Steps: 1) Considering the relevant details; 2) Generalizing some information; 3) Ignoring useless information
  • 47. 47 Defects Repair:! Based on the defect report generated from the previous part, DRONE gives repair recommendations based on the predefined templates.! Repair Recommendation Templates! DRONE Demo
  • 50. 50 Two Case Studies Case Study 1 8 JDK Libraries Case Study 2 Android APIs
  • 51. 51 Case Study 1 8 JDK Libraries Android APIs
  • 52. 52 8 JDK Libraries Results of Case Study 1: JDK APIs Case Study 1 DRONE ? 1540 Potential Defects Android APIs
  • 53. 53 8 JDK Libraries Results of Case Study 1: JDK APIs Case Study 1 1291 Real Defects DRONE ? 1540 Potential Defects Android APIs
  • 54. 54 8 JDK Libraries Results of Case Study 1: JDK APIs Case Study 1 1291 Real Defects DRONE ? 1540 Potential Defects Precision > 0.76 Recall > 0.84 F-measure > 0.80 Android APIs
  • 55. 55 Case Study 2 Questions Designed to Evaluate Repair Recommendation
  • 56. 56 Case Study 2 Result Distribution Questions Designed to Evaluate Repair Recommendation
  • 57. Conclusion & Future Work “API documents represent one of the most important references for developers…”
  • 58. Conclusion & Future Work Documentation Code “API documents represent one of the most important references for developers…” “Analyzing APIs Documentation and Code to Detect Directive Defects”. ICSE 2017 DRONE
  • 59. Conclusion & Future Work Documentation Code With DRONE we analyzed 8 java libraries and The Android APIs detecting around 1291 of API documentation defects, providing repair solutions for them. with high precision, recall, and F- measure “API documents represent one of the most important references for developers…” DRONE