You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Enrique Rodriguez <en...@gmail.com> on 2007/05/28 09:02:47 UTC

[ApacheDS] Unnecessary casts in schema-bootstrap generated sources

Hi, Directory developers,

In the generated sources in 'apacheds-schema-bootstrap' there are many
unnecessary casts, all in the same "setNames()" lines.  For example,
in ApacheAttributeTypeProducer:79:

        attributeType.setNames( ( String[] ) names.toArray( EMPTY ) );

The cast to String[] is unnecessary.  The issue for me is this
produces several hundred "unnecessary cast" warnings, possibly
thousands, since my warnings are way past my listing limit (100 of
~11,000).

Is this an easy fix somewhere?  I looked around the bootstrap-plugin
and related files but it wasn't immediately obvious where the
generated text was coming from.

Want a JIRA?

Enrique

Re: [ApacheDS] Unnecessary casts in schema-bootstrap generated sources

Posted by Emmanuel Lecharny <el...@gmail.com>.
Hi Stefan, Enrique,

I think we can removed those useless casts in one shot by modifying
the two velocity templates into apacheds-core-plugin (in
src/main/resources/org/apache/directory/server/core/tools/schema)
AttributeTypes.template and
ObjectClasses.template

where you have those lines :
objectClass.setNames( ( String[] ) array.toArray( EMPTY ) );
and
attributeType.setNames( ( String[] ) names.toArray( EMPTY ) );

I gonna check if it's correct.

Emmanuel

On 5/28/07, Stefan Zoerner <st...@labeo.de> wrote:
> Enrique Rodriguez wrote:
> > On 5/28/07, Emmanuel Lecharny <el...@apache.org> wrote:
> >> ...
> >> Can you simply disable the warning for this project (I guess you are
> >> using eclipse)
> >
> > Sure, I can disable it, but I lose the warnings for non-generated
> > sources.  I realize this isn't a huge deal.  I was hoping it might be
> > a quick template fix.
> >
> > Enrique
>
> Please raise a JIRA with low priority. New committees or people who are
> still not very familiar with the system (like me) can use it as a low
> hanging fruit for little experiences of success.
>
> Thanks,
>      Stefan
>
>
>


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: [ApacheDS] Unnecessary casts in schema-bootstrap generated sources

Posted by Enrique Rodriguez <en...@gmail.com>.
On 5/28/07, Emmanuel Lecharny <el...@gmail.com> wrote:
> No need for a JIRA any more :)
>
> I have fixed the issue :
> http://svn.apache.org/viewvc?view=rev&rev=542197
>
> Can you give me a feedback Enrique? (svn up, mvn clean install)

Looks good, thanks Emm!!!

Enrique

Re: [ApacheDS] Unnecessary casts in schema-bootstrap generated sources

Posted by Emmanuel Lecharny <el...@gmail.com>.
No need for a JIRA any more :)

I have fixed the issue :
http://svn.apache.org/viewvc?view=rev&rev=542197

Can you give me a feedback Enrique? (svn up, mvn clean install)

Thanks !

On 5/28/07, Stefan Zoerner <st...@labeo.de> wrote:
> Enrique Rodriguez wrote:
> > On 5/28/07, Emmanuel Lecharny <el...@apache.org> wrote:
> >> ...
> >> Can you simply disable the warning for this project (I guess you are
> >> using eclipse)
> >
> > Sure, I can disable it, but I lose the warnings for non-generated
> > sources.  I realize this isn't a huge deal.  I was hoping it might be
> > a quick template fix.
> >
> > Enrique
>
> Please raise a JIRA with low priority. New committees or people who are
> still not very familiar with the system (like me) can use it as a low
> hanging fruit for little experiences of success.
>
> Thanks,
>      Stefan
>
>
>


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Re: [ApacheDS] Unnecessary casts in schema-bootstrap generated sources

Posted by Stefan Zoerner <st...@labeo.de>.
Enrique Rodriguez wrote:
> On 5/28/07, Emmanuel Lecharny <el...@apache.org> wrote:
>> ...
>> Can you simply disable the warning for this project (I guess you are
>> using eclipse)
> 
> Sure, I can disable it, but I lose the warnings for non-generated
> sources.  I realize this isn't a huge deal.  I was hoping it might be
> a quick template fix.
> 
> Enrique

Please raise a JIRA with low priority. New committees or people who are 
still not very familiar with the system (like me) can use it as a low 
hanging fruit for little experiences of success.

Thanks,
     Stefan



Re: [ApacheDS] Unnecessary casts in schema-bootstrap generated sources

Posted by Enrique Rodriguez <en...@gmail.com>.
On 5/28/07, Emmanuel Lecharny <el...@apache.org> wrote:
> ...
> Can you simply disable the warning for this project (I guess you are
> using eclipse)

Sure, I can disable it, but I lose the warnings for non-generated
sources.  I realize this isn't a huge deal.  I was hoping it might be
a quick template fix.

Enrique

Re: [ApacheDS] Unnecessary casts in schema-bootstrap generated sources

Posted by Emmanuel Lecharny <el...@apache.org>.
Enrique Rodriguez a écrit :

> Hi, Directory developers,

Hi,

>
> In the generated sources in 'apacheds-schema-bootstrap' there are many
> unnecessary casts, all in the same "setNames()" lines.  For example,
> in ApacheAttributeTypeProducer:79:
>
>        attributeType.setNames( ( String[] ) names.toArray( EMPTY ) );

There was a velocity pattern which is used to generate those files, but 
as they have been generated once when we modified the Schema system, I'm 
not sure we can easily regenrate them (not sure).

>
> The cast to String[] is unnecessary.  The issue for me is this
> produces several hundred "unnecessary cast" warnings, possibly
> thousands, since my warnings are way past my listing limit (100 of
> ~11,000).

Can you simply disable the warning for this project (I guess you are 
using eclipse)

>
> Is this an easy fix somewhere?  I looked around the bootstrap-plugin
> and related files but it wasn't immediately obvious where the
> generated text was coming from.
>
> Want a JIRA?

Well, not sure this is necessary. We still have to fix all those 
warnings all over the code and it takes time, but - as you did today - 
we are doing it on the fly. However, you can create one if you feel so, 
it's not such a big deal to have one more JIRA !

Emmanuel