felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Meschberger <fmesc...@gmail.com>
Subject Re: Is is a bug to omit the Annotation class?
Date Fri, 15 Jan 2010 08:04:24 GMT

I am pretty sure that the Felix framework does nothing around annotations.

According to the JavaDoc of the RetentionPolicy annotation, only a
retention policy of "RUNTIME" ensures an annotation is available at
runtime. A policy of COMPILE will put it into the class file but the VM
need not retain it at runtime (this seems to be the default, too).


On 15.01.2010 08:57, Brodie wrote:
> hi, 
> i find that when felix installing a bundle, if the bundle referred to some
> other bundle's exported Annotation, and if the Annotation class is not
> accessible(for example the annotation class is deleted) , felix omit the
> Annotation.
> i am not sure if this is a bug, or the JVM runs in this way, but it is
> definitely not reasonable. i waste much time on it.
> Here is the test, 
> public class TestLoadAnnotation {
> 	@Test
> 	public void testLoad() throws Exception{
> 		Felix f = new Felix(new HashMap());
> 		f.init(); f.start();
> 		Bundle bundle =
> f.getBundleContext().installBundle("file:///home/chi/workspace/profile/target/profile-0.0.1-SNAPSHOT-package.jar");
> 		bundle.start();
> 		BundleActivator activator = FelixHelper.getBundleActivator(bundle);
> 		System.out.println(activator.getClass().getClassLoader());
> 		Assert.assertTrue(0 != activator.getClass().getAnnotations().length);
> 	}
> }
> and the profile bundle's activator definition.
> @App("profile")
> public class Activator implements BundleActivator{...}
> i checked the class file of Activator, and there is this runtime visible
> @App annotation. why the annotation is missing?

View raw message