Skip to content

[Bug]: Broken Incremental Index #6

@amishra-u

Description

@amishra-u

What happened?

Currently, incremental index doesn't work for few cases correctly

Files with lombok usage

Problem

When developers update any file that references another java file using Lombok annotations, the current logic fails to correctly generate SCIP indexes for those referenced files. This happens because the Java compiler, during incremental indexing, does not run annotation processors on referenced files. Consequently, Lombok annotations in referenced files aren't processed, leading to errors where generated fields and methods are not recognized.

Current Solution

The current solution attempts to "trick" the compiler by using older, "future-dated" class files (timestamped 2033) generated during the initial full index for Lombok-dependent classes. These class files are extracted into a separate JAR. This ensures the compiler always uses these older versions, even when new ones are generated.

However, this workaround introduces another set of problems:
Stale Code: Any new types, fields, or methods added to Lombok-dependent classes are never visible to other classes because the compiler consistently uses the outdated, future-dated class files.
Limited Scope: If an existing class (without previous Lombok usage) introduces Lombok, it won't be included in this special handling, effectively bringing us back to square one for that file.

Solution

Instead of passing all source files from the target as src_path, pass only the files that actually need recompilation. This eliminates the need for the Lombok hacks entirely.

Changes in mutliple targets

Problem

When developers make changes in multiple targets, the incremental index misses updates. For example, while indexing a source file in Target A, the process only includes the JAR from Target B generated during the last full sync. Consequently, incremental indexing ignores recent changes from other targets.

Solution

Similar to the Lombok fix: in src_path, include only the changed source files since the last full sync, regardless of which target they belong to.

Steps to Reproduce

Add a new method or field to any java file with lombok usage and then try to use it another file, cursor will not identify.

Same for cross targets, add new method or field to any java class in target 1 and try to use in target 2 cursor will not idenitfy.

Environment

Not OS dependent

Language Server Logs

SCIP Generation Logs

SCIP Index Information

Reproducible Sample

No response

Additional Context

No response

Code of Conduct

  • I agree to follow this project's contribution guidelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions