[forge-dev] Fully qualified classes within annotations?

Lincoln Baxter, III lincolnbaxter at gmail.com
Fri Jan 13 12:42:58 EST 2012


As an ultimate fallback, you could even prompt the user to qualify the
type, but that will most likely be annoying to them. I would avoid this.

What are the downstream effects of this issue?

~Lincoln

On Fri, Jan 13, 2012 at 12:41 PM, Lincoln Baxter, III <
lincolnbaxter at gmail.com> wrote:

> Hey Richard,
>
> There is a method in JavaSource called resolveType(); This method will
> return the fully qualified type of the given Class name; however, there is
> a big issue here at the moment. We cannot resolve wildcards, or classes
> from the same package that are in the 'package' visibility scope.
>
> https://issues.jboss.org/browse/FORGE-424
>
> In these two cases, resolveType() will actually return the class name
> unchanged, which is your signal to take desperate measures, because I don't
> think that we will be fixing this in time for .Final. In the case of
> Column.class, I would start by assuming that the class is what you expect,
> and in the case of other unknown types, at this point - unfortunately -
> it's going to be up to you to figure out what that type is, and if
> reasonable assumptions can be made.
>
> Sorry about this, I know it's a big gap, but it's going to take a lot of
> work to fix this as you might be able to see in the issue. But definitely
> call resolveType() as a first step, then you'll have to "worry" about
> handling potential issues where the type information is not available.
>
> We also can't tell if a Class literal is a class, interface, enum, etc...
>
> ~Lincoln
>
>
> On Thu, Jan 12, 2012 at 11:46 PM, Richard Kennard <
> richard at kennardconsulting.com> wrote:
>
>> Lincoln,
>>
>> As you may recall, the new 'static Metawidget' scaffolding tries to reuse
>> Inspectors between the runtime/static worlds. To do this, it needs to reify
>> the
>> annotations from org.jboss.forge.parser.java.Annotations into 'proper'
>> java.lang.annotation.Annotations.
>>
>> This is mostly working, but I am struggling with reifying two things:
>>
>> 1. If the annotation's value is a Class
>> 2. If the annotation's value is another annotation
>>
>> The problem is the same in both cases - I am lacking the qualified name
>> of the class/annotation. If they user enters:
>>
>>     @MyAnnotation( Column.class )
>>
>> Then I need to know that it's actually a javax.persistence.Column.class.
>> This is a bit beyond me! I have left a couple of TODOs in
>> ForgePropertyStyle and
>> in ForgePropertyStyleTest. Could you take a look?
>>
>> Regards,
>>
>> Richard.
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>>
>
>
>
> --
> Lincoln Baxter, III
> http://ocpsoft.com
> http://scrumshark.com
> "Keep it Simple"
>



-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20120113/b1e4e8ae/attachment.html 


More information about the forge-dev mailing list