Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2660193.2660203acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Refactoring Java generics by inferring wildcards, in practice

Published: 15 October 2014 Publication History

Abstract

Wildcard annotations can improve the generality of Java generic libraries, but require heavy manual effort. We present an algorithm for refactoring and inferring more general type instantiations of Java generics using wildcards. Compared to past approaches, our work is practical and immediately applicable: we assume no changes to the Java type system, while taking into account all its intricacies. Our system allows users to select declarations (variables, method parameters, return types, etc.) to generalize and considers declarations not declared in available source code. It then performs an inter-procedural flow analysis and a method body analysis, in order to generalize type signatures. We evaluate our technique on six Java generic libraries. We find that 34% of available declarations of variant type signatures can be generalized - i.e., relaxed with more general wildcard types. On average, 146 other declarations need to be updated when a declaration is generalized, showing that this refactoring would be too tedious and error-prone to perform manually.

Supplementary Material

PDF File (artifact_overview.pdf)
Artifact Overview for Paper #35 of OOPSLA 2014
ZIP File (varj.zip)
Please, email questions to [email protected]
ZIP File (oopsla035.zip)
Please, email questions to [email protected]

References

[1]
J. Altidor, S. S. Huang, and Y. Smaragdakis. Taming the wildcards: Combining definition- and use-site variance. In Programming Language Design and Implementation (PLDI), 2011.
[2]
J. Altidor, C. Reichenbach, and Y. Smaragdakis. Java wildcards meet definition-site variance. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP), 2012.
[3]
Apache. Apache commons-collections library. http://larvalabs.com/collections/. Version 4.01.
[4]
K. Boumillion and J. Levy. Guava: Google core libraries for Java 1.5+. http://code.google.com/p/guava-libraries/. Release 8.
[5]
N. Cameron, S. Drossopoulou, and E. Ernst. A model for Java with wildcards. In European Conf. on Object-Oriented Programming (ECOOP), 2008.
[6]
P. Canning, W. Cook, W. Hill, W. Olthoff, and J. C. Mitchell. F-bounded polymorphism for object-oriented programming. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture, 1989.
[7]
W.-N. Chin, F. Craciun, S.-C. Khoo, and C. Popeea. A flow-based approach for variant parametric types. In Proceedings of Conf. on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), 2006.
[8]
F. Craciun, W.-N. Chin, G. He, and S. Qin. An interval-based inference of variant parametric types. In Proceedings of the 18th European Symposium on Programming (ESOP), 2009.
[9]
J.-M. Dautelle et al. Jscience. http://jscience.org/. Version 4.3.
[10]
E. Friedman and R. Eden. Gnu Trove: High-performance collections library for Java. http://trove4j.sourceforge.net/. Version 2.1.0.
[11]
J. Gosling, B. Joy, G. Steele, G. Bracha, and A. Buckley. The Java Language Specification. California, USA, 7th edition, 2012.
[12]
A. Igarashi, B. C. Pierce, and P.Wadler. Featherweight Java: A minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst., 23(3):396--450, 2001.
[13]
A. Igarashi and M. Viroli. Variant parametric types: A flexible subtyping scheme for generics. ACM Trans. Program. Lang. Syst., 28(5):795--847, 2006.
[14]
A. Kennedy and B. Pierce. On decidability of nominal sub-typing with variance. FOOL/WOOD, 2007.
[15]
A. Kiezun, M. D. Ernst, F. Tip, and R. M. Fuhrer. Refactoring for parameterizing Java classes. In Proceedings of the 29th International Conference on Software Engineering, 2007.
[16]
M. Odersky. The Scala Language Specification v 2.9. http://www.scala-lang.org/docu/files/ScalaReference.pdf, 2014.
[17]
A. Salcianu. Java program analysis utilities library. http://jpaul.sourceforge.net/. Version 2.5.1.
[18]
R. Tate, A. Leung, and S. Lerner. Taming wildcards in Java's type system. In Programming Language Design and Implementation (PLDI), 2011.

Cited By

View all
  • (2024)Semantic Code Refactoring for Abstract Data TypesProceedings of the ACM on Programming Languages10.1145/36328708:POPL(816-847)Online publication date: 5-Jan-2024
  • (2023)Pluggable Type Inference for Free2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)10.1109/ASE56229.2023.00186(1542-1554)Online publication date: 11-Sep-2023
  • (2021)A Systematic Literature Review on Bad Smells–5 W's: Which, When, What, Who, WhereIEEE Transactions on Software Engineering10.1109/TSE.2018.288097747:1(17-66)Online publication date: 1-Jan-2021

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
OOPSLA '14: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications
October 2014
946 pages
ISBN:9781450325851
DOI:10.1145/2660193
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 49, Issue 10
    OOPSLA '14
    October 2014
    907 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2714064
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 October 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. definition-site variance
  2. generics
  3. polymorphism
  4. refactoring
  5. use-site variance
  6. variance
  7. wildcards

Qualifiers

  • Research-article

Funding Sources

Conference

SPLASH '14
Sponsor:

Acceptance Rates

OOPSLA '14 Paper Acceptance Rate 52 of 186 submissions, 28%;
Overall Acceptance Rate 268 of 1,244 submissions, 22%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)7
  • Downloads (Last 6 weeks)2
Reflects downloads up to 08 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Semantic Code Refactoring for Abstract Data TypesProceedings of the ACM on Programming Languages10.1145/36328708:POPL(816-847)Online publication date: 5-Jan-2024
  • (2023)Pluggable Type Inference for Free2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)10.1109/ASE56229.2023.00186(1542-1554)Online publication date: 11-Sep-2023
  • (2021)A Systematic Literature Review on Bad Smells–5 W's: Which, When, What, Who, WhereIEEE Transactions on Software Engineering10.1109/TSE.2018.288097747:1(17-66)Online publication date: 1-Jan-2021

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media