Bug 535066 - Eclipse is not generating AutoValue classes fails with NPE
Summary: Eclipse is not generating AutoValue classes fails with NPE
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.7.3   Edit
Hardware: Macintosh Mac OS X
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Generic inbox for the JDT-APT component CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-24 07:06 EDT by Hello ItsMe CLA
Modified: 2022-08-28 08:59 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hello ItsMe CLA 2018-05-24 07:06:08 EDT
What steps will reproduce the problem?
1. Switched to Spring Boot 2.2 with AutoValue 


-- Error Details --
Date: Thu May 24 12:26:12 CEST 2018
Message: Exception thrown by Java annotation processor com.google.auto.value.processor.AutoValueProcessor@54cad21e
Severity: Error
Product: Eclipse 4.7.3.20180405-1200 (org.eclipse.epp.package.java.product)
Plugin: org.eclipse.jdt.apt.pluggable.core
Session Data:
eclipse.buildId=4.7.3.M20180330-0640
java.version=1.8.0_152
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=pl_PL
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.java.product

Exception Stack Trace:
java.lang.Exception: java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:169)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:121)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:159)
	at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:135)
	at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:933)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:443)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:419)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:372)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:187)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:305)
	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:175)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
	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:301)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:142)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:232)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.determineSourceStart(TypeElementImpl.java:88)
	at org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.getSourceStart(TypeElementImpl.java:71)
	at org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.compare(TypeElementImpl.java:64)
	at org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl$SourceLocationComparator.compare(TypeElementImpl.java:1)
	at java.util.TimSort.binarySort(TimSort.java:296)
	at java.util.TimSort.sort(TimSort.java:221)
	at java.util.Arrays.sort(Arrays.java:1512)
	at java.util.ArrayList.sort(ArrayList.java:1462)
	at java.util.Collections.sort(Collections.java:175)
	at org.eclipse.jdt.internal.compiler.apt.model.TypeElementImpl.getEnclosedElements(TypeElementImpl.java:165)
	at com.google.auto.value.processor.BuilderMethodClassifier.copyOfMethods(BuilderMethodClassifier.java:512)
	at com.google.auto.value.processor.BuilderMethodClassifier.checkSetterParameter(BuilderMethodClassifier.java:427)
	at com.google.auto.value.processor.BuilderMethodClassifier.classifyMethodOneArg(BuilderMethodClassifier.java:382)
	at com.google.auto.value.processor.BuilderMethodClassifier.classifyMethod(BuilderMethodClassifier.java:248)
	at com.google.auto.value.processor.BuilderMethodClassifier.classifyMethods(BuilderMethodClassifier.java:181)
	at com.google.auto.value.processor.BuilderMethodClassifier.classify(BuilderMethodClassifier.java:132)
	at com.google.auto.value.processor.BuilderSpec$Builder.defineVars(BuilderSpec.java:190)
	at com.google.auto.value.processor.AutoValueProcessor.defineVarsForType(AutoValueProcessor.java:869)
	at com.google.auto.value.processor.AutoValueProcessor.processType(AutoValueProcessor.java:516)
	at com.google.auto.value.processor.AutoValueProcessor.process(AutoValueProcessor.java:199)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:139)
	... 24 more
Comment 1 Till Brychcy CLA 2018-05-24 07:24:55 EDT
Can you provide an example example project?
Comment 2 Hello ItsMe CLA 2018-07-23 07:58:08 EDT
Sorry for some delay.

Here is the project which fails with similar problem
https://github.com/jawpio/eclipse-autovalue-fail

and link to bug reported in autovalue itself
https://github.com/google/auto/issues/652
Comment 3 Hello ItsMe CLA 2018-07-23 08:00:25 EDT
Issue is also reproducible with eclipse "eclipse.buildId=4.8.0.I20180611-0500"
Comment 4 Jay Arthanareeswaran CLA 2018-08-28 14:42:27 EDT
Looking at the given example, the bug appears to be in this fragment. Can you confirm please?

        @AutoValue.CopyAnnotations(exclude = Valid.class)
	@Valid
	@NotNull
	public abstract ColumnRestrictionsDto getColumn();
Comment 5 Jay Arthanareeswaran CLA 2018-08-28 15:17:23 EDT
(In reply to Jay Arthanareeswaran from comment #4)
> Looking at the given example, the bug appears to be in this fragment. Can
> you confirm please?
> 
>         @AutoValue.CopyAnnotations(exclude = Valid.class)
> 	@Valid
> 	@NotNull
> 	public abstract ColumnRestrictionsDto getColumn();

It will also help if you can tell us what the processor is trying to do.

Surely if the test case can wait two months, this is not critical? Just wondering.
Comment 6 Hello ItsMe CLA 2018-08-29 02:41:17 EDT
Yes I can confirm that this is causing the issue:
> Looking at the given example, the bug appears to be in this fragment. Can
> you confirm please?
> 
>         @AutoValue.CopyAnnotations(exclude = Valid.class)
> 	@Valid
> 	@NotNull
> 	public abstract ColumnRestrictionsDto getColumn();

The strange thing is that in some other parts it works correctly (even though the same annotations are present).

What AutoValue is trying to do is to generate the implementation class for the abstract class where generated >getColumn()< method cannot have the @Valid annotation.

Basically this issue made me(and some other people) switch from Eclipse to IntelliJ already, and the issue is blocker in our further development using eclipse.
Comment 7 Hello ItsMe CLA 2019-01-16 03:34:31 EST
Any luck with this issue?
Comment 8 Jay Arthanareeswaran CLA 2019-01-16 05:19:58 EST
(In reply to Hello ItsMe from comment #7)
> Any luck with this issue?

Sorry, I meant to update this sooner, but this fell between cracks. IIRC, I tried but couldn't reproduce with the gradle project you shared. Perhaps, I am doing it the right away. Could you help me reproduce by putting this in a simple Eclipse/Java project? TIA!
Comment 9 Eclipse Genie CLA 2022-08-28 08:59:10 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.