[cdi-dev] CDI-508 - Which java classes can be managed beans

Martin Kouba mkouba at redhat.com
Wed May 4 02:12:44 EDT 2016

Hi all,

given that local and anonymous classes are special kinds of inner 
classes, we could also simply change the sentence to:

"It is not an inner class."

Anyway, I think the change of the first sentence is much more important, 
i.e. removing the "top-level"...

Maybe we should also remove "top-level" from the next sentence:
"It is a top-level non-abstract class, or is annotated `@Decorator`."

So that we would end up with:

A Java class is a managed bean if it meets all of the following conditions:
* It is not an inner class.
* It is a non-abstract class, or is annotated `@Decorator`.
* It does not implement `javax.enterprise.inject.spi.Extension`.
* It is not annotated `@Vetoed` or in a package annotated `@Vetoed`.
* It has an appropriate constructor - either:

What do you think?


Dne 4.5.2016 v 02:32 John D. Ament napsal(a):
> All,
> I think I had an action item to get this clarified, not 100% sure, but
> let me give this a shot.
> Tomas raised a PR for CDI-508 to clarify which classes are meant to be
> managed beans.  You can find that PR here:
> https://github.com/cdi-spec/cdi/pull/282/
> The line that doesn't sound right to me in the change is to go from:
> It is not a non-static inner class.
> to
> It is not a non-static nested class.
> I'll use the java programming language tutorial as a point of reference,
> you can read the page I'll refer to here:
> https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
> Basically, non-static nested classes are AKA inner classes.  The term
> "non-static inner class" shouldn't exist, and that means the original
> text doesn't make sense, and should probably be inferred as "It is not
> an inner class"
>  From reading this part of the spec, it becomes unreadable due to the
> double negative (probably why the aka exists).  My proposal was to
> change the line to instead read (in a positive way) "It is a static
> nested class" but I can also understand if we want to do this in an
> exclusion pattern rather than an inclusion pattern.
> Thoughts?
> John
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.

Martin Kouba
Software Engineer
Red Hat, Czech Republic

More information about the cdi-dev mailing list