Status Update
Comments
ha...@gmail.com <ha...@gmail.com> #2
See attached screen recording. Before, e.g `Timber` would get squiggly underlines, offering to import the class, but that no longer happens.
si...@gmail.com <si...@gmail.com> #3
uc...@google.com <uc...@google.com> #4
uc...@google.com <uc...@google.com> #5
ha...@gmail.com <ha...@gmail.com> #6
From the logs I see this:
2019-12-17 13:15:16,563 [ 497002] ERROR - a.highlighter.ElementAnnotator - field must not be null
java.lang.IllegalStateException: field must not be null
at com.android.tools.idea.databinding.cache.LayoutBindingShortNamesCache$3.compute(LayoutBindingShortNamesCache.kt:78)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:240)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
at com.android.tools.idea.databinding.cache.LayoutBindingShortNamesCache.getFieldsByName(LayoutBindingShortNamesCache.kt:132)
at com.intellij.psi.search.PsiShortNamesCache.processFieldsWithName(PsiShortNamesCache.java:185)
at com.intellij.psi.impl.CompositeShortNamesCache.processFieldsWithName(CompositeShortNamesCache.java:238)
at org.jetbrains.kotlin.idea.core.KotlinIndicesHelper.getFieldsByNameUnfiltered(KotlinIndicesHelper.kt:355)
at org.jetbrains.kotlin.idea.core.KotlinIndicesHelper.getJavaCallables(KotlinIndicesHelper.kt:334)
at org.jetbrains.kotlin.idea.core.KotlinIndicesHelper.processJvmCallablesByName(KotlinIndicesHelper.kt:277)
at org.jetbrains.kotlin.idea.quickfix.ImportFix.collectMemberCandidates(ImportFix.kt:331)
at org.jetbrains.kotlin.idea.quickfix.ImportFix.fillCandidates(ImportFix.kt:361)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase.collectSuggestionsForName(ImportFix.kt:166)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase.collectSuggestions(ImportFix.kt:134)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase.computeSuggestions(ImportFix.kt:81)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase$Factory.createAction(ImportFix.kt:220)
at org.jetbrains.kotlin.idea.quickfix.KotlinSingleIntentionActionFactory.doCreateActions(KotlinSingleIntentionActionFactory.kt:25)
at org.jetbrains.kotlin.idea.quickfix.KotlinIntentionActionsFactory.createActions(KotlinIntentionActionsFactory.kt:53)
at org.jetbrains.kotlin.idea.quickfix.KotlinIntentionActionsFactory.createActionsForAllProblems(KotlinIntentionActionsFactory.kt:35)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiCheckerKt.createQuickFixes(KotlinPsiChecker.kt:124)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiCheckerKt.access$createQuickFixes(KotlinPsiChecker.kt:1)
at org.jetbrains.kotlin.idea.highlighter.ElementAnnotator.setUpAnnotations(KotlinPsiChecker.kt:273)
at org.jetbrains.kotlin.idea.highlighter.ElementAnnotator.registerDiagnosticAnnotations(KotlinPsiChecker.kt:268)
at org.jetbrains.kotlin.idea.highlighter.ElementAnnotator.registerDiagnosticsAnnotations(KotlinPsiChecker.kt:199)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiChecker.annotateElement(KotlinPsiChecker.kt:95)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiChecker.annotate(KotlinPsiChecker.kt:75)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:121)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:86)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:356)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:289)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:319)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:70)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:319)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:286)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:226)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:55)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:429)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1109)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:422)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:421)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:397)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:164)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:204)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:395)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
2019-12-17 13:15:16,563 [ 497002] ERROR - a.highlighter.ElementAnnotator - Android Studio 3.6 Beta 5 Build #AI-192.6817.14.36.6018865
2019-12-17 13:15:16,563 [ 497002] ERROR - a.highlighter.ElementAnnotator - JDK: 1.8.0_212-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o
2019-12-17 13:15:16,563 [ 497002] ERROR - a.highlighter.ElementAnnotator - OS: Mac OS X
2019-12-17 13:15:16,564 [ 497003] ERROR - a.highlighter.ElementAnnotator - Last Action: EditorLeft
Which is also what I see in this issue:
da...@google.com <da...@google.com> #7
Yes, the cause of the two issues are identical, so I'll roll them into one and update the bug title.
I'm not sure how to fix this without reproducing it though. Looking at the code, it's not obvious what needs to be fixed.
da...@google.com <da...@google.com> #8
Marking as P2 for now simply because I'm not sure I can promise to fix this quickly without a repro case. But if someone can provide a repro, or if this bug gets a lot of other people commenting that they're seeing this, I'll bump it up.
da...@google.com <da...@google.com> #9
Also, I'd be interested to here if this stopped happening in 3.6 RC1, since some pretty significant cache logic was rewritten that landed in that release. Whether you are or are not seeing this in 3.6 RC1, I'd love to know either way. Thanks!
uc...@google.com <uc...@google.com>
ha...@gmail.com <ha...@gmail.com> #10
2019-12-17 20:18:11,477 [ 207386] ERROR - a.highlighter.ElementAnnotator - null
java.lang.NullPointerException
at com.android.tools.idea.databinding.cache.LayoutBindingShortNamesCache$3.compute(LayoutBindingShortNamesCache.kt:78)
at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:54)
at com.intellij.util.CachedValueBase.lambda$getValueWithLock$1(CachedValueBase.java:240)
at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:113)
at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:71)
at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:241)
at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:43)
at com.android.tools.idea.databinding.cache.LayoutBindingShortNamesCache.getFieldsByName(LayoutBindingShortNamesCache.kt:132)
at com.intellij.psi.search.PsiShortNamesCache.processFieldsWithName(PsiShortNamesCache.java:185)
at com.intellij.psi.impl.CompositeShortNamesCache.processFieldsWithName(CompositeShortNamesCache.java:238)
at org.jetbrains.kotlin.idea.core.KotlinIndicesHelper.getFieldsByNameUnfiltered(KotlinIndicesHelper.kt:355)
at org.jetbrains.kotlin.idea.core.KotlinIndicesHelper.getJavaCallables(KotlinIndicesHelper.kt:334)
at org.jetbrains.kotlin.idea.core.KotlinIndicesHelper.processJvmCallablesByName(KotlinIndicesHelper.kt:277)
at org.jetbrains.kotlin.idea.quickfix.ImportFix.collectMemberCandidates(ImportFix.kt:331)
at org.jetbrains.kotlin.idea.quickfix.ImportFix.fillCandidates(ImportFix.kt:361)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase.collectSuggestionsForName(ImportFix.kt:166)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase.collectSuggestions(ImportFix.kt:134)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase.computeSuggestions(ImportFix.kt:81)
at org.jetbrains.kotlin.idea.quickfix.ImportFixBase$Factory.createAction(ImportFix.kt:220)
at org.jetbrains.kotlin.idea.quickfix.KotlinSingleIntentionActionFactory.doCreateActions(KotlinSingleIntentionActionFactory.kt:25)
at org.jetbrains.kotlin.idea.quickfix.KotlinIntentionActionsFactory.createActions(KotlinIntentionActionsFactory.kt:53)
at org.jetbrains.kotlin.idea.quickfix.KotlinIntentionActionsFactory.createActionsForAllProblems(KotlinIntentionActionsFactory.kt:35)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiCheckerKt.createQuickFixes(KotlinPsiChecker.kt:124)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiCheckerKt.access$createQuickFixes(KotlinPsiChecker.kt:1)
at org.jetbrains.kotlin.idea.highlighter.ElementAnnotator.setUpAnnotations(KotlinPsiChecker.kt:273)
at org.jetbrains.kotlin.idea.highlighter.ElementAnnotator.registerDiagnosticAnnotations(KotlinPsiChecker.kt:268)
at org.jetbrains.kotlin.idea.highlighter.ElementAnnotator.registerDiagnosticsAnnotations(KotlinPsiChecker.kt:199)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiChecker.annotateElement(KotlinPsiChecker.kt:95)
at org.jetbrains.kotlin.idea.highlighter.KotlinPsiChecker.annotate(KotlinPsiChecker.kt:75)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.runAnnotators(DefaultHighlightVisitor.java:121)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:86)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:356)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:289)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:319)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:70)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:319)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:286)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:226)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:55)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:429)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1109)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:422)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:421)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:397)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:164)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:204)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:395)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
2019-12-17 20:18:11,478 [ 207387] ERROR - a.highlighter.ElementAnnotator - Android Studio 3.6 RC 1 Build #AI-192.7142.36.36.6071332
2019-12-17 20:18:11,478 [ 207387] ERROR - a.highlighter.ElementAnnotator - JDK: 1.8.0_212-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o
2019-12-17 20:18:11,478 [ 207387] ERROR - a.highlighter.ElementAnnotator - OS: Mac OS X
2019-12-17 20:18:11,478 [ 207387] ERROR - a.highlighter.ElementAnnotator - Last Action: ShowLog
Will let you know if we can come up with a reproducible case
da...@google.com <da...@google.com> #11
That's a bummer, but thanks for confirming it's still happening.
ha...@gmail.com <ha...@gmail.com> #12
2019-12-18 21:45:31,464 [91847373] INFO - t.javadoc.JavaDocInfoGenerator - Wrong navElement: XmlTag:ImageView; original = PsiField:clearButton of class class com.android.tools.idea.databinding.psiclass.LightBindingClass$LightDataBindingField
2019-12-18 21:45:31,557 [91847466] INFO - t.javadoc.JavaDocInfoGenerator - Wrong navElement: XmlTag:EditText; original = PsiField:searchInput of class class com.android.tools.idea.databinding.psiclass.LightBindingClass$LightDataBindingField
da...@google.com <da...@google.com> #13
That is quite possibly related.
We create an in-memory binding class (i.e. LightBindingClass), and create a handful of fields that link back to their source XML tags.
For example:
activity_demo.xml
...
<ImageView android:id="@+id/test_image">
...
would generate
class ActivityDemoBinding {
ImageView testImage;
}
What's weird is you have a field called "clearButton" linking to an ImageView tag, when I would expect a button? Can you verify that you don't have any duplicate IDs copy/pasted in your xml files?
ha...@gmail.com <ha...@gmail.com> #14
da...@google.com <da...@google.com> #15
Just pinging this bug again, in case you're back from vacation :)
Also, I have done a fair bit of work recently simplifying cache logic, but that won't land until the next 4.0 Canary 9; if you're still seeing issues in 3.6, I wonder if you'd also see them in 4.0 Canary 9 as well?
ha...@gmail.com <ha...@gmail.com> #16
Sorry for the late reply. I'll check Canary 9 and get back to you.
da...@google.com <da...@google.com> #17
Sure, thanks! Sadly I'm not sure yet when Canary 9 will land. But it would still help to follow up on
ha...@gmail.com <ha...@gmail.com> #18
Have there been any more reports about this from others? Are there any logs I can provide you with that will help identify the issue?
ha...@gmail.com <ha...@gmail.com> #19
da...@google.com <da...@google.com> #20
Can you get me a new callstack? Since the code was refactored quite a bit since this bug was first reported.
I'm not aware of other reports, but then again, that doesn't mean there aren't any. I'll see if I can search the crash reports tomorrow (I'm actually out of the office today)
da...@google.com <da...@google.com> #21
Hold on! Tracing the code today, I think I see the case which must be causing the problem.
Dev note:
LightBindingClass#createPsiField can return null if the field's type cannot be resolved LightBindingClass#computeFields returns PsiField[], which I assumed was non-null fields, but some of those fields could technically be null LightBindingShortNamesCache has this code:
fieldsByNameCache = cachedValuesManager.createCachedValue {
val allFields = ...
.groupBy { field -> field.name }
and field
can be null here.
Now that I see what's happening, let me see if I can 1) repro it and 2) figure out the right fix.
da...@google.com <da...@google.com> #22
Hans, do you have any <merge> tags with an id?
da...@google.com <da...@google.com> #23
(I may have caused an email to get sent out with an obsolete question which I've since updated, so please take a look at
I suspect the only way to get an NPE in data binding is with a merge tag that has an ID on it. If it's possible to move / remove the ID, that would likely be a workaround for this crash until I get my fix in.
da...@google.com <da...@google.com> #24
For what it's worth, this is almost certainly fixed. However, it would still be useful to confirm if you have a <merge> tag somewhere with an @id defined on it, just to verify my assumptions.
I've cherry picked this change to everywhere I could, as the fix ended up being trivial (filtering out nulls out of a list), so hopefully after the next update, you should be working again.
ha...@gmail.com <ha...@gmail.com> #25
da...@google.com <da...@google.com> #26
Phew, what an adventure :) Thanks for your patience as I chased down issues that were useful but ultimately irrelevant to this one :P
I'm guessing IDs on <merge> tags are pretty rare, which is probably why we haven't seen this but reported more, but still I'm glad it's fixed moving forward!
Description
AI-192.6817.14.36.6018865, JRE 1.8.0_212-release-1586-b4-5784211x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.15, screens 3008x1692, 1920x1200; Retina
AS: 3.6 Beta 5; Kotlin plugin: 1.3.50-release-Studio3.6-1; Android Gradle Plugin: 3.6.0-beta05; Gradle: 5.6.1; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: (not found), from PATH: (not found)Source: user_sentiment_feedback
IMPORTANT: Please read