JavaNCSS
  1. JavaNCSS
  2. JAVANCSS-50

method arguments that uses generic loses the type in reports

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 32.53
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      java
    • Number of attachments :
      6

      Description

      Consider following class.

      public class FlushTestListener implements TestListener{
          public static void delete( Collection<? extends Object> toBeDeleted )
      	{
      		if ( true ) {
                  //do
              }
      	}
      	public static void delete( Collection<String> toBeDeleted )
      	{
      		if ( true ) {
                  //do
              }
      	}
      }

      In the complexity report, the name of method arguments are wrong- it lost the collection part.

        1    2   2    0 net.sourceforge.cobertura.ant.FlushTestListener.delete(Object)
        2    2   2    0 net.sourceforge.cobertura.ant.FlushTestListener.delete(String)
      1. FlushTestListener.java
        0.5 kB
        Jayan
      2. FlushTestListener.java
        0.5 kB
        Jayan
      3. javancss50-type-parameters.patch
        3 kB
        Yves Martin
      4. Test0.java
        0.4 kB
        Jayan
      5. Test1.java
        0.5 kB
        Jayan

        Activity

        Hide
        Yves Martin added a comment -

        Here is a patch to fix parameters parsing to get them better in report. Also the compiled javancss.parser.JavaParser.class for you to patch your jar file.

        Show
        Yves Martin added a comment - Here is a patch to fix parameters parsing to get them better in report. Also the compiled javancss.parser.JavaParser.class for you to patch your jar file.
        Hide
        Jayan added a comment -

        The fix from YVes Martin creates correct output for methods like FlushTestListener.delete(Collection<? extends Object>)
        .

        This however fails to parse code like below.. (fails at += )

        if ( true ) {
        //do
        int dist=0;
        if (dist == 1 || (dist += countNum1s(dist)) > 1)

        { return ; // Not D01 }
        Show
        Jayan added a comment - The fix from YVes Martin creates correct output for methods like FlushTestListener.delete(Collection<? extends Object>) . This however fails to parse code like below.. (fails at += ) if ( true ) { //do int dist=0; if (dist == 1 || (dist += countNum1s(dist)) > 1) { return ; // Not D01 }
        Hide
        Jayan added a comment -

        Different test cases

        Show
        Jayan added a comment - Different test cases
        Hide
        Yves Martin added a comment -

        Here is the compiled jar file from 32.53 sources with patch applied.

        Show
        Yves Martin added a comment - Here is the compiled jar file from 32.53 sources with patch applied.
        Hide
        Jayan added a comment -

        This is working correctly. Great effort.

        could you upload the source code changes

        Show
        Jayan added a comment - This is working correctly. Great effort. could you upload the source code changes

          People

          • Assignee:
            Unassigned
            Reporter:
            Jayan
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: