akshattandon / projectlombok

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

Delombok NPE during val handling #795

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
The following code produces the problem:

val child = node.getChildren().get(i);

with node being Array<TreeSearchNode<Object, Object>>, having the following 
lombok annotations: @EqualsAndHashCode(callSuper = true), @ToString(callSuper = 
true), @Data.

The code is declared in an public static final anonymous inner class.
(TreeFinalNodeSelection#Util.BEST_RATIO_NODE = new 
TreeFinalNodeSelection<Object, Object>(){ ... };

What is the expected output? What do you see instead?

Exception while resolving: NODE LOCAL (class 
com.sun.tools.javac.tree.JCTree$JCVariableDecl) @val()
final java.lang.Object child = node.getChildren().get(i)
java.lang.NullPointerException
    at com.sun.tools.javac.code.Lint$AugmentVisitor.augment(Lint.java:290)
    at com.sun.tools.javac.code.Lint.augment(Lint.java:82)
    at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:862)
    at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:725)
    at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
    at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
    at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:480)
    at lombok.javac.JavacResolution.attrib(JavacResolution.java:227)
    at lombok.javac.JavacResolution.memberEnterAndAttribute(JavacResolution.java:199)
    at lombok.javac.JavacResolution.resolveMethodMember(JavacResolution.java:146)
    at lombok.javac.handlers.HandleVal.visitLocal(HandleVal.java:107)
    at lombok.javac.JavacNode.traverse(JavacNode.java:100)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:106)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:106)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:85)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:75)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:106)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:80)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:75)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:75)
    at lombok.javac.JavacAST.traverseChildren(JavacAST.java:123)
    at lombok.javac.JavacNode.traverse(JavacNode.java:70)
    at lombok.javac.JavacAST.traverse(JavacAST.java:119)
    at lombok.javac.HandlerLibrary.callASTVisitors(HandlerLibrary.java:257)
    at lombok.javac.JavacTransformer.transform(JavacTransformer.java:71)
    at lombok.javac.apt.Processor.process(Processor.java:250)
    at lombok.core.AnnotationProcessor$JavacDescriptor.process(AnnotationProcessor.java:115)
    at lombok.core.AnnotationProcessor.process(AnnotationProcessor.java:165)
    at lombok.launch.AnnotationProcessorHider$AnnotationProcessor.process(AnnotationProcessor.java:58)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
    at com.sun.tools.javac.main.Main.compile(Main.java:439)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

What version of the product are you using? On what operating system?
Lombok 1.16.2, 

Java version: 1.7.0_75, vendor: Oracle Corporation
OS name: "linux", version: "3.2.0-70-generic", arch: "amd64", family: "unix"
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100)

Original issue reported on code.google.com by Lume...@gmail.com on 3 Mar 2015 at 9:53