Status Update
Comments
al...@google.com <al...@google.com> #2
Hi,
I also see my text cut off when I set maxLines = 2
. Is it the same issue?
Box(
modifier =
Modifier.size(
width = 108dp,
height = 34dp,
),
contentAlignment = Alignment.Center,
) {
BasicText(
text = "text text text",
maxLines = 2,
autoSize = AutoSize.StepBased(minFontSize = 1.sp, maxFontSize = 13.sp, stepSize = 0.2.sp),
)
}
tn...@google.com <tn...@google.com> #5
Thanks @jossiwolf@google.com for fixing this! Do you know when the fix would be available for g3 apps?
al...@google.com <al...@google.com> #6
Moving the internal discussion offline. The bug is fixed and the fix available in snapshot builds. We will comment on this issue when the bug fix is included in a release.
tn...@google.com <tn...@google.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.8.0-beta01
androidx.compose.foundation:foundation-android:1.8.0-beta01
androidx.compose.foundation:foundation-jvmstubs:1.8.0-beta01
androidx.compose.foundation:foundation-linuxx64stubs:1.8.0-beta01
au...@google.com <au...@google.com> #9
al...@google.com <al...@google.com> #10
Reverting CL that re-enabled the test.
pa...@google.com <pa...@google.com> #11
I am not sure how things have changed exactly since this was reported, but as of a recent androidx-main sync (a few hours ago): the DEFAULT test mode is reporting 8 errors, while the PARTIAL test mode is reporting 5 errors. Restricting the sample code to just the first error that is missed in PARTIAL mode, I can see that here:
BanInappropriateExperimentalUsage.kt:
// If we find an usage of an experimentally-declared annotation, check it.
private fun inspectAnnotation(annotation: UElement?, node: UAnnotation) {
if (annotation is UAnnotated) {
val annotations = context.evaluator.getAllAnnotations(annotation, false)
if (annotations.any { APPLICABLE_ANNOTATIONS.contains(it.qualifiedName) }) {
...
The annotations
list is correct, except the first annotation is not full qualified (when printed), and it.qualifiedName
is no longer fully qualified.
0 = {JavaUAnnotation@12426} @RequiresOptIn <-------------
1 = {JavaUAnnotation@12433} @java.lang.annotation.Retention(null = CLASS)
2 = {JavaUAnnotation@12434} @java.lang.annotation.Target(null = <noref>(ElementType.TYPE, ElementType.METHOD))
Digging into why, I end up here:
PsiJavaCodeReferenceElementImpl.java:
@NotNull
private String getCanonicalText(boolean annotated, PsiAnnotation @Nullable [] annotations, @NotNull PsiFile containingFile) {
Kind kind = getKindEnum(containingFile);
switch (kind) {
case CLASS_NAME_KIND:
case CLASS_OR_PACKAGE_NAME_KIND:
case CLASS_IN_QUALIFIED_NEW_KIND:
JavaResolveResult[] results = PsiImplUtil.multiResolveImpl(containingFile.getProject(), containingFile, this, false, OurGenericsResolver.INSTANCE);
PsiElement target = results.length == 1 ? results[0].getElement() : null;
The call to PsiImplUtil.multiResolveImpl
returns 1 element for DEFAULT, but 0 elements for PARTIAL.
Still trying to understand why.
pa...@google.com <pa...@google.com>
pa...@google.com <pa...@google.com> #12
It seems that, in unit tests, it is not possible to resolve Kotlin source elements from dependencies (when there are multiple modules (projects) defined in the unit test). This seems quite surprising, but I suppose (a) there aren't that many unit tests that use multiple modules; (b) the main/root module in the test doesn't usually need to import elements from dependencies, or the elements are written in Java.
In the Test cross-module Experimental usage via Gradle model
test, the consumer
module refers to RequiresAndroidXOptInSampleAnnotationJava
in the provider
module (which is fine, because the class is Java), but this annotation is in turn annotated with androidx.annotation.RequiresOptIn
, which cannot be resolved from the consumer
module. As it happens, the ResolveChecker
does not run on RequiresAndroidXOptInSampleAnnotationJava
when analyzing the consumer
module (because it is not part of the current module being analyzed), so there are no errors on the import statement. The RequiresOptIn
annotation is found correctly within context.evaluator.getAllAnnotations
for TestMode.DEFAULT
because (I think) the UastEnvironment
is re-used from when the provider
module was analyzed. But for TestMode.PARTIAL
, a fresh UastEnvironment
is created when analyzing each module, and only the Kotlin source files from the current module are visible.
I have a fix here: ag/24969948
I think this should allow the test Test cross-module Experimental usage via Gradle model
to pass under all test modes (not just TestMode.DEFAULT
), although I am not sure how to check this.
pa...@google.com <pa...@google.com> #13
I have just tested this (using what is probably a very hacky method to use my local dev build of AGP and lint), and the test now passes in all modes.
pa...@google.com <pa...@google.com>
an...@google.com <an...@google.com> #14
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 Iguana | 2023.2.1 Canary 9
- Android Gradle Plugin 8.3.0-alpha09
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!
Description
Jetpack uses a lint check to prevent cross-group usage of the
@RequiresOptIn
annotation. The implementation is similar to@RestrictToDetector
's enforcement ofLIBRARY_GROUP
, but our check fails provisional checks on alternating runs even though they seem to be reporting as expected.We've logged some data to figure out what's going on when using
./gradlew :lint-checks:test --rerun-tasks
.For a failing run, we see:
The next run, however, passes:
The next run fails, and so on.