Skip to content

Clean ups#425

Merged
robinst merged 12 commits intocommonmark:mainfrom
miasma:clean-ups
May 4, 2026
Merged

Clean ups#425
robinst merged 12 commits intocommonmark:mainfrom
miasma:clean-ups

Conversation

@miasma
Copy link
Copy Markdown
Contributor

@miasma miasma commented Apr 1, 2026

I've analyzed the code with IntelliJ's inspections and applied a couple of common refactorings.

  • redundant overrides add bloat and don't have any functional effect
  • redundant variable is used as return value and can be inlined
  • redundant label does not improve readability when there is only one label
  • nested classes with static operate more efficiently
  • method references are potentially more efficient and more readable than anonymous classes
  • refactored API calls document the intent better (and can be used since the pom.xml defaults to jdk11)
  • redundant imports slow down build process

@robinst
Copy link
Copy Markdown
Collaborator

robinst commented Apr 10, 2026

Hey! Thanks for raising this. It currently doesn't pass the Android compat build:

/home/runner/work/commonmark-java/commonmark-java/commonmark/src/main/java/org/commonmark/internal/LinkReferenceDefinitionParser.java:106: error: cannot find symbol
> Task :app:compileDebugJavaWithJavac
        var removedSpans = List.copyOf(sourceSpans.subList(Math.max(sourceSpans.size() - lines, 0), sourceSpans.size()));
                               ^
  symbol:   method copyOf(List<SourceSpan>)
  location: interface List

Can you undo that particular change?

@robinst
Copy link
Copy Markdown
Collaborator

robinst commented Apr 23, 2026

@miasma ^?

@miasma
Copy link
Copy Markdown
Contributor Author

miasma commented Apr 24, 2026

@robinst Hi, sorry, was a bit busy for the last 2 weeks. I updated the branch and deleted that problematic commit. I wasn't sure which API level of Android is supported so it's maybe better to leave out those API changes for now.

@miasma
Copy link
Copy Markdown
Contributor Author

miasma commented Apr 29, 2026

I don't think I have any additions to this anymore.

@robinst robinst merged commit 37df896 into commonmark:main May 4, 2026
6 checks passed
@robinst
Copy link
Copy Markdown
Collaborator

robinst commented May 4, 2026

Thanks! Merged.

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