mplushnikov / lombok-intellij-plugin

Lombok Plugin for IntelliJ IDEA
Apache License 2.0
3.11k stars 635 forks source link

NullPointerException on AccessLevel enum when IDE window open #613

Closed jaquessmith closed 5 years ago

jaquessmith commented 5 years ago

Short description

Every time I start Intellij this exception occur. Seam to be only once.

Expected behavior

Should not happen

Version information

IntelliJ IDEA 2019.1 (Ultimate Edition) Build #IU-191.6183.87, built on March 27, 2019 JRE: 1.8.0_202-release-1483-b39 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.14.3 Lombok Plugin Version: v0.24-2018.3 Lombok Dependency Version: 1.18.6

Steps to reproduce

  1. Start the ide with a project with lombok

Sample project

You can just create the default spring base with Lombok added File > New > Project > Spring Initializr (add Lombok)

Additional information

It happens when you start the ide or open a new window

Stacktrace

provider: de.plushnikov.intellij.plugin.provider.LombokAugmentProvider@87c69a3

java.lang.NullPointerException: Name is null
    at java.lang.Enum.valueOf(Enum.java:236)
    at lombok.AccessLevel.valueOf(AccessLevel.java:27)
    at de.plushnikov.intellij.plugin.processor.modifier.FieldDefaultsModifierProcessor.detectDefaultAccessLevel(FieldDefaultsModifierProcessor.java:133)
    at de.plushnikov.intellij.plugin.processor.modifier.FieldDefaultsModifierProcessor.transformModifiers(FieldDefaultsModifierProcessor.java:77)
    at de.plushnikov.intellij.plugin.provider.LombokAugmentProvider.transformModifiers(LombokAugmentProvider.java:64)
    at com.intellij.psi.augment.PsiAugmentProvider.lambda$transformModifierProperties$2(PsiAugmentProvider.java:114)
    at com.intellij.psi.augment.PsiAugmentProvider.forEach(PsiAugmentProvider.java:126)
    at com.intellij.psi.augment.PsiAugmentProvider.transformModifierProperties(PsiAugmentProvider.java:113)
    at com.intellij.psi.impl.source.PsiModifierListImpl.calcModifiers(PsiModifierListImpl.java:97)
    at com.intellij.psi.impl.source.PsiModifierListImpl.hasModifierProperty(PsiModifierListImpl.java:85)
    at com.intellij.psi.scope.util.PsiScopesUtil.treeWalkUp(PsiScopesUtil.java:75)
    at com.intellij.psi.scope.util.PsiScopesUtil.treeWalkUp(PsiScopesUtil.java:51)
    at com.intellij.psi.scope.util.PsiScopesUtil.resolveAndWalk(PsiScopesUtil.java:218)
    at com.intellij.psi.scope.util.PsiScopesUtil.resolveAndWalk(PsiScopesUtil.java:149)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.resolve(PsiJavaCodeReferenceElementImpl.java:501)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.access$100(PsiJavaCodeReferenceElementImpl.java:44)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl$OurGenericsResolver.resolve(PsiJavaCodeReferenceElementImpl.java:383)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl$OurGenericsResolver.resolve(PsiJavaCodeReferenceElementImpl.java:375)
    at com.intellij.psi.impl.source.resolve.ResolveCache.lambda$resolveWithCaching$1(ResolveCache.java:203)
    at com.intellij.openapi.util.RecursionManager$1.doPreventingRecursion(RecursionManager.java:116)
    at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:202)
    at com.intellij.psi.impl.PsiImplUtil.multiResolveImpl(PsiImplUtil.java:797)
    at com.intellij.psi.impl.PsiImplUtil.multiResolveImpl(PsiImplUtil.java:788)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.multiResolve(PsiJavaCodeReferenceElementImpl.java:434)
    at com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl.advancedResolve(PsiJavaCodeReferenceElementImpl.java:427)
    at com.intellij.psi.impl.source.PsiClassReferenceType.resolveGenerics(PsiClassReferenceType.java:194)
    at com.intellij.psi.impl.source.PsiClassReferenceType.resolve(PsiClassReferenceType.java:139)
    at com.intellij.psi.util.TypeConversionUtil$2.visitClassType(TypeConversionUtil.java:1264)
    at com.intellij.psi.util.TypeConversionUtil$2.visitClassType(TypeConversionUtil.java:1255)
    at com.intellij.psi.PsiClassType.accept(PsiClassType.java:237)
    at com.intellij.psi.util.TypeConversionUtil.erasure(TypeConversionUtil.java:1255)
    at com.intellij.psi.util.TypeConversionUtil.erasure(TypeConversionUtil.java:1249)
    at com.intellij.psi.util.PsiFormatUtil.formatType(PsiFormatUtil.java:349)
    at com.intellij.psi.util.PsiFormatUtil.formatVariable(PsiFormatUtil.java:44)
    at com.intellij.psi.util.PsiFormatUtil.formatVariable(PsiFormatUtil.java:31)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider.a(LibrarySourceNotificationProvider.kt:82)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider.access$format(LibrarySourceNotificationProvider.kt:22)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider$differs$1.invoke(LibrarySourceNotificationProvider.kt:69)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider$differs$1.invoke(LibrarySourceNotificationProvider.kt:22)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider.a(LibrarySourceNotificationProvider.kt:88)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider.c(LibrarySourceNotificationProvider.kt:69)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider.createNotificationPanel(LibrarySourceNotificationProvider.kt:39)
    at com.intellij.codeInsight.daemon.impl.LibrarySourceNotificationProvider.createNotificationPanel(LibrarySourceNotificationProvider.kt:22)
    at com.intellij.ui.EditorNotificationsImpl.calcNotificationUpdates(EditorNotificationsImpl.java:117)
    at com.intellij.ui.EditorNotificationsImpl.lambda$null$0(EditorNotificationsImpl.java:96)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:144)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$null$1(NonBlockingReadActionImpl.java:118)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1166)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:68)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:121)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:586)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:86)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:110)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:68)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$2(NonBlockingReadActionImpl.java:118)
    at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:220)
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$100(BoundedTaskExecutor.java:26)
    at com.intellij.util.concurrency.BoundedTaskExecutor$2.lambda$run$0(BoundedTaskExecutor.java:198)
    at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:224)
    at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:194)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
mplushnikov commented 5 years ago

Good catch, thank you @jaquessmith !

desRobinson commented 5 years ago

Same issue for me - occurred on IDE start:

IntelliJ IDEA 2019.1 (Ultimate Edition) Build #IU-191.6183.87, built on March 27, 2019 JRE: 1.8.0_202-release-1483-b39 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.14.4 Lombok Plugin Version: v0.24-2018.3 Lombok dependency for the project: 1.16.20

I had just updated my project JDK to OpenJDK 11 using brew. Was opening a project after clearing my caches in IntelliJ.

mplushnikov commented 5 years ago

@desRobinson This is already fixed in master, but not yet released...

desRobinson commented 5 years ago

Sorry - searched for the issue to avoid a duplicate ticket but missed the closed tag. :-(