Status Update
Comments
ah...@gmail.com <ah...@gmail.com> #2
ra...@google.com <ra...@google.com>
tn...@google.com <tn...@google.com> #3
The first violation is for return DateTimeFormatterBuilder()
.
The call here is to java.time.format.DateTimeFormatterBuilder
with method signature "<init>()".
However, that method is not in the desugared method list from R8; in my case, here's where Gradle cached it:
/Users/tnorbye/.gradle/caches/8.8/transforms/1dbdb8cc436a8948e5f5b4d5de34b130/transformed/desugar_jdk_libs_configuration-2.0.4-desugar-lint.txt
$ grep DateTimeFormatterBuild /Users/tnorbye/.gradle/caches/8.8/transforms/1dbdb8cc436a8948e5f5b4d5de34b130/transformed/desugar_jdk_libs_configuration-2.0.4-desugar-lint.txt | grep init
$ grep DateTimeFormatterBuild /Users/tnorbye/.gradle/caches/8.8/transforms/1dbdb8cc436a8948e5f5b4d5de34b130/transformed/desugar_jdk_libs_configuration-2.0.4-desugar-lint.txt
java/time/format/DateTimeFormatterBuilder#append(Ljava/time/format/DateTimeFormatter;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendChronologyId()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendChronologyText(Ljava/time/format/TextStyle;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendFraction(Ljava/time/temporal/TemporalField;IIZ)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendInstant()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendInstant(I)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendLiteral(C)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendLiteral(Ljava/lang/String;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendLocalized(Ljava/time/format/FormatStyle;Ljava/time/format/FormatStyle;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendLocalizedOffset(Ljava/time/format/TextStyle;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendOffset(Ljava/lang/String;Ljava/lang/String;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendOffsetId()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendOptional(Ljava/time/format/DateTimeFormatter;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendPattern(Ljava/lang/String;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendText(Ljava/time/temporal/TemporalField;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendText(Ljava/time/temporal/TemporalField;Ljava/time/format/TextStyle;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendText(Ljava/time/temporal/TemporalField;Ljava/util/Map;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendValue(Ljava/time/temporal/TemporalField;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendValue(Ljava/time/temporal/TemporalField;I)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendValue(Ljava/time/temporal/TemporalField;IILjava/time/format/SignStyle;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendValueReduced(Ljava/time/temporal/TemporalField;III)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendValueReduced(Ljava/time/temporal/TemporalField;IILjava/time/chrono/ChronoLocalDate;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendZoneId()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendZoneOrOffsetId()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendZoneRegionId()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendZoneText(Ljava/time/format/TextStyle;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#appendZoneText(Ljava/time/format/TextStyle;Ljava/util/Set;)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#getLocalizedDateTimePattern(Ljava/time/format/FormatStyle;Ljava/time/format/FormatStyle;Ljava/time/chrono/Chronology;Ljava/util/Locale;)Ljava/lang/String;
java/time/format/DateTimeFormatterBuilder#optionalEnd()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#optionalStart()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#padNext(I)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#padNext(IC)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#parseCaseInsensitive()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#parseCaseSensitive()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#parseDefaulting(Ljava/time/temporal/TemporalField;J)Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#parseLenient()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#parseStrict()Ljava/time/format/DateTimeFormatterBuilder;
java/time/format/DateTimeFormatterBuilder#toFormatter()Ljava/time/format/DateTimeFormatter;
java/time/format/DateTimeFormatterBuilder#toFormatter(Ljava/util/Locale;)Ljava/time/format/DateTimeFormatter;
tn...@google.com <tn...@google.com> #4
(It looks like the method call does get desugared so I'm assuming this is a bug in the method list generator.)
sg...@google.com <sg...@google.com> #5
I am surprised that the reporter see this working with AGP 8.4.2. As far as I can see the desugared method list has never explicitly included constructors. For classes where all methods are supported the the lint file only contains the descriptor for the class, so there constructors are implicitly included. However, for DateTimeFormatterBuilder
we do not support all methods, as a few was added in API level 34, resulting in the list shown above.
At the moment the information provided to lint is bundled in the desugared library artifact (e.g.
We should start generating constructors into the lint information.
dr...@gmail.com <dr...@gmail.com> #6
I have confirmed that APIs are not flagged with AGP 8.4.2 by checking out the main branch of the ./gradlew build
.
tn...@google.com <tn...@google.com> #7
I've added two additional fixes for this in lint, in
(1) For now, if a class is partially desugared (e.g. the whole class isn't listed, but some methods in the class are listed), then we assume that all the constructors have been constructed. This is a stopgap until the descriptor files themselves include constructors (and the versions of the desugaring libraries are widely used, since lint picks up these from the user projects, it's not baked into lint).
(2) Lint has extra checks around casts; similarly to (1) lint will skip cast warnings for any classes that are partially desugared.
mt...@gmail.com <mt...@gmail.com> #8
Is there any way to use a lint version where this fix is included? It does not seem to be included into AGP 8.6.0-beta01.
mt...@gmail.com <mt...@gmail.com> #9
Also failing with AGP 8.5.1.
an...@google.com <an...@google.com> #10
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Ladybug | 2024.1.3 Canary 1
- Android Gradle Plugin 8.7.0-alpha01
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
ju...@cfacorp.com <ju...@cfacorp.com> #11
We can't upgrade AGP and are stuck on 8.4.1. It would be less than ideal to disable the check entirely. Is there any chance this makes it into an 8.6 patch as suggested in
Description
Upon updating from AGP 8.4.2 to 8.5.0, lint is incorrectly flagging some
java.time
APIs as unusable. They are usable because core library desugaring is applied, and compiling and running the code works as expected.In the full report,
IsoChronology.INSTANCE
is also flagged. Otherjava.time
APIs, such asDateTimeFormatter.ofLocalizedTime
, are not flagged.This is not a security issue.