lishunli / projectlombok

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

Maven compilation fails with @Delegate #412

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Sample project attached

What is the expected output? What do you see instead?
Build succeeds in Eclipse, but fails in Maven.

It appears that some methods are not @delegated correctly for some reason.

The class in question is:

public class MedaiAppender implements IMediaWriter {

    @Delegate
    private final IMediaWriter writer;

    public MedaiAppender(IMediaWriter writer)
    {
        this.writer = writer;
    }   
}

generates:
com.mangofactory.sample.MedaiAppender is not abstract and does not override 
abstract method getListeners() in com.xuggle.mediatool.IMediaGenerator

The inheritence chain to IMediaGenerator is:
IMedaWriter -> IMediaTool -> IMediaGenerator

I'm unsure of what is 'special' about IMediaGenerator.  I've tried with a 
similar inheritence chain in the attached project, and it works fine.

What version of the product are you using? On what operating system?
Tried against 0.11.4 and 0.10.8

Original issue reported on code.google.com by martyp...@mango-factory.com on 4 Sep 2012 at 2:36

Attachments:

GoogleCodeExporter commented 9 years ago
test case starts downloading commons-cli.jar from an svn repo on googlecode. 
About 45MB into the download, I decided to abort this test case. Can you make 
it simpler?

Maven. Downloading half the internet since 1998.

New maven rule: Maven test cases are only accepted if they can manage to stick 
to downloading less than 10% of the internet.

Original comment by reini...@gmail.com on 29 Oct 2012 at 10:31

GoogleCodeExporter commented 9 years ago
I have just run into the same problem and created a testcase that, hopefully, 
downloads only a few percent of the (by now considerably grown) Internet. It is 
doing the same as the example above, just with native java classes. The only 
dependency is lombok 0.11.8
The error appears from within eclipse juno,m2e, maven 3
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode)
But also from command line with maven 2

maven output from eclipse:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building TestDelegate 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ 
testDelegate ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, 
i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ testDelegate 
---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. 
build is platform dependent!
[INFO] Compiling 1 source file to 
/local/hartmut/workspace/testDelegate/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] 
/local/hartmut/workspace/testDelegate/src/main/java/ProtectedScheduledExecutorSe
rvice.java:[17,7] error: ProtectedScheduledExecutorService is not abstract and 
does not override abstract method execute(Runnable) in Executor
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.345s
[INFO] Finished at: Wed May 22 17:42:52 CEST 2013
[INFO] Final Memory: 7M/104M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on 
project testDelegate: Compilation failure
[ERROR] 
/local/hartmut/workspace/testDelegate/src/main/java/ProtectedScheduledExecutorSe
rvice.java:[17,7] error: ProtectedScheduledExecutorService is not abstract and 
does not override abstract method execute(Runnable) in Executor
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Original comment by hartmut....@gmail.com on 22 May 2013 at 3:52

Attachments:

GoogleCodeExporter commented 9 years ago
Updated the demo/test class (removed further code). Now it is just this:

import java.util.concurrent.ScheduledExecutorService;
import lombok.Delegate;
public class ProtectedScheduledExecutorService implements 
ScheduledExecutorService {
    @Delegate
    private ScheduledExecutorService delegate;
}

Original comment by hartmut....@gmail.com on 23 May 2013 at 7:30

Attachments:

GoogleCodeExporter commented 9 years ago
Here is the verbose javac output from the command line that maven constructs at 
my system - just in case that helps find the problem without downloading the 
Internet, first.

Original comment by hartmut....@gmail.com on 24 May 2013 at 8:53

Attachments:

GoogleCodeExporter commented 9 years ago
I have the same issue, I am trying to install TinCan API and it has lombok as 
dependency. 
I have java 7, and maven 3. version required is 11.6. 

Original comment by ahal...@gmail.com on 26 Jun 2013 at 12:59

GoogleCodeExporter commented 9 years ago
I have the same issue even with 1.12.4. Using Java 1.7.0_45 and maven 3.0.5

In fact the compilation fails even within the IntelliJ IDEA IDE.

Original comment by vasudeva...@gmail.com on 21 Jan 2014 at 4:07

GoogleCodeExporter commented 9 years ago
Same problem here... The last added testDelegate.tar.bz2 illustrates the 
problem clearly. It fails, but there is no reason to fail.

Original comment by floris.k...@gmail.com on 20 Nov 2014 at 12:24