一句话:提出 HECS,用类内依赖超图与超图神经网络结合大模型,更准确地检测抽取类重构机会。
抽取类重构是改善大类设计的重要手段,但传统检测工具通常基于类内元素间一对一的直接依赖图,难以刻画真实代码中的一对多依赖,导致重构建议的准确性与相关性不足。本文提出 HECS,一种基于超图学习的抽取类重构机会检测工具:针对每个目标类构建类内依赖超图以建模多元关系,利用预训练代码模型为节点赋予属性,并训练增强的超图神经网络;同时结合大语言模型将预测结果转化为可落地的重构建议。在大规模数据集与真实世界数据集上的评估表明,与 JDeodorant、SSECS 和 LLMRefactor 相比,HECS 的精确率提升 38.5%、召回率提升 9.7%、F1 提升 44.4%,验证了超图建模对重构机会检测的有效性。
HECS is an advanced tool designed for Extract Class refactoring by leveraging hypergraph learning to model complex dependencies within large classes. Unlike traditional tools that rely on direct one-to-one dependency graphs, HECS uses intra-class dependency hypergraphs to capture one-to-many relationships. This allows HECS to provide more accurate and relevant refactoring suggestions. The tool constructs hypergraphs for each target class, attributes nodes using a pre-trained code model, and trains an enhanced hypergraph neural network. Coupled with a large language model, HECS delivers practical refactoring suggestions. In evaluations on large-scale and real-world datasets, HECS achieved a 38.5% increase in precision, 9.7% in recall, and 44.4% in f1-measure compared to JDeodorant, SSECS, and LLMRefactor. These improvements make HECS a valuable tool for developers, offering practical insights and enhancing existing refactoring techniques.
DOI 原文 ·
@inproceedings{paperbot8516,
title = {HECS: A Hypergraph Learning-Based System for Detecting Extract Class Refactoring Opportunities},
author = {Luqiao Wang and Qiangqiang Wang and Jiaqi Wang and Yutong Zhao and Minjie Wei and Zhou Quan and Di Cui and Qingshan Li},
booktitle = {ISSTA},
year = {2024},
doi = {10.1145/3650212.3685307}
}