Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format and Clean up Java source code as defined in ADR-029 #557

Merged
merged 1 commit into from
Dec 31, 2024

Conversation

ivy-cst
Copy link
Member

@ivy-cst ivy-cst commented Dec 31, 2024

Done by Eclipse's 'Source Clean Up' function with the options enabled:

  • Change non static accesses to static members using declaring type
  • Change indirect accesses to static members to direct accesses (accesses through subtypes)
  • Convert control statement bodies to block
  • Convert to enhanced 'for' loops only if the loop variable is used
  • Convert to enhanced 'for' loops
  • Convert if/else if/else chain to switch
  • Add elements in collections without loop
  • Add final modifier to private fields
  • Use instanceof keyword instead of Class.isInstance()
  • Exit loop earlier
  • Make inner classes static where possible
  • Convert StringBuffer to StringBuilder for local variables
  • Use String.replace() instead of String.replaceAll() when possible
  • String.isBlank() rather than String.strip().isEmpty()
  • Use lazy logical operator (&& and ||)
  • Primitive comparison
  • Primitive parsing
  • Primitive serialization
  • Use boolean literals instead of Boolean.TRUE/FALSE when used as a primitive
  • Remove unused imports
  • Add missing '@OverRide' annotations
  • Add missing '@OverRide' annotations to implementations of interface methods
  • Add missing '@deprecated' annotations
  • Remove unnecessary casts
  • Remove redundant modifiers
  • Remove redundant semicolons
  • Implicit comparator
  • Remove unnecessary array creation for varargs
  • Create array with curly
  • Remove variable assignment before return
  • Convert loop into if
  • Remove unnecessary '$NON-NLS$' tags
  • Organize imports
  • Format source code
  • Remove trailing white spaces on all lines
  • Remove redundant String.substring() parameter
  • Use Arrays.fill() when possible
  • Remove overridden assignment
  • Remove redundant super() call in constructor
  • Remove unreachable block
  • Operate on Maps directly
  • Initialize collection at creation
  • Initialize map at creation
  • Avoid Object.equals() or String.equalsIgnoreCase() on null objects
  • Compare to zero
  • Pull out a duplicate 'if' from an if/else
  • Use pattern matching for instanceof
  • Convert to switch expression where possible
  • Simplify lambda expression and method reference syntax
  • Use Comparator.comparing()
  • Use String.join()
  • Use diamond operator

Done by Eclipse's 'Source Clean Up' function with the options enabled:
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses
(accesses through subtypes)
- Convert control statement bodies to block
- Convert to enhanced 'for' loops only if the loop variable is used
- Convert to enhanced 'for' loops
- Convert if/else if/else chain to switch
- Add elements in collections without loop
- Add final modifier to private fields
- Use instanceof keyword instead of Class.isInstance()
- Exit loop earlier
- Make inner classes static where possible
- Convert StringBuffer to StringBuilder for local variables
- Use String.replace() instead of String.replaceAll() when possible
- String.isBlank() rather than String.strip().isEmpty()
- Use lazy logical operator (&& and ||)
- Primitive comparison
- Primitive parsing
- Primitive serialization
- Use boolean literals instead of Boolean.TRUE/FALSE when used as a
primitive
- Remove unused imports
- Add missing '@OverRide' annotations
- Add missing '@OverRide' annotations to implementations of interface
methods
- Add missing '@deprecated' annotations
- Remove unnecessary casts
- Remove redundant modifiers
- Remove redundant semicolons
- Implicit comparator
- Remove unnecessary array creation for varargs
- Create array with curly
- Remove variable assignment before return
- Convert loop into if
- Remove unnecessary '$NON-NLS$' tags
- Organize imports
- Format source code
- Remove trailing white spaces on all lines
- Remove redundant String.substring() parameter
- Use Arrays.fill() when possible
- Remove overridden assignment
- Remove redundant super() call in constructor
- Remove unreachable block
- Operate on Maps directly
- Initialize collection at creation
- Initialize map at creation
- Avoid Object.equals() or String.equalsIgnoreCase() on null objects
- Compare to zero
- Pull out a duplicate 'if' from an if/else
- Use pattern matching for instanceof
- Convert to switch expression where possible
- Simplify lambda expression and method reference syntax
- Use Comparator.comparing()
- Use String.join()
- Use diamond operator
@ivy-cst
Copy link
Member Author

ivy-cst commented Dec 31, 2024

#556

@ivy-cst ivy-cst merged commit ad7ab60 into release/12.0 Dec 31, 2024
9 checks passed
@ivy-cst ivy-cst deleted the format branch December 31, 2024 14:52
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