[ 
https://issues.apache.org/jira/browse/WW-4238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13817205#comment-13817205
 ] 

Martin Gainty commented on WW-4238:
-----------------------------------

org.apache.struts2.convention.PackageBasedAnnotationConfigBuilder

//always returns null
org.apache.struts2.convention.annotation.ParentPackage parent = 
AnnotationTools.findAnnotation(actionClass, ParentPackage.class);

public static <T extends java.lang.annotation.Annotation> T 
findAnnotation(Class<?> klass, Class<T> annotationClass) {
        T ann = klass.getAnnotation(annotationClass);
 //PackageParent.class ann always returns null
        while (ann == null && klass != null) {
            ann = klass.getAnnotation(annotationClass);
//PackageParent.class ann returns null
            if (ann == null)
                ann = klass.getPackage().getAnnotation(annotationClass);
//PackageParent.class ann returns null
            if (ann == null) {
                klass = klass.getSuperclass();
                if (klass != null ) {
                    ann = klass.getAnnotation(annotationClass);
//PackageParent.class ann always null


@Target({ElementType.TYPE, ElementType.PACKAGE})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface ParentPackage {
                }
            }
        }
        return ann;
    }



> ParentPackage change not rescanned ..causing incorrect parent package 
> assignment
> --------------------------------------------------------------------------------
>
>                 Key: WW-4238
>                 URL: https://issues.apache.org/jira/browse/WW-4238
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Annotations
>         Environment: JDK 1.7.0.25
> Struts-2.3.4
> deployed to TC 7.0.37
>            Reporter: Martin Gainty
>            Priority: Minor
>              Labels: ParentPackage
>             Fix For: 2.3.17
>
>   Original Estimate: 120h
>  Remaining Estimate: 120h
>
> I wanted to take observe behaviour of changing ParentPackage and here is the 
> change for org.apache.struts2.showcase.person.package-info.java
> within showcase app
> //All package assignments for showcase/person
> //will be changed to showcase/bogus
> //@ParentPackage("person")
> @ParentPackage("bogus")
> @Namespace("/person")
> package org.apache.struts2.showcase.person;
> import org.apache.struts2.convention.annotation.Namespace;
> import org.apache.struts2.convention.annotation.ParentPackage;
> No effect on behaviour
> it seems that any changes to 
> org.apache.struts2.convention.annotation.ParentPackage do not shift the 
> interpretation from old package of "person" to new "bogus" package
> Orginally reported by Jim Greuel USFWS



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to