Author: rich Date: Tue May 10 23:45:13 2005 New Revision: 169593 URL: http://svn.apache.org/viewcvs?rev=169593&view=rev Log: Fix for http://issues.apache.org/jira/browse/BEEHIVE-608 : Overriding Controls annotated member in the inheriting page flow cause exception
Also, applied Carlin's patch to address http://issues.apache.org/jira/browse/BEEHIVE-688 : beehive-url-template-config.xml tomcat warning tests: drt in trunk (WinXP) BB: self (linux) Removed: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/util/ Modified: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/Controls.java incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplatesFactory.java Modified: incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/Controls.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/Controls.java?rev=169593&r1=169592&r2=169593&view=diff ============================================================================== --- incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/Controls.java (original) +++ incubator/beehive/trunk/controls/src/api/org/apache/beehive/controls/api/bean/Controls.java Tue May 10 23:45:13 2005 @@ -149,7 +149,7 @@ } throw new ControlException( "Exception trying to run client initializer: " + e.getClass().getName() + ", " + - e.getMessage() ); + e.getMessage(), e ); } } } Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java?rev=169593&r1=169592&r2=169593&view=diff ============================================================================== --- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java (original) +++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java Tue May 10 23:45:13 2005 @@ -263,35 +263,62 @@ private void checkControlField( FieldDeclaration f ) { - TypeMirror fieldType = f.getType(); + TypeMirror fieldType = f.getType(); + // Make sure that this field doesn't try to override another that's inherited. + String fieldName = f.getSimpleName(); + TypeDeclaration declaringType = f.getDeclaringType(); + + if ( declaringType instanceof ClassDeclaration ) + { + for ( ClassType i = ( ( ClassDeclaration ) declaringType ).getSuperclass(); i != null; i = i.getSuperclass() ) + { + ClassDeclaration decl = i.getDeclaration(); + + if ( decl != null ) + { + for ( FieldDeclaration baseClassField : decl.getFields() ) + { + if ( fieldName.equals( baseClassField.getSimpleName() ) ) + { + Collection<Modifier> modifiers = baseClassField.getModifiers(); + + if ( modifiers.contains( Modifier.PROTECTED ) || modifiers.contains( Modifier.PUBLIC ) ) + { + printError( f, "control.field.override", decl.getQualifiedName() ); + } + } + } + } + } + } + + // Valid control field instances can be of an interface type + // or a class type. + if ( fieldType instanceof InterfaceType ) + { + // Valid interface type decls must be annotated w/ @ControlInterface + // or @ControlExtension. + Declaration fieldTypeDecl = ((InterfaceType)fieldType).getDeclaration(); + if ( fieldTypeDecl.getAnnotation(ControlInterface.class) == null && + fieldTypeDecl.getAnnotation(ControlExtension.class) == null ) + printError( f, "control.field.bad.interfacetype" ); + } + else if ( fieldType instanceof ClassType ) + { + // Valid class type decls must implements the ControlBean API. + + // Walk the implementation inheritance hierarchy, seeing if one of the + // classes implements ControlBean. + // + // REVIEW: Does NOT check if the interfaces might implement ControlBean! + // This is unnecessary for our impl, since our generated bean class directly + // implements ControlBean, but other impls may choose to do otherwise. + boolean foundControlBean = false; + ClassType classType = (ClassType)fieldType; - // Valid control field instances can be of an interface type - // or a class type. - if ( fieldType instanceof InterfaceType ) - { - // Valid interface type decls must be annotated w/ @ControlInterface - // or @ControlExtension. - Declaration fieldTypeDecl = ((InterfaceType)fieldType).getDeclaration(); - if ( fieldTypeDecl.getAnnotation(ControlInterface.class) == null && - fieldTypeDecl.getAnnotation(ControlExtension.class) == null ) - printError( f, "control.field.bad.interfacetype" ); - } - else if ( fieldType instanceof ClassType ) - { - // Valid class type decls must implements the ControlBean API. - - // Walk the implementation inheritance hierarchy, seeing if one of the - // classes implements ControlBean. - // - // REVIEW: Does NOT check if the interfaces might implement ControlBean! - // This is unnecessary for our impl, since our generated bean class directly - // implements ControlBean, but other impls may choose to do otherwise. - boolean foundControlBean = false; - ClassType classType = (ClassType)fieldType; - - if (classType.getDeclaration() != null) - { + if (classType.getDeclaration() != null) + { outer: while ( classType != null ) { Collection<InterfaceType> intfs = classType.getSuperinterfaces(); @@ -364,7 +391,6 @@ printError( f, "control.field.type.malformed" ); } - TypeDeclaration declaringType = f.getDeclaringType(); assert declaringType != null : "Field " + f + " has no declaring type!"; if ( declaringType.getDeclaringType() != null ) Modified: incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties?rev=169593&r1=169592&r2=169593&view=diff ============================================================================== --- incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties (original) +++ incubator/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/apt/strings.properties Tue May 10 23:45:13 2005 @@ -24,6 +24,9 @@ A control field can exist only within the top-level class. \ Move fields marked with the Control annotation to just inside the top-level class. +control.field.override=\ +This control field conflicts with another of the same name in superclass {0}. + control.public.interface.not.found = \ Cannot find the public interface for this control. \ Verify that the public interface for this control is available in this project. Modified: incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplatesFactory.java URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplatesFactory.java?rev=169593&r1=169592&r2=169593&view=diff ============================================================================== --- incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplatesFactory.java (original) +++ incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urltemplates/URLTemplatesFactory.java Tue May 10 23:45:13 2005 @@ -141,7 +141,7 @@ else { // No descriptor - _log.warn( "Could not find URL template descriptor at path " + _configFilePath ); + _log.info( "Running without URL template descriptor, " + _configFilePath ); } } catch ( XmlException xe )
