The same problem actually happens also with:
public class ListDelegate implements List {
@Delegate
private /*List*/ ArrayList arrayList = new ArrayList();
}
Fuuny enough, the NetBeans IDE does mark an error equivalent to Tulio’s (“does not override abstract method subList(int, int) in java.util.List”), but NOT when compiling the class with javac or building the whole project. Then only happen some unchecked warnings:
warning: [unchecked] unchecked call to <T>toArray(T[]) as a member of the raw type java.util.ArrayList
warning: [unchecked] unchecked call to set(int,E) as a member of the raw type java.util.ArrayList
warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList
warning: [unchecked] unchecked call to add(int,E) as a member of the raw type java.util.ArrayList
warning: [unchecked] unchecked call to addAll(java.util.Collection<? extends E>) as a member of the raw type java.util.ArrayList
warning: [unchecked] unchecked call to addAll(int,java.util.Collection<? extends E>) as a member of the raw type java.util.ArrayList
warning: [unchecked] unchecked call to containsAll(java.util.Collection<?>) as a member of the raw type java.util.AbstractCollection
warning: [unchecked] unchecked call to removeAll(java.util.Collection<?>) as a member of the raw type java.util.AbstractCollection
warning: [unchecked] unchecked call to retainAll(java.util.Collection<?>) as a member of the raw type java.util.AbstractCollection
9 warnings
De: project...@googlegroups.com [mailto:project...@googlegroups.com] En nombre de Tulio Arends
Enviado el: miércoles, 06 de junio de 2012 23:20
Para: project...@googlegroups.com
Asunto: [project lombok] Strange behavior of @Delegate with javac and Collections Framewok
I'm using openJDK-7, Ubuntu 12.04 and Lombok 11 and ran into this beaty today at work, it has me baffled:
import java.util.ArrayList;
import java.util.List;
import lombok.Delegate;
public class ListDelegate implements List {
@Delegate
private List arrayList = new ArrayList();
}
This code makes javac happy ;)
import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
import lombok.Delegate;
public class QueDelegate implements Queue {
@Delegate()
private Queue queue = new LinkedBlockingQueue();
}
This code makes javac choke and spit out: QueDelegate is not abstract and does not override abstract method clear() in Collection
wich is untrue.
Checking the source I find that LinkedBlockingQueue implements BlockingQueue and that BlockingQueue extends Queue.
This should be valid.
Any thoughts on this?
--
You received this message because you are subscribed to the Google
Groups group for http://projectlombok.org/
To post to this group, send email to project...@googlegroups.com
To unsubscribe from this group, send email to
project-lombo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/project-lombok?hl=en
To post to this group, send email to project-lombok@googlegroups.com
To unsubscribe from this group, send email to