macisamuele / language-formatters-pre-commit-hooks

Collection of custom pre-commit hooks.
Apache License 2.0
116 stars 58 forks source link

Drops Java <16 constraint from pretty_format_kotlin #123

Closed harti2006 closed 1 year ago

harti2006 commented 1 year ago

Fixes #122

codecov[bot] commented 1 year ago

Codecov Report

Merging #123 (52563e6) into master (d9072eb) will not change coverage. The diff coverage is n/a.

:exclamation: Current head 52563e6 differs from pull request most recent head cf95f11. Consider uploading reports for the commit cf95f11 to get more accurate results

@@            Coverage Diff            @@
##            master      #123   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines          305       303    -2     
=========================================
- Hits           305       303    -2     
Impacted Files Coverage Δ
...ormatters_pre_commit_hooks/pretty_format_kotlin.py 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

whiskeysierra commented 1 year ago

Test fails with:

Caused by: java.lang.reflect.InaccessibleObjectException:
Unable to make field private transient java.lang.Object
java.lang.Throwable.backtrace accessible:
module java.base does not "opens java.lang" to unnamed module @28c71909

Sounds related to:

whiskeysierra commented 1 year ago

It's probably safe to add --add-opens ... to the java process arguments.

harti2006 commented 1 year ago

Tried it like this: https://github.com/macisamuele/language-formatters-pre-commit-hooks/blob/2afa43c8506a782ced74ab39c063b862bcce46f3/language_formatters_pre_commit_hooks/pretty_format_kotlin.py#L62-L70

harti2006 commented 1 year ago

The first attempt did not work. The args were parsed by the Ktlint application, rather than the "java" command itself. Trying to move them earlier

macisamuele commented 1 year ago

Thanks for the effort on making new JDK available to the tool.

If tests are green this will be merged and within EOD I will release the new version of the pre-commit hooks.