ocpsoft / prettytime

Social Style Date and Time Formatting for Java
http://ocpsoft.org/prettytime/
Apache License 2.0
1.29k stars 252 forks source link

Japanese and Finnish locales and proguard #265

Closed Rexee closed 3 months ago

Rexee commented 10 months ago

These 2 locales "org.ocpsoft.prettytime.i18n.Resources_fi" and "org.ocpsoft.prettytime.i18n.Resources_ja" use reflection to get unit names:

 private String getUnitName(TimeUnit unit)
      {
         return unit.getClass().getSimpleName();
      }

As result, if we use Proguard, then there will be crashes because Proguard will obfuscate names of these classes. There is 2 possible solutions:

I think Solution 1 is more correct, but Solution 2 is more easy

lincolnthree commented 6 months ago

I agree. These should be re-written. Feel like sending a PR? Thanks for the issue and sorry for the delay!

matteinn commented 3 months ago

I confirm solution 2 works fine as a workaround

lincolnthree commented 3 months ago

Hey @matteinn Thanks for your solution! I will add this to the ProGuard file: https://github.com/ocpsoft/prettytime/blob/master/core/src/main/resources/META-INF/proguard/prettytime.pro