Files
logseq/pages/hls__icse2023-paper2055_1666614323271_0.md
2025-06-05 22:07:12 +02:00

293 lines
11 KiB
Markdown

file:: [icse2023-paper2055_1666614323271_0.pdf](../assets/icse2023-paper2055_1666614323271_0.pdf)
file-path:: ../assets/icse2023-paper2055_1666614323271_0.pdf
- recommended
ls-type:: annotation
hl-page:: 1
hl-color:: yellow
id:: 635c7f32-3505-433d-84a3-561ee5f649c9
- o meet some needs
ls-type:: annotation
hl-page:: 1
hl-color:: yellow
id:: 635c7f37-6737-4363-b49d-02a826f81ba6
- one of the most important code alternatives is API usage
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635c7f46-8d3c-4c57-ad3a-baf47dacc6d6
- cloze-style fill-in-blank task and leverage code pre-trained models to solve it.
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635c7fc4-6805-43cb-89ee-9932e7d4b763
- REALAU
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635c7fcd-0591-4b04-b415-b23673cd1b26
- We evaluate REALAU with large amounts of Java code snippets in the CodeSearchNet dataset, the results show that REALAU can accurately predict API usages in code.
ls-type:: annotation
hl-page:: 1
hl-color:: yellow
id:: 635c8008-b483-4d0e-bf47-7b57d05df25d
- Stack Overflow or recommended by AI pair programming tools such as Copilot
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc75e-2558-4bae-9487-e8cec12bc58e
- o be aware of the customization and know how to customize, developers often need code alternatives for reference and comparison
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc76d-330f-4b8c-bf1c-f76ea2f3ebcb
- more than half Stack Overflow code snippets involve changing a method call when reused and adapted in GitHub projects.
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc7a5-e98c-4e6a-a6a3-e5b710c3056b
- API usages that are API calls with actual arguments
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc7b1-c42f-4854-83e4-ccfb6fc18088
- They match the code snippets in a clone set with each other, using the common part as a code template and different parts as customizable points and code alternatives. These approaches rely heavily on matching-based clone-diff analysis, so cannot harvest code alternatives among the code that are not clones but are contextually similar to each other
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc842-07c4-4232-b269-6a228a14a6bf
- there are some existing approaches [ 7], [8], [9], [10 ] proposed to recommend API usages based on code context.
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc87a-299e-43db-8b3d-e5a47774b34f
- ternative API usages based on the code context
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc902-1873-4718-ba7a-166963a95b0b
- First, during pre-training the models have seen a large variant of code and likely learned the latent relevance between different API usages and code contexts, so can predict suitable API usages based on code context.
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc96c-aed8-4197-94b1-85a1801eba5b
- Second, because of the pre-training tasks like masked token/span prediction, some pre-trained models such as CodeBERT [ 11 ] and CodeT5 [14] can be naturally applied to cloze-style tasks
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc978-e31d-4dd6-b3f0-2c5ba4214664
- REALAU first extracts APIs and API usages from a code corpus to construct an alternative repository
ls-type:: annotation
hl-page:: 1
hl-color:: purple
id:: 635cc9cd-c561-44ae-9c50-70c1a2f32e88
- PI usage retrieve
ls-type:: annotation
hl-page:: 1
hl-color:: green
id:: 635cca37-c918-4a3f-8efa-d2da00590b08
- API usage reranker
ls-type:: annotation
hl-page:: 1
hl-color:: green
id:: 635cca3c-97ac-4f65-9de2-0e688a88e623
- etriever can ensure the diversity
ls-type:: annotation
hl-page:: 1
hl-color:: green
id:: 635cca69-a43b-407f-b254-f8a549ea21b0
- eranker can assess the fitness for arbitrary-length API usages
ls-type:: annotation
hl-page:: 1
hl-color:: green
id:: 635cca7e-5e56-44a4-a8f3-9e5de039edbd
- Second, the user study with 14 participants reveals that REALAU can significantly improve the correctness by 35.7%, decrease the completion time by 54.2%, and provide370.7% more suggestive information than the baseline on 6 code customization tasks
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635ccb19-5e60-4a04-bed6-353b6c141059
- eveloper needs to customize it when having other concerns such as security, performance, or maintenance status of the used libraries and APIs
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635ccb39-1d76-438e-8c98-a26eed0879f3
- alternative API usages to assess the code quality and customize the current code to meet their needs
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635ccb82-b733-4a3b-bc2c-02924546b428
- ome alternative APIs are not compatible with the current code (e.g., inconsistent type of return value),
ls-type:: annotation
hl-page:: 2
hl-color:: purple
id:: 635cceae-3f24-4280-9904-52088c39e423
- esults of Different Approaches
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635cf3eb-f98e-4058-8741-5967a73d9931
- Clone-Diff Based Approaches.
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635cf3f3-0eb8-4914-9bed-9652e4170709
- ExampleStack identifies 11 customizable points in the code based on 10 clones of it found in GitHub.
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635cf433-bf46-4e2e-924e-634c3eebdcc7
- different kinds of code alternatives such as Exception Handling and Refactoring
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635cf44a-8bd3-4817-94f0-dfa5dffc9333
- ExampleStack fails to find more alternative digest algorithms besides “SHA-1”.
ls-type:: annotation
hl-page:: 2
hl-color:: purple
id:: 635cf48e-38e4-4cf3-8ea5-a24e2d2d7080
- much richer such code alternatives than ExampleStack
ls-type:: annotation
hl-page:: 2
hl-color:: yellow
id:: 635cf498-bb73-4028-993f-f0b99784d575
- REALAU can provide API-level alternatives such as new SHA256Digest together with some samples, and argument-level alternatives such as "SHA-1", "SHA-256", "SHA-384", and "SHA-512".
ls-type:: annotation
hl-page:: 2
hl-color:: green
id:: 635cf59c-58cc-4a53-805c-5e891126a06f
- We will attempt to fill in the blank with some alternative API usages (e.g., MessageDigest.getInstance("MD5") and new SHA256Digest()).
ls-type:: annotation
hl-page:: 3
hl-color:: purple
id:: 635cf5d7-e256-40b8-8603-ff546b30e0e7
- They take an entire sequence of tokens as input at once and use bidirectional context to generate a vector representation for each token in the sequence
ls-type:: annotation
hl-page:: 3
hl-color:: green
id:: 635cf600-98c9-4bea-932e-e7e90b4f63df
- masked token prediction
ls-type:: annotation
hl-page:: 3
hl-color:: green
id:: 635cf611-9310-4a86-8d56-dd5da6f62098
- bidirectional context encoding capacity
ls-type:: annotation
hl-page:: 3
hl-color:: green
id:: 635cf625-7a54-49b6-8c71-4e96e1d1f4fe
- masked token prediction pre-training task
ls-type:: annotation
hl-page:: 3
hl-color:: green
id:: 635cf632-04fb-40c1-b577-3fd7599f43dd
- The reason is that the blank length (i.e., the number of tokens to predict) must be determined before prediction when applying these models to cloze-style tasks, while the alternative API usages to be filled into the blank are indeterminate-length
ls-type:: annotation
hl-page:: 3
hl-color:: yellow
id:: 635d03e3-b005-4896-ab49-5fead468659e
- we need to adapt the models properly to solve the problem of indeterminate length and diversity of code alternatives
ls-type:: annotation
hl-page:: 3
hl-color:: yellow
id:: 635d048a-aba0-40d4-9c34-30dda454d795
- API usage retriever and an API usage reranker, which are built upon existing code pre-trained models.
ls-type:: annotation
hl-page:: 3
hl-color:: green
id:: 635d0a17-f788-4890-bb2e-42ed954b1c10
- From the code corpus, REALAU extracts APIs, API usages, and the mappings between them to form a code alternative repository.
ls-type:: annotation
hl-page:: 3
hl-color:: green
id:: 635d0acf-1922-482c-8709-f50e82a28c69
- REALAU then attempts to map the extracted expressions to the corresponding APIs.
ls-type:: annotation
hl-page:: 4
hl-color:: green
id:: 635d0b35-024a-4a33-8db1-c2ec14caa01d
- define-use analysis for variables
ls-type:: annotation
hl-page:: 4
hl-color:: yellow
id:: 635d0e61-ce04-46fb-bffb-b7a1006d623e
- EALAU tries to trace back to where o is defined to determine the type T of o
ls-type:: annotation
hl-page:: 4
hl-color:: yellow
id:: 635d0e6c-1d2f-467b-9bf3-a5016b74defd
- If an expression can be mapped to an API, it is treated as an API usage
ls-type:: annotation
hl-page:: 4
hl-color:: green
id:: 635d0ea8-add8-445f-b761-3f792ab99933
- we distinguish APIs only by their names (without parameters), that is, we consider the APIs with the same name to be the same API.
ls-type:: annotation
hl-page:: 4
hl-color:: green
id:: 635d0f6d-c1b2-4fad-b3e2-f64dfb03fdd8
- code context
ls-type:: annotation
hl-page:: 4
hl-color:: yellow
id:: 635d0fc4-845f-4b3b-a301-c05383511cf7
- REALAU
ls-type:: annotation
hl-page:: 3
hl-color:: purple
id:: 635e8d54-8a89-46e8-b1db-d975bbab5b3c
- construct an alternative repository
ls-type:: annotation
hl-page:: 3
hl-color:: yellow
id:: 635e9619-99d1-4734-a1fc-5707fa2ed421
- Give
ls-type:: annotation
hl-page:: 3
hl-color:: red
id:: 635e971f-28c4-4ce3-8952-62c80aecb968
- he API usage reranker reranks the retrieved API usages according to their fitness (i.e., generation probability) to be filled into the blank.
ls-type:: annotation
hl-page:: 3
hl-color:: yellow
id:: 635e97bb-8f0f-4462-abbe-987e39e7ae05
- If the expression is a method call (denoted as mi), it can be further divided into three following cases.• mi calls a custom method of the current class with the form m(...);• mi calls a static method of class C with the form C.m(...);• mi calls a member method of the object o with the form o.m(...).
ls-type:: annotation
hl-page:: 4
hl-color:: green
id:: 635eb6f7-0e56-4f18-811f-a1c6944a6f51
- For the last case, REALAU tries to find the corresponding type T for o by performing th
ls-type:: annotation
hl-page:: 4
hl-color:: red
id:: 635ec128-b147-4256-92d2-3f258f150040
- 1) Similarity Model
ls-type:: annotation
hl-page:: 4
hl-color:: green
id:: 635ec5bd-da51-4f64-910e-e09b381bcbc1
- Blank Embedding.
ls-type:: annotation
hl-page:: 4
hl-color:: green
id:: 635ec601-fe58-4201-9965-c44050a323a4
- API Embedding.
ls-type:: annotation
hl-page:: 4
hl-color:: green
id:: 635ec606-eb55-4dcf-a5dc-6eb14cac3689
- 2) Model Fine-tuning:
ls-type:: annotation
hl-page:: 5
hl-color:: green
id:: 635ec638-945f-4912-8d5a-ce78d84ad880
- and randomly masks one of the usages with a blank [MASK].
ls-type:: annotation
hl-page:: 5
hl-color:: green
id:: 635ec65b-94a6-47a1-aa86-43ddcf732ffc
- 3) API Usage Retrieval:
ls-type:: annotation
hl-page:: 5
hl-color:: green
id:: 635ec668-a2db-47af-85d5-763d0570950c