In the practice the problem is that jsf core (myfaces and ri) uses reflection to set the attributes and the following case fail:
Fail with the following exception java.lang.IllegalAccessException: Class javax.faces.component._Util can not access a member of class org.apache.myfaces.test.AbstractComponent with modifiers "public" at sun.reflect.Reflection.ensureMemberAccess(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.faces.component._Util.getValue(_Util.java:54) at javax.faces.component.BaseComponent.getValueReflection( BaseComponent.java:32) at javax.faces.other.ComponentTest.main(ComponentTest.java:14) This behavior is a JDK bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4533479 One possible workaround is put the following line before invoke: readMethod.setAccessible(true); Or make AbstractComponent public. The conclusion is that the abstract base class should be public if and only if it has in his body a attribute definition available on the tld. If the abstract base class has some different code it can be package scope. This behavior discard this approach for myfaces core api! I'm not sure this behaviour is a bug, or that it is fatal for the purposes of generating base classes for myfaces-api. When a Method object refers to a public method in a package-scoped class, then Method.invoke fails with the above exception *when executed by some class outside that package*. However it succeeds fine when invoked by code within that package (eg its concrete subclass) or by the class itself. I have tested this behaviour and it is the same on both java1.6 and java1.3. It also seems quite reasonable behaviour. So one solution is for the generated base class to override getAttributes() to return a custom map where that class itself implements the fetching of the attributes it implements, and delegates to the map created by UIComponentBase.getAttributes() for anything else. This seems quite feasable. Regards, Simon -- View this message in context: http://www.nabble.com/Re%3A--Myfaces-Wiki--Update-of-%22Code-Generation%22-by-SimonKitching-tp15216313p15353739.html Sent from the My Faces - Dev mailing list archive at Nabble.com.