Skip to content

Conversation

@GaoSSR
Copy link

@GaoSSR GaoSSR commented Dec 30, 2025

Fix typo in method name: 'textOccurencesInLog' -> 'textOccurrencesInLog'

}

public static long textOccurencesInLog(List<String> lines, String text) {
public static long textOccurrencesInLog(List<String> lines, String text) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a public method. Not sure we can just rename it. Might have to deprecate and replace depending on when it was added

@GaoSSR
Copy link
Author

GaoSSR commented Dec 31, 2025

Thanks for the feedback! You're absolutely right about API compatibility.

I'll update the PR to use the deprecate-and-replace approach:

/**
 * @deprecated Use {@link #textOccurrencesInLog(List, String)} instead
 */
@Deprecated
public static long textOccurencesInLog(List<String> lines, String text) {
    return textOccurrencesInLog(lines, text);
}

public static long textOccurrencesInLog(List<String> lines, String text) {
    return lines.stream().filter(line -> stripAnsi(line).contains(text)).count();
}

This way:

  • Existing code continues to work (backward compatible)
  • IDE will warn users to migrate to the new method
  • The old method can be safely removed in a future major version

I'll push the updated changes shortly.

- Keep the old method textOccurencesInLog with @deprecated annotation
- Add new method textOccurrencesInLog with correct spelling
- Old method delegates to new method for backward compatibility

Signed-off-by: 高春晖 <[email protected]>
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.

2 participants