Skip to content

Extend ParameterInCallable class to capture Line and Column offsets. #103

@rahlk

Description

@rahlk

Is your feature request related to a problem? Please describe

Need to capture source code position information (line/column) for parameters in method declarations to enable precise source code navigation and analysis.

Describe the solution you'd like

Add position tracking fields to ParameterInCallable class:

  • startLine: Starting line number
  • endLine: Ending line number
  • startCol: Starting column number
  • endCol: Ending column number

Current implementation:

@Data
public class ParameterInCallable {
    private String type;
    private String name;
    private List<String> annotations;
    private List<String> modifiers;
}

Proposed implementation:

@Data
public class ParameterInCallable {
    private String type;
    private String name;
    private List<String> annotations;
    private List<String> modifiers;
    private int startLine;
    private int endLine;
    private int startCol;
    private int endCol;
}

// Usage in parameter processing:
private static ParameterInCallable processParameterDeclaration(Parameter paramDecl) {
    ParameterInCallable parameter = new ParameterInCallable();
    
    paramDecl.getBegin().ifPresent(position -> {
        parameter.setStartLine(position.line);
        parameter.setStartCol(position.column);
    });

    paramDecl.getEnd().ifPresent(position -> {
        parameter.setEndLine(position.line);
        parameter.setEndCol(position.column);
    });
    
    // ... rest of processing
    return parameter;
}

Describe alternatives you've considered

  1. Store positions as a separate object/map
  2. Track only line numbers without columns
  3. Track only start positions without end positions

Direct field storage in ParameterInCallable provides the clearest and most maintainable solution that can be consumed by CLDK downstream.

Additional context

Implementation requires minor changes:

  1. Add position fields to ParameterInCallable class
  2. Update processParameterDeclaration to populate positions from JavaParser Position objects
  3. Update related tests

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions