Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Changes in Java 8 generics breaking Camel

$
0
0
Java 8 made a changes to generics that is currently not allowing camel to
start up, and if it did start up would be in a bad state. Bridge methods
now get a copy of the annotations placed on the real method. This is bad
when combined with Camel annotations. For example:

interface Something<T extends SomeType> {
void doSomethingWith(T it);

class Foo implements Something<RealType> {

@Consume(uri = "...")
@Override
public void doSomethingWith(RealType it) {
.....

The class the compiler makes actually looks like this because of type
erasure:
class Foo implements Something<RealType> {

@Consume(uri = "...")
@Override
public void doSomethingWith(RealType it) {
.....

@Consume(uri = "...")
@Override
public void doSomethingWith(SomeType it) {
.....

This is a breaking change as far as Camel is concered for 2 reasons:
1. BeanInfo.isValidMethod does not allow for bridge methods
2. There are now 2 methods listening to the same endpoint

Is this a bug that should be reported? Any ideas on a workaround? I'm
about to downgrade to java 7.

Viewing all articles
Browse latest Browse all 5648

Trending Articles