Exception using external annotations on #9815

If I try to set external @NotNull annotation on method or method parameter of interface which already has been implemented by some class(-es), Idea throws an exception:

Non-physical PsiElement. Physical element is required to be able to anchor the problem in the source tree: PsiAnnotation; file: DummyHolder
java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
    at com.intellij.codeInspection.ex.ProblemDescriptorImpl.assertPhysical(ProblemDescriptorImpl.java:11)
    at com.intellij.codeInspection.ex.ProblemDescriptorImpl.<init>(ProblemDescriptorImpl.java:18)
    at com.intellij.codeInspection.ex.ProblemDescriptorImpl.<init>(ProblemDescriptorImpl.java:8)
    at com.intellij.codeInspection.ex.InspectionManagerEx.createProblemDescriptor(InspectionManagerEx.java:60)
    at com.intellij.codeInspection.ex.InspectionManagerEx.createProblemDescriptor(InspectionManagerEx.java:24)
    at com.intellij.codeInspection.ProblemsHolder.registerProblem(ProblemsHolder.java:54)
    at com.intellij.codeInspection.nullable.NullableStuffInspection.a(NullableStuffInspection.java:31)
    at com.intellij.codeInspection.nullable.NullableStuffInspection.access$000(NullableStuffInspection.java:70)
    at com.intellij.codeInspection.nullable.NullableStuffInspection$2.visitMethod(NullableStuffInspection.java:31)
    at com.intellij.psi.impl.source.PsiMethodImpl.accept(PsiMethodImpl.java:90)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$1$1.run(LocalInspectionsPass.java:7)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:13)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$1.process(LocalInspectionsPass.java:2)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$1.process(LocalInspectionsPass.java:1)
    at com.intellij.concurrency.JobUtil$1.run(JobUtil.java:44)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at com.intellij.concurrency.JobImpl.scheduleAndWaitForResults(JobImpl.java:32)
    at com.intellij.concurrency.JobUtil.invokeConcurrentlyForAll(JobUtil.java:51)
    at com.intellij.concurrency.JobUtil.invokeConcurrentlyForAll(JobUtil.java:27)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:194)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:167)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:118)
    at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:15)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:13)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1$1.run(PassExecutorService.java:2)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:343)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1.run(PassExecutorService.java:2)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:13)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:21)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)



java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
    at com.intellij.codeInspection.ProblemsHolder.registerProblem(ProblemsHolder.java:63)
    at com.intellij.codeInspection.ProblemsHolder.registerProblem(ProblemsHolder.java:54)
    at com.intellij.codeInspection.nullable.NullableStuffInspection.a(NullableStuffInspection.java:31)
    at com.intellij.codeInspection.nullable.NullableStuffInspection.access$000(NullableStuffInspection.java:70)
    at com.intellij.codeInspection.nullable.NullableStuffInspection$2.visitMethod(NullableStuffInspection.java:31)
    at com.intellij.psi.impl.source.PsiMethodImpl.accept(PsiMethodImpl.java:90)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$1$1.run(LocalInspectionsPass.java:7)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:13)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$1.process(LocalInspectionsPass.java:2)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass$1.process(LocalInspectionsPass.java:1)
    at com.intellij.concurrency.JobUtil$1.run(JobUtil.java:44)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at com.intellij.concurrency.JobImpl.scheduleAndWaitForResults(JobImpl.java:32)
    at com.intellij.concurrency.JobUtil.invokeConcurrentlyForAll(JobUtil.java:51)
    at com.intellij.concurrency.JobUtil.invokeConcurrentlyForAll(JobUtil.java:27)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:194)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.a(LocalInspectionsPass.java:167)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:118)
    at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:15)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:13)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1$1.run(PassExecutorService.java:2)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:343)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass$1.run(PassExecutorService.java:2)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:13)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:21)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)


Despite this error annotation is set correctly and works - on implementation class inspection warns that method or it's parameter is not annotated.

If I first create interface, set annotations and only then create implementation class, then everything is fine.

Please sign in to leave a comment.