You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by keinmensch <ke...@mailhaven.com> on 2009/12/14 12:58:58 UTC

@Property annotation on private fields?

Hi!
Exploring property injection on SCA components, I find that when I
annotate an instance field in a class like this:
@Property(name="fileContents", required=false)
private String mFileContents;

There is a warning in the log when starting the SCA node:
WARNING: Invalid annotation
@org.oasisopen.sca.annotation.Property(name=fileContents,
required=false) is found on private java.lang.String
com.ivan.components.impl.PropertyPrinterServiceImpl.mFileContents

The SCA 1.0 specification clearly says that the @Property annotation may
only be used on public or protected fields (Java Common Annotations and
APIs, section 1.8.13), however I find no such limitations in the SCA 1.1
specification.
My questions is whether the above warning message is a remains from the
SCA 1.0 days or if the SCA 1.1 specification forgets to mention that
annotated fields must be public or protected? A third possibility that I
should take into consideration is that I simply has failed to find the
appropriate place in the specifications.
Many thanks in advance!

Re: @Property annotation on private fields?

Posted by Luciano Resende <lu...@gmail.com>.
On Mon, Dec 14, 2009 at 3:58 AM, keinmensch <ke...@mailhaven.com> wrote:
> Hi!
> Exploring property injection on SCA components, I find that when I
> annotate an instance field in a class like this:
> @Property(name="fileContents", required=false)
> private String mFileContents;
>
> There is a warning in the log when starting the SCA node:
> WARNING: Invalid annotation
> @org.oasisopen.sca.annotation.Property(name=fileContents,
> required=false) is found on private java.lang.String
> com.ivan.components.impl.PropertyPrinterServiceImpl.mFileContents
>
> The SCA 1.0 specification clearly says that the @Property annotation may
> only be used on public or protected fields (Java Common Annotations and
> APIs, section 1.8.13), however I find no such limitations in the SCA 1.1
> specification.
> My questions is whether the above warning message is a remains from the
> SCA 1.0 days or if the SCA 1.1 specification forgets to mention that
> annotated fields must be public or protected? A third possibility that I
> should take into consideration is that I simply has failed to find the
> appropriate place in the specifications.
> Many thanks in advance!
>

I'm assuming you are getting the warning on the 2.x codebased. I'll
make sure nothing changed on latest spec draft and take a look in
removing the warning.


-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: @Property annotation on private fields?

Posted by Luciano Resende <lu...@gmail.com>.
On Wed, Dec 16, 2009 at 9:31 AM, Luciano Resende <lu...@gmail.com> wrote:
> On Wed, Dec 16, 2009 at 8:33 AM, Mike Edwards
> <mi...@gmail.com> wrote:
>>
>> The OASIS SCA Java specifications (Java Common Annotations & APIs, Java POJO
>> Implementation) permits the @Property annotation on private fields (they do
>> not restrict the scope of the field at all).
>>
>> This was a deliberate change by OASIS.  Looks like Tuscany needs to change
>> to reflect this properly.
>>
>> Thanks for picking this up.
>>
>>
>> Yours,  Mike.
>>
>
> I'm looking into this, but after my changes some tests are failing and
> I'm investigating... should have this ready soon.
>

All Done, please let us know if you still see any other warning/issues
on this area.


-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: @Property annotation on private fields?

Posted by Luciano Resende <lu...@gmail.com>.
On Wed, Dec 16, 2009 at 8:33 AM, Mike Edwards
<mi...@gmail.com> wrote:
>
> The OASIS SCA Java specifications (Java Common Annotations & APIs, Java POJO
> Implementation) permits the @Property annotation on private fields (they do
> not restrict the scope of the field at all).
>
> This was a deliberate change by OASIS.  Looks like Tuscany needs to change
> to reflect this properly.
>
> Thanks for picking this up.
>
>
> Yours,  Mike.
>

I'm looking into this, but after my changes some tests are failing and
I'm investigating... should have this ready soon.

-- 
Luciano Resende
http://people.apache.org/~lresende
http://lresende.blogspot.com/

Re: @Property annotation on private fields?

Posted by Mike Edwards <mi...@gmail.com>.
keinmensch wrote:
> Hi!
> Exploring property injection on SCA components, I find that when I
> annotate an instance field in a class like this:
> @Property(name="fileContents", required=false)
> private String mFileContents;
> 
> There is a warning in the log when starting the SCA node:
> WARNING: Invalid annotation
> @org.oasisopen.sca.annotation.Property(name=fileContents,
> required=false) is found on private java.lang.String
> com.ivan.components.impl.PropertyPrinterServiceImpl.mFileContents
> 
> The SCA 1.0 specification clearly says that the @Property annotation may
> only be used on public or protected fields (Java Common Annotations and
> APIs, section 1.8.13), however I find no such limitations in the SCA 1.1
> specification.
> My questions is whether the above warning message is a remains from the
> SCA 1.0 days or if the SCA 1.1 specification forgets to mention that
> annotated fields must be public or protected? A third possibility that I
> should take into consideration is that I simply has failed to find the
> appropriate place in the specifications.
> Many thanks in advance!
> 

The OASIS SCA Java specifications (Java Common Annotations & APIs, Java POJO Implementation) permits 
the @Property annotation on private fields (they do not restrict the scope of the field at all).

This was a deliberate change by OASIS.  Looks like Tuscany needs to change to reflect this properly.

Thanks for picking this up.


Yours,  Mike.