Skip to content

Clean ups#425

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

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

Conversation

@miasma

@miasma miasma commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

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

robinst commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator

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

robinst commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

@miasma ^?

@miasma

miasma commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

@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

miasma commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

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

robinst commented May 4, 2026

Copy link
Copy Markdown
Collaborator

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