Skip to content

Conversation

@labkey-jeckels
Copy link

Rationale

We can cleanup tens of thousands of warnings across our codebase with IntelliJ's autorefactors. In some cases, this adopts newer, leaner syntax. In others, it simply removes code that's not serving any purpose.

Related Pull Requests

Changes

  • Auto-refactors
    • Eliminate redundant toString()
    • Eliminate redundant cast
    • Empty JavaDoc annotations
    • Member variable can be final
    • length() and size() -> isEmpty()
    • Add missing @OverRide
    • Class can be static
    • Remove unused imports
    • toArray() passed array length
    • Remove unnecessary semicolon
    • Explicit type syntax can be replaced by <>
    • Redundant access modifiers
    • Remove redundant initializer
    • "".equals() -> isEmpty()
    • StringBuilder can be replaced by String
    • Fix misordered arguments to assertEquals()
    • StringUtils.defaultString() - Objects.toString()
    • Cast can be replaced with pattern variable
    • Collapse identical catch blocks
    • Type may be primitive
  • Manual fixups
    • Delete unused GWT code
    • Improve generics
    • new UnexpectedException() -> UnexpectedException.wrap()

@labkey-jeckels labkey-jeckels requested a review from a team June 8, 2025 22:09
@labkey-jeckels labkey-jeckels self-assigned this Jun 8, 2025
@labkey-jeckels labkey-jeckels requested a review from bbimber June 8, 2025 22:19
{
row = Table.insert(u, ti, row);
templateId = (Integer)row.get("rowid");
row.get("rowid");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting how it did the refactor here. Assigning a value to templateId is unnecessary, which it found. However, leaving line 139 as-is should not happen. Line 139 can be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@labkey-jeckels : do you want me to make this edit here, or will you do these on your machine?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's interesting how it did the refactor here. Assigning a value to templateId is unnecessary, which it found. However, leaving line 139 as-is should not happen. Line 139 can be removed.

It doesn't modify the right-hand side of the operation since it doesn't know if there are side-effects (in general).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the line completely. I agree with Nick's assessment of why the refactor made the edit it did. I've seen cases where it completely removed method calls that were part of unused assignment statements, but only in cases where it knew there was no side effect, like a trivial get method.

Copy link
Collaborator

@bbimber bbimber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comment about AssayHelper line 139

@labkey-jeckels labkey-jeckels requested a review from bbimber June 10, 2025 17:54
@labkey-nicka labkey-nicka removed the request for review from a team June 10, 2025 21:59
@labkey-jeckels labkey-jeckels merged commit e83144b into develop Jun 10, 2025
9 of 11 checks passed
@labkey-jeckels labkey-jeckels deleted the fb_autoRefactorCleanup branch June 10, 2025 23:36
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.

4 participants