Menu

#804 False +: System.arraycopy is more efficient

open
nobody
pmd (543)
5
2012-10-07
2008-09-17
No

It needs to check if source and dest are the same primitive type.

public void xxxx(byte[] ayInputChannelNumber)
{
int[] aiInputChannelNumber = new int[ayInputChannelNumber.length];
for (int i = 0; i < aiInputChannelNumber.length; i++)
{
aiInputChannelNumber[i] = ayInputChannelNumber[i];
}
}

Discussion

  • Romain PELISSE

    Romain PELISSE - 2009-01-29

    I'll see if i can reproduce this issue and maybe fix it...

     
  • Romain PELISSE

    Romain PELISSE - 2009-01-29

    FYI

    I reproduced this issue and just commited the testcase. I'll still have to find a fix.

     
  • Romain PELISSE

    Romain PELISSE - 2009-02-08

    Hi,

    I look into your issue this weekend. As the XPath expression to handle
    this rule is already quite complex, it sounds (to me) not really a good
    idea to make even more complex just in order to do some type checking. I
    think we either have to accept this limitation (which i don't like because
    i'm pretty sure people running java in real time constraint can be pissed
    off by those false+) or maybe rewrite the rule in Java.

    I would do such a rewriting but I'll appreciate if you (or other people
    from pmd) have some input about this. i'll hate to rewrite the rule just to
    discover that Xavier or Ryan has fixed this issue using a small XPath trick
    that i don't knew of :)

     

Log in to post a comment.