Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fields using <Generics> breaks @Data #157

Closed
lombokissues opened this issue Jul 14, 2015 · 11 comments
Closed

fields using <Generics> breaks @Data #157

lombokissues opened this issue Jul 14, 2015 · 11 comments

Comments

@lombokissues
Copy link

Migrated from Google Code (issue 84)

@lombokissues
Copy link
Author

👤 amanic   🕗 Dec 11, 2009 at 07:26 UTC

> What steps will reproduce the problem?

make the folloging class in eclipse (I think maven and others are also
affected):

import java.io.Serializable;
import lombok.Data;
@ Data
public class LombokProblem {
private Class<? extends Serializable> generictype;
}

> What is the expected output?
that it work normally

> What do you see instead?
Compilation fails and eclipse goes haywire, you cant refactor or anything.

What version of the product are you using? On what operating system?
0.9.1

Please provide any additional information below.

eclipse.buildId=M20090917-0800
java.version=1.6.0_16
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_ZA
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

2009/12/11 9:08:02 AM: Maven Builder: AUTO_BUILD requireFullBuild
2009/12/11 9:08:02 AM: [INFO] Using 'UTF-8' encoding to copy filtered
resources.
2009/12/11 9:08:03 AM: Build errors for EbrWeb;
org.apache.maven.plugin.CompilationFailureException: Compilation failure
error: Exception thrown while constructing Processor object:
java.lang.NoClassDefFoundError:
com/sun/tools/javac/processing/JavacProcessingEnvironment

org.apache.maven.plugin.CompilationFailureException: Compilation failure
error: Exception thrown while constructing Processor object:
java.lang.NoClassDefFoundError:
com/sun/tools/javac/processing/JavacProcessingEnvironment

at
org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:547)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:317)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:239)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:102)
at
org.maven.ide.eclipse.internal.embedder.MavenImpl.execute(MavenImpl.java:203)
at
org.maven.ide.eclipse.internal.project.GenericBuildParticipant.executePostBuild(GenericBuildParticipant.java:139)
at
org.maven.ide.eclipse.internal.project.GenericBuildParticipant.build(GenericBuildParticipant.java:78)
at
org.maven.ide.eclipse.internal.builder.MavenBuilder.build(MavenBuilder.java:149)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Warning
Fri Dec 11 09:12:16 SAST 2009
Errors running builder 'Java Builder' on project 'EbrWeb'.

java.lang.NullPointerException
at
org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding.boundCheck(TypeVariableBinding.java:68)
at
org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding.boundCheck(ParameterizedTypeBinding.java:74)
at
org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference.internalResolveType(ParameterizedSingleTypeReference.java:235)
at
org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference.resolveType(ParameterizedSingleTypeReference.java:278)
at
org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1403)
at
org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1090)
at
org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.unResolvedMethods(ReferenceBinding.java:1366)
at
org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.computeInheritedMethods(MethodVerifier.java:564)
at
org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.computeInheritedMethods(MethodVerifier.java:506)
at
org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.verify(MethodVerifier.java:894)
at
org.eclipse.jdt.internal.compiler.lookup.MethodVerifier15.verify(MethodVerifier15.java:788)
at
org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.verify(MethodVerifier.java:904)
at
org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.verifyMethods(SourceTypeBinding.java:1623)
at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.verifyMethods(CompilationUnitScope.java:819)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:756)
at
org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:137)
at java.lang.Thread.run(Thread.java:619)

@lombokissues
Copy link
Author

👤 reinierz   🕗 Dec 11, 2009 at 23:49 UTC

This error doesn't look related to the generics. It looks more like maven is trying
to compile while using lombok.jar as an annotation processor via ecj, which lombok
does not support, and supporting it would be quite a bit of work.

Can you explain exactly what kind of maven integration you have? So, maven plugin
(and version), and some of your maven setup. If I can reproduce it, I can start
figuring out how to fix it.

@lombokissues
Copy link
Author

👤 amanic   🕗 Dec 14, 2009 at 06:01 UTC

I attached a sample eclipse maven project that displays the problem.

Maven Embedder 3.0.0.200911171109
org.maven.ide.components.maven_embedder.feature.feature.group
Maven Integration for Eclipse (Required) 0.9.9.200911171109
org.maven.ide.eclipse.feature.feature.group

m2eclipse-dev - http://m2eclipse.sonatype.org/update-dev/

on eclipse-jee-galileo-SR1-linux-gtk-x86_64

thanks for looking at this

@lombokissues
Copy link
Author

👤 amanic   🕗 Dec 14, 2009 at 06:01 UTC

🔗 lombok-sample.zip

@lombokissues
Copy link
Author

👤 nzipsi   🕗 Dec 19, 2009 at 09:42 UTC

I'm seeing the same issue, but it only happens with Wildcard generics and 'extends'
or 'super'. Doesn't seem to happen with anything else.

Thus, private Class< ? > clazz; works fine, but both

private Class< ? extends Object> clazz; and
private Class< ? super String> clazz;

will produce severe errors with Lombok. Remove either the '? extends' or 'extends
(Object|String)' part, and everything works as expected. It also compiles just fine
outside of Eclipse, so I'd guess that it's probably a problem with the way Lombok
interacts with the Eclipse compiler?

@lombokissues
Copy link
Author

👤 reinierz   🕗 Dec 21, 2009 at 13:33 UTC

Heh, our tests only test the javac side for now. It's one of the reasons I do want to make lombok work with ecj,
should help find these issues. The fix was simple and has been published as commit
2c8032a on master. Should be rolled out in v0.9.3.

You can also grab the edge build: https://projectlombok.org/download-edge.html - which now incudes this fix.

@lombokissues
Copy link
Author

👤 amanic   🕗 Dec 21, 2009 at 14:21 UTC

thanks!

@lombokissues
Copy link
Author

👤 shervin.asgari   🕗 May 31, 2010 at 12:07 UTC

I have the same problem. Seems like the edge worked. When is 0.93 final coming out?

@lombokissues
Copy link
Author

👤 reinierz   🕗 Aug 18, 2010 at 18:51 UTC

Re-opening due to bug report on 0.9.3 on the groups.

http://groups.google.com/group/project-lombok/browse_thread/thread/4836ed7d424fa2c1﹟

@lombokissues lombokissues added the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues lombokissues reopened this Jul 14, 2015
@lombokissues
Copy link
Author

👤 reinierz   🕗 Jun 06, 2011 at 19:36 UTC

Haven't heard any new reports on this and we still can't reproduce it. Assumed fixed.

@lombokissues lombokissues removed the accepted The issue/enhancement is valid, sensible, and explained in sufficient detail label Jul 14, 2015
@lombokissues
Copy link
Author

End of migration

lianhaijun pushed a commit to lianhaijun/lombok that referenced this issue May 8, 2020
projectlombok#88: Delegating to class with generics using @DeleGate annotation
projectlombok#136: "Cannot infer arguments" with @requiredargsconstructor
projectlombok#157: Intellij fails to infer type for constructor defined with @requiredargsconstructor
projectlombok#176: Unchecked warning when using static constructor for @DaTa and @value on parameterized class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant