Skip to content
Commit 2427d36d authored by Joachim Sauer's avatar Joachim Sauer
Browse files

Remove use of MeasureUnit.internalGetInstance

MeasureUnit.internalGetUnit() is a method on ICU MeasureUnit which is
used to construct and register MeasureUnits. Calling it from non-ICU
code makes future calls to MeasureUnit.getAvailable(type) return the
newly-created MeasureUnit, but that MeasureUnit will not be fully
supported by ICU (no translations, ...).

This code creates a MeasureUnit by calling a constructor reflectively to
avoid the registration, which is a workaround.

The correct long-term fix is for ICU/CLDR to support petabyte correctly
(http://bugs.icu-project.org/trac/ticket/13355) and for us to just use
that instead.

Bug: 65632959
Test: bit CtsIcuTestCases:android.icu.dev.test.format.MeasureUnitTest
Test: coretests android.text.format.FormatterTest

(cherry picked from commit aa5629e6)

Change-Id: If18dd378668a59a700030856573e46917a1bd051
parent 7a09f7ec
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment