SnR: constraint-based type inference for incomplete Java code snippets.

Λεπτομέρειες βιβλιογραφικής εγγραφής
Τίτλος: SnR: constraint-based type inference for incomplete Java code snippets.
Συγγραφείς: Dong, Yiwen, Gu, Tianxiao, Tian, Yongqiang, Sun, Chengnian
Πηγή: ICSE: International Conference on Software Engineering; 2022, p1982-1993, 12p
Θεματικοί όροι: Java programming language, Datalog (Computer program language), Programming languages, Computer interfaces, Libraries
Περίληψη: Code snippets are prevalent on websites such as Stack Overflow and are effective in demonstrating API usages concisely. However they are usually difficult to be used directly because most code snippets not only are syntactically incomplete but also lack dependency information, and thus do not compile. For example, Java snippets usually do not have import statements or required library names; only 6.88% of Java snippets on Stack Overflow include import statements necessary for compilation. This paper proposes SnR, a precise, efficient, constraint-based technique to automatically infer the exact types used in code snippets and the libraries containing the inferred types, to compile and therefore reuse the code snippets. Initially, SnR builds a knowledge base of APIs, i.e., various facts about the available APIs, from a corpus of Java libraries. Given a code snippet with missing import statements, SnR automatically extracts typing constraints from the snippet, solves the constraints against the knowledge base, and returns a set of APIs that satisfies the constraints to be imported into the snippet. We have evaluated SnR on a benchmark of 267 code snippets from Stack Overflow. SnR significantly outperforms the state-of-the-art tool Coster. SnR correctly infers 91.0% of the import statements, which makes 73.8% of the snippets compile, compared to 36.0% of the import statements and 9.0% of the snippets by Coster. [ABSTRACT FROM AUTHOR]
Copyright of ICSE: International Conference on Software Engineering is the property of Association for Computing Machinery and its content may not be copied or emailed to multiple sites without the copyright holder's express written permission. Additionally, content may not be used with any artificial intelligence tools or machine learning technologies. However, users may print, download, or email articles for individual use. This abstract may be abridged. No warranty is given about the accuracy of the copy. Users should refer to the original published version of the material for the full abstract. (Copyright applies to all Abstracts.)
Βάση Δεδομένων: Complementary Index
FullText Text:
  Availability: 0
Header DbId: edb
DbLabel: Complementary Index
An: 185195717
RelevancyScore: 931
AccessLevel: 6
PubType: Conference
PubTypeId: conference
PreciseRelevancyScore: 930.922546386719
IllustrationInfo
Items – Name: Title
  Label: Title
  Group: Ti
  Data: SnR: constraint-based type inference for incomplete Java code snippets.
– Name: Author
  Label: Authors
  Group: Au
  Data: <searchLink fieldCode="AR" term="%22Dong%2C+Yiwen%22">Dong, Yiwen</searchLink><br /><searchLink fieldCode="AR" term="%22Gu%2C+Tianxiao%22">Gu, Tianxiao</searchLink><br /><searchLink fieldCode="AR" term="%22Tian%2C+Yongqiang%22">Tian, Yongqiang</searchLink><br /><searchLink fieldCode="AR" term="%22Sun%2C+Chengnian%22">Sun, Chengnian</searchLink>
– Name: TitleSource
  Label: Source
  Group: Src
  Data: ICSE: International Conference on Software Engineering; 2022, p1982-1993, 12p
– Name: Subject
  Label: Subject Terms
  Group: Su
  Data: <searchLink fieldCode="DE" term="%22Java+programming+language%22">Java programming language</searchLink><br /><searchLink fieldCode="DE" term="%22Datalog+%28Computer+program+language%29%22">Datalog (Computer program language)</searchLink><br /><searchLink fieldCode="DE" term="%22Programming+languages%22">Programming languages</searchLink><br /><searchLink fieldCode="DE" term="%22Computer+interfaces%22">Computer interfaces</searchLink><br /><searchLink fieldCode="DE" term="%22Libraries%22">Libraries</searchLink>
– Name: Abstract
  Label: Abstract
  Group: Ab
  Data: Code snippets are prevalent on websites such as Stack Overflow and are effective in demonstrating API usages concisely. However they are usually difficult to be used directly because most code snippets not only are syntactically incomplete but also lack dependency information, and thus do not compile. For example, Java snippets usually do not have import statements or required library names; only 6.88% of Java snippets on Stack Overflow include import statements necessary for compilation. This paper proposes SnR, a precise, efficient, constraint-based technique to automatically infer the exact types used in code snippets and the libraries containing the inferred types, to compile and therefore reuse the code snippets. Initially, SnR builds a knowledge base of APIs, i.e., various facts about the available APIs, from a corpus of Java libraries. Given a code snippet with missing import statements, SnR automatically extracts typing constraints from the snippet, solves the constraints against the knowledge base, and returns a set of APIs that satisfies the constraints to be imported into the snippet. We have evaluated SnR on a benchmark of 267 code snippets from Stack Overflow. SnR significantly outperforms the state-of-the-art tool Coster. SnR correctly infers 91.0% of the import statements, which makes 73.8% of the snippets compile, compared to 36.0% of the import statements and 9.0% of the snippets by Coster. [ABSTRACT FROM AUTHOR]
– Name: Abstract
  Label:
  Group: Ab
  Data: <i>Copyright of ICSE: International Conference on Software Engineering is the property of Association for Computing Machinery and its content may not be copied or emailed to multiple sites without the copyright holder's express written permission. Additionally, content may not be used with any artificial intelligence tools or machine learning technologies. However, users may print, download, or email articles for individual use. This abstract may be abridged. No warranty is given about the accuracy of the copy. Users should refer to the original published version of the material for the full abstract.</i> (Copyright applies to all Abstracts.)
PLink https://search.ebscohost.com/login.aspx?direct=true&site=eds-live&db=edb&AN=185195717
RecordInfo BibRecord:
  BibEntity:
    Identifiers:
      – Type: doi
        Value: 10.1145/3510003.3510061
    Languages:
      – Code: eng
        Text: English
    PhysicalDescription:
      Pagination:
        PageCount: 12
        StartPage: 1982
    Subjects:
      – SubjectFull: Java programming language
        Type: general
      – SubjectFull: Datalog (Computer program language)
        Type: general
      – SubjectFull: Programming languages
        Type: general
      – SubjectFull: Computer interfaces
        Type: general
      – SubjectFull: Libraries
        Type: general
    Titles:
      – TitleFull: SnR: constraint-based type inference for incomplete Java code snippets.
        Type: main
  BibRelationships:
    HasContributorRelationships:
      – PersonEntity:
          Name:
            NameFull: Dong, Yiwen
      – PersonEntity:
          Name:
            NameFull: Gu, Tianxiao
      – PersonEntity:
          Name:
            NameFull: Tian, Yongqiang
      – PersonEntity:
          Name:
            NameFull: Sun, Chengnian
    IsPartOfRelationships:
      – BibEntity:
          Dates:
            – D: 01
              M: 05
              Text: 2022
              Type: published
              Y: 2022
          Titles:
            – TitleFull: ICSE: International Conference on Software Engineering
              Type: main
ResultId 1