
How to improve the efficiency and quality of software development is an ongoing concern in the field of software engineering. As a useful auxiliary function, code recommendation is embedded in almost all integrated development environments. There has been increasing interest and research in the area of code recommendation in recent years due to its convenience for project development. Existing research has made a lot of contributions to this field, but there are still many issues that need further study. One of the key points is the low success rate of recommendation. Focusing on this problem, this paper proposes a method to recommend Java source code after parsing massive amounts of source code information. We propose a new source code analysis algorithm for the scraped source code data. A source file is parsed into classes, methods, and attributes as recommendation objects. At the same time, the annotation information is bound to the annotated objects. Finally, the parsed information is indexed at the project, class, and method levels for code recommendations in a hierarchical recommendation manner. A code recommendation system is implemented by combining this with full-text retrieval technology for class library, class, and method level recommendation. The experimental results show that the method proposed in this paper has better performance in recommendation accuracy than existing code recommendation engines.