Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Lombok breaks when I change properties' order in the class #634

Closed
deafjava opened this issue May 27, 2019 · 2 comments
Closed

Lombok breaks when I change properties' order in the class #634

deafjava opened this issue May 27, 2019 · 2 comments
Assignees

Comments

@deafjava
Copy link

deafjava commented May 27, 2019

Short description

Lombok breaks when I tweak properties' order of class when having the @RequiredArgsConstructors set above the class

Expected behavior

Expected behavior is red error highlight to disappear when desired parameters order fits into the properties order in the class

Version information

  • IDEA Version: IntelliJ IDEA 2019.1.2 (Community Edition)
    Build #IC-191.7141.44, built on May 7, 2019
  • JDK Version: JRE: 1.8.0_202-release-1483-b49 amd64
  • JVM Version: JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
  • OS Type & Version: Linux 4.15.0-50-generic
  • Lombok Plugin Version: 0.25-EAP
  • Lombok Dependency Version: 1.18.2

Steps to reproduce

  1. Set properties order with different types, e.g.,
@Getter
@AllArgsConstructor
@RequiredArgsConstructor
public class Node {

    @Setter
    private Node next;

    private final Object element;

}
  1. As shown above, add @RequiredArgsConstructor
  2. Instantiate an object with wrong arguments' order - (Object, Node) instead of (Node, Object), e.g.
public class LinkedListImpl {

    private Node first;
    private Node last;
    public void add(Object o) {
        Node node = new Node(o, first); 
   }
}
  1. In the Node class, change the order:
@Getter
@AllArgsConstructor
@RequiredArgsConstructor
public class Node {

    private final Object element;

    @Setter
    private Node next;

}

After it, an exception is thrown, with the stacktrace below:

Stacktrace

If you are experiencing an issue and IntelliJ throws an error please provide the stacktrace.


com.intellij.diagnostic.PluginException: class de.plushnikov.intellij.plugin.psi.LombokLightParameter; valid=true; method.valid=true [Plugin: Lombook Plugin]
	at com.intellij.ide.plugins.PluginManagerCore.createPluginException(PluginManagerCore.java:368)
	at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:12)
	at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:68)
	at com.intellij.codeInsight.daemon.impl.quickfix.ChangeMethodSignatureFromUsageFix.getNewParametersInfo(ChangeMethodSignatureFromUsageFix.java:328)
	at com.intellij.codeInsight.daemon.impl.quickfix.ChangeMethodSignatureFromUsageFix.isAvailable(ChangeMethodSignatureFromUsageFix.java:150)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.addAvailableFixesForGroups(ShowIntentionsPass.java:149)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.lambda$getAvailableFixes$0(ShowIntentionsPass.java:82)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getAvailableFixes(ShowIntentionsPass.java:82)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:269)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(ShowIntentionsPass.java:254)
	at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(ShowIntentionsPass.java:220)
	at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:430)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1166)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:423)
	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.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:422)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:398)
	at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:164)
	at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:218)
	at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:396)
	at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:174)
	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)
Caused by: com.intellij.psi.PsiInvalidElementAccessException: Element: class com.intellij.psi.impl.source.PsiJavaCodeReferenceElementImpl #JAVA  because: containing file is null
invalidated at: see attachment; Type element reference of class com.intellij.psi.impl.source.PsiFieldImpl #PsiFieldImpl, invalid; augmenters=[com.intellij.psi.impl.source.JShellPsiAugmentProvider@6c0f124f, de.plushnikov.intellij.plugin.provider.LombokAugmentProvider@36eed1f4]
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolveGenerics(PsiClassReferenceType.java:192)
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolve(PsiClassReferenceType.java:139)
	at com.intellij.psi.util.PsiUtil.ensureValidType(PsiUtil.java:1271)
	at com.intellij.psi.util.PsiUtil.ensureValidType(PsiUtil.java:1260)
	at com.intellij.codeInsight.daemon.impl.quickfix.ChangeMethodSignatureFromUsageFix.getNewParametersInfo(ChangeMethodSignatureFromUsageFix.java:322)
	... 25 more

@mplushnikov
Copy link
Owner

Hello @deafjava ,
can you please explain more detailed, how do you make step 4: (in the Node class, change the order)
Are you using some shortcuts or calling some intellij actions?
I'm trying to reproduce your issue in my environment.

@mplushnikov
Copy link
Owner

Close this, as duplicate of #649

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants