murat8505 / projectlombok

Automatically exported from code.google.com/p/projectlombok
0 stars 1 forks source link

Eclipse Luna 4.4M7 IllegalArgumentException: startPos = 164 and length is -164 #678

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying out the new eclipse but lombok (1.12.6) doesn't seem to work at 
present. If auto build is on the "Problem Occured" dialog pops up continuously.

Let me know if you need more info or need me to test something.

Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

java.lang.IllegalArgumentException: startPos = 164 and length is -164.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
char[]
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:33)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.setTypeAnnotationsAndSourceRangeOnArray(ASTConverter.java:3420)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToArray(ASTConverter.java:3166)
    at org.eclipse.jdt.core.dom.ASTConverter.convertType(ASTConverter.java:3628)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:921)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:550)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:195)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2958)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1374)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:889)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:585)
    at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:896)
    at org.eclipse.jdt.apt.core.internal.env.BaseProcessorEnv.createASTs(BaseProcessorEnv.java:857)
    at org.eclipse.jdt.apt.core.internal.env.BuildEnv.createASTs(BuildEnv.java:356)
    at org.eclipse.jdt.apt.core.internal.env.AbstractCompilationEnv.newBuildEnv(AbstractCompilationEnv.java:111)
    at org.eclipse.jdt.apt.core.internal.APTDispatchRunnable.build(APTDispatchRunnable.java:283)
    at org.eclipse.jdt.apt.core.internal.APTDispatchRunnable.run(APTDispatchRunnable.java:225)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2333)
    at org.eclipse.jdt.apt.core.internal.APTDispatchRunnable.runAPTDuringBuild(APTDispatchRunnable.java:150)
    at org.eclipse.jdt.apt.core.internal.AptCompilationParticipant.processAnnotations(AptCompilationParticipant.java:193)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.processAnnotations(AbstractImageBuilder.java:630)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:341)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:61)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:256)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:180)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

eclipse.buildId=4.4.0.I20140501-0200
java.version=1.7.0_51
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product 
org.eclipse.epp.package.jee.product

Original issue reported on code.google.com by ama...@gmail.com on 15 May 2014 at 1:25

GoogleCodeExporter commented 9 years ago
Yes, we need more information. I just downloaded 4.4M7 and installed lombok.

I cannot reproduce the problem. Is there any specific lombok feature that 
triggers this bug? Can you reproduce it in a new workspace? 

The following code compiles without any problems:

package test;

import lombok.Data;

@Data
public class Foo {
    int x;
}

Original comment by r.spilker on 20 May 2014 at 10:41

GoogleCodeExporter commented 9 years ago
Wait, is this a duplicate of issue 677?

Original comment by r.spilker on 20 May 2014 at 10:42

GoogleCodeExporter commented 9 years ago
I doubt if it is a duplicate of 677, may have the same cause though.
Thanks for your effort and pointers, I'll try to reproduce it in a clean 
workspace and project. You are welcome to park this until I do. thanks.

Original comment by ama...@gmail.com on 20 May 2014 at 11:01

GoogleCodeExporter commented 9 years ago
I think it's possible to reproduce with save action "Organize imports" and 
using @Delegate annotation.

Enable "Save Actions" (I did it for the whole workspace):
- Uncheck Formatting
- Check Organize imports
- Uncheck additional actions

Try the following code snippet:

public class BaseClass {
  //@Delegate
  private List<String> field;   
}

Uncomment the annotation and save again. This causes the above exception to 
appear.

Original comment by rgransbe...@gmx.de on 3 Jun 2014 at 8:14

GoogleCodeExporter commented 9 years ago
On eclipse luna 4.4.0 and lombok 1.14.0, I reproduce this issue by following 
code:

import lombok.val;

public class ValWithArray {
    void f() {
        val a = "a,b,c".split(",");
    }
}

Stacktrace:
java.lang.IllegalArgumentException: startPos = 62 and length is -62.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
java.lang.String[]
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:33)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.setTypeAnnotationsAndSourceRangeOnArray(ASTConverter.java:3420)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToArray(ASTConverter.java:3166)
    at org.eclipse.jdt.core.dom.ASTConverter.convertType(ASTConverter.java:3831)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:3439)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:458)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:633)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:195)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2958)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1374)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:292)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1209)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:809)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:544)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:537)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:480)
    at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
    at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:170)
    at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$3.run(SelectionListenerWithASTManager.java:155)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Original comment by buzz.ta...@gmail.com on 22 Aug 2014 at 3:06

GoogleCodeExporter commented 9 years ago
> On eclipse luna 4.4.0 and lombok 1.14.0, I reproduce this issue by following 
code:

Sorry, I reproduce it using lombok 1.14.4, not lombok 1.14.0.

Original comment by buzz.ta...@gmail.com on 22 Aug 2014 at 3:09

GoogleCodeExporter commented 9 years ago
Hi, 
I finally tried upgrading to luna again and hit this again with Lombok 1.14.6 :(
Yes I can reproduce this with a simple: 
public class StringBuilderUtil {
    //@Delegate
    private StringBuilder sb = new StringBuilder();
}
thanks rgransbe... !

But since @Delegate has been demoted :( , I suppose this is a won't fix.. 

===
java.lang.IllegalArgumentException: startPos = 165 and length is -165.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
char[]
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:33)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.setTypeAnnotationsAndSourceRangeOnArray(ASTConverter.java:3420)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToArray(ASTConverter.java:3166)
    at org.eclipse.jdt.core.dom.ASTConverter.convertType(ASTConverter.java:3628)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:921)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:550)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:195)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2958)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1374)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:292)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1209)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:809)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:544)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:537)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:480)
    at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
    at org.eclipse.jdt.ui.OverrideIndicatorLabelDecorator.getOverrideIndicators(OverrideIndicatorLabelDecorator.java:161)
    at org.eclipse.jdt.ui.OverrideIndicatorLabelDecorator.computeAdornmentFlags(OverrideIndicatorLabelDecorator.java:136)
    at org.eclipse.jdt.ui.OverrideIndicatorLabelDecorator.decorate(OverrideIndicatorLabelDecorator.java:273)
    at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:273)
    at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:83)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:367)
    at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:349)
    at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:372)
    at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:332)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
===

With buzz.ta...'s ValWithArray I just get the error in the logs (no annoying 
popup yet):

===
java.lang.IllegalArgumentException: startPos = 104 and length is -104.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
java.lang.String[]
    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:33)
    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)
    at org.eclipse.jdt.core.dom.ASTConverter.setTypeAnnotationsAndSourceRangeOnArray(ASTConverter.java:3420)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToArray(ASTConverter.java:3166)
    at org.eclipse.jdt.core.dom.ASTConverter.convertType(ASTConverter.java:3831)
    at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:3439)
    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:458)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:633)
    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:195)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2958)
    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1374)
    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:292)
    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1209)
    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:809)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:544)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:537)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:480)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:470)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:470)
    at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
    at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:170)
    at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup$3.run(SelectionListenerWithASTManager.java:155)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
===

Original comment by ama...@gmail.com on 15 Sep 2014 at 10:07

GoogleCodeExporter commented 9 years ago
This affects val too.

Original comment by christia...@gmail.com on 17 Sep 2014 at 11:38

GoogleCodeExporter commented 9 years ago
Especially when using breakpoints.

Original comment by christia...@gmail.com on 17 Sep 2014 at 11:39

GoogleCodeExporter commented 9 years ago
I am encoutering the same issue, with 1.14.8 like when in eclipse lune doing a 
refactoring,  extract to method:

java.lang.IllegalArgumentException: startPos = 1143 and length is -1143.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
java.lang.String[]

    at lombok.eclipse.agent.PatchDiagnostics.setSourceRangeCheck(PatchDiagnostics.java:33)

    at org.eclipse.jdt.core.dom.ASTNode.setSourceRange(ASTNode.java)

    at org.eclipse.jdt.core.dom.ASTConverter.setTypeAnnotationsAndSourceRangeOnArray(ASTConverter.java:3420)

    at org.eclipse.jdt.core.dom.ASTConverter.convertToArray(ASTConverter.java:3166)

    at org.eclipse.jdt.core.dom.ASTConverter.convertType(ASTConverter.java:3831)

    at org.eclipse.jdt.core.dom.ASTConverter.convertToVariableDeclarationStatement(ASTConverter.java:3439)

    at org.eclipse.jdt.core.dom.ASTConverter.checkAndAddMultipleLocalDeclaration(ASTConverter.java:458)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1257)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2681)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1948)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2705)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1259)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2681)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1886)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2671)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1259)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2681)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1948)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2705)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:635)

    at org.eclipse.jdt.core.dom.ASTConverter.buildBodyDeclarations(ASTConverter.java:195)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:2958)

    at org.eclipse.jdt.core.dom.ASTConverter.convert(ASTConverter.java:1374)

    at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:292)

    at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1209)

    at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:809)

    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:544)

    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)

    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:537)

    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:480)

    at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)

    at org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser.parseWithASTProvider(RefactoringASTParser.java:119)

    at org.eclipse.jdt.internal.corext.refactoring.code.ExtractTempRefactoring.checkInitialConditions(ExtractTempRefactoring.java:580)

    at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83)

    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)

    at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)

    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Original comment by Michel.L...@gmail.com on 15 Oct 2014 at 1:20

GoogleCodeExporter commented 9 years ago
I can confirm that the problem also exists in the newest version of eclipse:

Luna Service Release 2 (4.4.2)
Build id: 20150219-0600

with

Lombok 1.16.4.

It's enough to use some of the save actions and @val in a file:

A save participant caused problems:
The save participant 'Code Clean Up' caused an exception: 
java.lang.IllegalArgumentException: startPos = 4873 and length is -4873.
This breaks the rule that lengths are not allowed to be negative. Affected Node:
byte[]. See the error log for details.

Original comment by andreas@filler.name on 23 Jun 2015 at 12:13