Skip to content

Conversation

@labkey-jeckels
Copy link
Contributor

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 self-assigned this Jun 8, 2025
labkey-danield
labkey-danield previously approved these changes Jun 11, 2025
// msg.append("There are no missing files");

return new HtmlView(msg.toString());
return new HtmlView(msg);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is msg ever set to a value? It looks like the code that did set it has been commented out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, nor has it been in a long time (if ever). I simplified the code a bit more.

Comment on lines 42 to 44
String sb = safeAppend(rs, "Remark", "remark") +
safeAppend(rs, "Entered by", "performedby");
return sb;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not an ask for a change, just a comment.

I guess IntelliJ could have said:

return safeAppend(rs, "Remark", "remark") +
                safeAppend(rs, "Entered by", "performedby");

And pointed out the Container c & boolean redacted are unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I simplified to the return. Those two arguments are part of the method on the interface so IntelliJ doesn't complain about them being unused here.

for (Ext4FieldRef field : _ext4Helper.componentQuery("field[fieldName='exclude']", Ext4FieldRef.class))
{
Assert.assertEquals(field.getValue(), true);
Assert.assertEquals(true, field.getValue());
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe Assert.assertTrue?
Just another comment on IntelliJ choices.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

field.getValue() returns Object so IntelliJ doesn't try to simplify the assert

labkey-danield
labkey-danield previously approved these changes Jun 11, 2025
Ohsudev
Ohsudev previously approved these changes Jun 11, 2025
@labkey-nicka labkey-nicka removed the request for review from a team June 11, 2025 19:14
# Conflicts:
#	onprc_ehr/src/org/labkey/onprc_ehr/ONPRC_EHRController.java
@labkey-jeckels labkey-jeckels merged commit 50ba9c0 into develop Jun 11, 2025
7 checks passed
@labkey-jeckels labkey-jeckels deleted the fb_autoRefactorCleanup branch June 11, 2025 21:33
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