Skip to content

Dead code refactor: Removed depreccated code from Table.java#668

Open
asshifasultana wants to merge 3 commits into
mabe02:masterfrom
asshifasultana:dead-code
Open

Dead code refactor: Removed depreccated code from Table.java#668
asshifasultana wants to merge 3 commits into
mabe02:masterfrom
asshifasultana:dead-code

Conversation

@asshifasultana

Copy link
Copy Markdown

4.1.8 Dead Code – Deprecated API Removal

File:
src/main/java/com/googlecode/lanterna/gui2/table/Table.java

Severity:
Low

Description

The Table class contains two public methods, getViewTopRow() and setViewTopRow(int), that are marked as @Deprecated. These methods are no longer maintained and simply act as wrappers around newer APIs that provide the same functionality.

Why It Is Problematic

Deprecated methods increase the public API surface and contribute to technical debt. Maintaining legacy wrapper methods makes the codebase harder to understand and increases maintenance effort. Since modern replacement methods already exist, keeping the deprecated methods provides little value while increasing the risk of future compatibility issues.

Evidence

The methods getViewTopRow() and setViewTopRow(int) are annotated with @Deprecated in Table.java. The class already provides the recommended replacement methods:

  • getViewTopRow()getFirstViewedRowIndex()
  • setViewTopRow(int)getRenderer().setViewTopRow(int)

A project-wide search shows no internal usages of these deprecated methods outside Table.java, indicating that they are effectively unused within the codebase.

Recommended Improvement

Remove the deprecated wrapper methods from Table.java and update any remaining external code to use the modern APIs:

  • Replace getViewTopRow() with getFirstViewedRowIndex().
  • Replace setViewTopRow(int) with getRenderer().setViewTopRow(int).

If these methods are removed in a future release, the API change should be documented in the project's changelog.

@asshifasultana

Copy link
Copy Markdown
Author

It's a humble request to review the PR as soon as possible. It's a project based task given by the faculty and I have to make reports depending on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant