Skip to content

[maven-4.0.x] InputLocation.merge() always loses line/column information #12610

Description

@elharo

InputLocation.merge() always loses line/column information

Found in: maven-4.0.x branch
File: api/maven-api-model/src/main/java/org/apache/maven/api/model/InputLocation.java (method merge(), lines ~215-240)
Severity: Low

Description

The merge() result always has lineNumber = -1 and columnNumber = -1, discarding the original location information from both target and source:

return InputLocation.of(-1, -1, InputSource.merge(source.getSource(), target.getSource()), locations);

While merging line numbers from two different source files is inherently ambiguous, there is no fallback to preserve at least one of the original locations. If source or target has valid line/column data, that information is lost, degrading the quality of error reporting for merged models.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority:minorMinor loss of function, or other problem where easy workaround is present

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions