Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4668

Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported)

    XMLWordPrintableJSON

Details

    Description

      Here are the steps:

      1. create a bundle (say "Stereotype") that exports package test.ipojo.stereotype containing
        1. the MyInterface interface
        2. the MyComponent annotation:
          @Component
          @Provides (specifications = MyInterface.class)
          @Stereotype
          @Target(TYPE)
          public @interface  MyComponent {
          }
          
      2. build and install "Stereotype" in local maven repo
      3. using maven, create another bundle (say "Stereotype-bundle") containing a class that uses the stereotype:
        @MyComponent
        public class ComponentByStereotype extends ComponentBase implements AnotherInterface 
        
      4. configure BND of "Stereotype-bundle" like this (the bundle does not need to export or include any package):
        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
        <Bundle-Version>${project.version}</Bundle-Version>
        <Import-Package>test.ipojo.stereotype,*</Import-Package>
        <Private-Package></Private-Package>
        <Export-Package></Export-Package>
        
      5. make sure "Stereotype-bundle" has "Stereotype" in it's maven dependencies
      6. configure maven-ipojo-plugin in "Stereotype-bundle"
        <plugin>
        	<groupId>org.apache.felix</groupId>
        	<artifactId>maven-ipojo-plugin</artifactId>
        	<version>1.12.0</version>
        	<executions>
        		<execution>
        			<goals>
        				<goal>ipojo-bundle</goal>
        			</goals>
        		</execution>
        	</executions>
        </plugin>
        
      7. Try to build 'Stereotype-bundle'

      Expected result: The 'Stereotype-bundle' will be build and @MyComponent annotation will be processed.

      Actual result: The @MyComponent annotation is NOT processed. The following is displayed in console:

      [WARNING] Class test.ipojo.bundle.ComponentByStereotype has not been marked as a component type (no @Component, @Handler, ...). It will be ignored by the iPOJO manipulator.
      

      Attachments

        1. stereotype-test.zip
          11 kB
          Milen Dyankov

        Activity

          People

            clement.escoffier Clement Escoffier
            azzazzel Milen Dyankov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: