# US 10,120,679 B2 · Automatic imports and dependencies in large-scale source code repositories

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,120,679 B2
- Document ID: US10120679B2
- Status: Granted
- Kind: B2
- Application number: 14/796,695
- Filed: 2015-07-10
- Published: 2017-01-12
- Granted: 2018-11-06
- Earliest claimed: 2015-07-10
- Assignees: Google Inc.
- Applicants: Google LLC
- Inventors: Carmi Grushko
- Web page: https://patentgrep.com/patent/US10120679B2

## CPC

- G06F 8/70: Software maintenance or management
- G06F 3/0482: Interaction with lists of selectable items, e.g. menus
- G06F 8/33: Intelligent editors
- G06F 16/164: {File meta data generation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method for finding candidates of qualified names for at least one simple name in a source code file are disclosed. A source code file may be received that has at least one simple name for which a corresponding qualified name is required. The source code file may be parsed to determine the simple names in the file and the qualified names in the file. For the at least one simple name for which a corresponding qualified name is required, a source code graph may be searched to find potential candidate qualified names that correspond to the at least one simple name. Upon receipt of a list of potential candidate qualified names from the source code graph, the list may be outputted to a user in order for the user to choose the appropriate qualified name. Build dependencies may also be chosen for the qualified name.

## Claims

### Claim 1

A computer-implemented method for finding candidates of qualified names for at least one simple name in a source code file to be compiled, the method comprising:
receiving a source code file to be compiled, the source code file including at least one simple name for which a corresponding qualified name is required by a compiler;
parsing the source code file to determine the at least one simple name for which a corresponding qualified name is required and qualified names in the source code file;
for the at least one simple name for which a corresponding qualified name is required, searching a source code graph to find potential candidate qualified names that correspond to the at least one simple name;
upon receipt of a list of potential candidate qualified names from the source code graph, enriching the list of potential candidate qualified names with additional information, wherein enriching the list of potential candidate qualified names includes:
determining an increase in time to build the source code that a qualified name package, corresponding to a potential candidate qualified name included in the list of potential candidate qualified names, adds to a build process;
responsive to determining that the increase in time to build the source code does not exceed a threshold value, adding the qualified name package's name to the list of potential candidate qualified names;
outputting the list;
determining build dependencies and build targets for specific qualified names once a qualified name is chosen from the list of potential candidate qualified names; and
compiling the source code based on the determined build dependencies and build targets.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein enriching the list includes:
enriching the list to include a number of times a potential candidate qualified name of a particular type has been used by other source code files prior to outputting the list.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein enriching the list includes:
ranking the list based on a frequency in which a particular potential candidate qualified name has been used in other parts of a source code repository.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, further comprising:
automatically choosing the qualified name without user interaction if the list only contains one potential qualified name.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, further comprising:
providing an interface to receive a choice of a qualified name from the list of potential candidate qualified names.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein enriching the list includes:
determining whether the qualified name package is visible from the source code file in which a simple name potentially corresponding to the qualified name package is currently being referenced; and
responsive to determining that the qualified name package is visible from the source code file, providing the qualified name package's name as a potential candidate qualified name.

### Claim 7

A system for finding candidates of qualified names for at least one simple name in a source code file to be compiled, the system comprising:
one or more processing devices and
one or more storage devices storing instructions that, when executed by the one or more processing devices, cause the one or more processing devices to:
receive a source code file to be compiled, the source code file including at least one simple name for which a corresponding qualified name is required by a compiler;
parse the source code file to determine the at least one simple name for which a corresponding qualified name is required and qualified names in the source code file;
for the at least one simple name for which a corresponding qualified name is required, searching a source code graph to find potential qualified names that correspond to the at least one simple name;
upon receipt of a list of potential candidate qualified names from the source code graph, enriching the list of potential candidate qualified names with additional information, wherein enriching the list of potential candidate qualified names includes:
determining an increase in time to build the source code that a qualified name package, corresponding to a potential candidate qualified name included in the list of potential candidate qualified names, adds to a build process;
responsive to determining that the increase in time to build the source code does not exceed a threshold value, adding the qualified name package's name to the list of potential candidate qualified names;
outputting the list;
determining build dependencies and build targets for specific qualified names once a qualified name is chosen from the list of potential candidate qualified names; and
compiling the source code based on the determined build dependencies and build targets.

### Claim 8 (depends on 7)

The system of claim 7, wherein enriching the list includes:
enriching the list to include a number of times a potential candidate qualified name of a particular type has been used by other source code files prior to outputting the list.

### Claim 9 (depends on 7)

The system of claim 7, wherein enriching the list includes:
ranking the list based on a frequency in which a particular potential candidate qualified name has been used in other parts of a source code repository.

### Claim 10 (depends on 7)

The system of claim 7, further comprising:
automatically choosing the qualified name without user interaction if the list only contains one potential qualified name.

### Claim 11 (depends on 7)

The system of claim 7, further comprising:
providing an interface to receive a choice of a qualified name from the list of potential candidate qualified names.

### Claim 12 (depends on 7)

The system of claim 7, wherein enriching the list includes:
determining whether the qualified name package is visible from the source code file in which a simple name potentially corresponding to the qualified name package is currently being referenced; and
responsive to determining that the qualified name package is visible from the source code file, providing the qualified name package's name as a potential candidate qualified name.
