Searching for Replacement Classes

10/11/2021
by   Malavika Samak, et al.
0

Software developers must often replace existing components in their systems to adapt to evolving environments or tooling. While traditional code search systems are effective at retrieving components with related functionality, it is much more challenging to retrieve components that can be used to directly replace existing functionality, as replacements must account for more fundamental program properties such as type compatibility. To address this problem, we introduce ClassFinder, a system which given a query class Q, and a search corpus S, returns a ranked subset of classes that can replace Q and its functionality. ClassFinder produces afield and method mapping between the classes that can provide useful hints to a developer and can be used to effectively refine the ranking of candidate replacement classes. Our technique leverages the complementary strengths of a distributed embeddings-based search and type-based analysis, using the former to prune down candidates for an optimization-based approach based on the latter. ClassFinder retrieves replacement classes, along with a type-aware field/method mapping between classes. We evaluate ClassFinder on a search space of  600thousand open sourceJava classes. Querying ClassFinder with 24 known Java classes provided meaningful replacement classes and mappings, in many cases producing complete mappings with functionally identical replacement classes.

READ FULL TEXT
research
03/13/2018

Hierarchical Learning of Cross-Language Mappings through Distributed Vector Representations for Code

Translating a program written in one programming language to another can...
research
01/15/2019

Optimal Replacement Policy under Cumulative Damage Model with Strength Degradation

A machine or production system is subject to random failure and it is re...
research
06/06/2021

Clone-Seeker: Effective Code Clone Search Using Annotations

Source code search plays an important role in software development, e.g....
research
05/12/2023

Opti Code Pro: A Heuristic Search-based Approach to Code Refactoring

This paper presents an approach that evaluates best-first search methods...
research
05/10/2021

A Probabilistic Approach to Personalize Type-based Facet Ranking for POI Suggestion

Faceted Search Systems (FSS) have become one of the main search interfac...
research
06/28/2018

When Can a Distributed Ledger Replace a Trusted Third Party?

The functionality that distributed ledger technology provides, i.e., an ...
research
03/06/2019

Clear Skies Ahead: Towards Real-Time Automatic Sky Replacement in Video

Digital videos such as those captured by a smartphone often exhibit expo...

Please sign up or login with your details

Forgot password? Click here to reset