OK,
in CDI it's disallowed by spec:
" 5.4.1.Unproxyable bean types
Certain legal bean types cannot be proxied by the container:
•classes which don't have a non-private constructor with no parameters,
•classes which are declared final or have final methods

If an injection point whose declared type cannot be proxied by the container resolves to a bean with a normal scope, the
 container automatically detects the problem and treats it as a deployment problem."

Anyway, the NPE in Seam2 is misleading. A cglib exception is swallowed. Correct?

Michael


2010/6/3 Michael Schütz <michaelschuetz83@gmail.com>
Hi to all,

in Seam2, using injected member within final method will cause an NPE at Runtime. The reason for that is, that Seam2 uses cglib for dynamic proxying und subclassing is not possible for final methods.

Example:
@Name("simpleSeamComp")
public class SimpleSeamComponent {
    public String getName() {
        return "Sam";
    }
}

@Name("finalSeamComp")
public class FinalSeamComponent {

    @In(create = true)
    private SimpleSeamComponent simpleSeamComp;

    // causes NullPointerException
    public final String getHello() {
        return simpleSeamComp.getName();
    }
}


How will Seam3/CDI behave in that case?



Thanks and regards
Michael