JavaNCSS
  1. JavaNCSS
  2. JAVANCSS-17

JavaNCSS fails to parse calls like "super.<T>foo()".

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 30.51
    • Fix Version/s: 32.53
    • Labels:
      None
    • Number of attachments :
      2

      Description

      JavaNCSS fails to parse Class2 in the example below:

      public class Class1 {
      public <T> T foo()

      { return null; }

      }

      class Class2 extends Class1 {
      public <T> T bar()

      { return this.<T>foo(); }

      public <T> T foo()

      { return super.<T>foo(); }

      }

      Note that "this.<T>foo()" seems to be parsed correctly, but "super.<T>foo()" seems to trip the parser:

      ParseException in /home/SGLINZ03/jsa/tmp/Class1.java
      Last useful checkpoint: "Class2.foo()"
      Encountered "<" at line 12, column 18.
      Was expecting one of:
      "assert" ...
      <IDENTIFIER> ...

      1. Class1.java
        0.2 kB
        Joachim Sauer
      2. JAVANCSS-17_patch.diff
        0.9 kB
        Sébastien Reynaud

        Activity

        Hide
        Herve Boutemy added a comment -

        can you attach a sample code, which compiles but that JavaNCSS fails to parse?

        Show
        Herve Boutemy added a comment - can you attach a sample code, which compiles but that JavaNCSS fails to parse?
        Hide
        Joachim Sauer added a comment -

        This .java file contains the example the example given above.

        It compiles correctly in javac (1.6.0_13 and 1.5.0_18) as well as the eclipse compiler (0.894_R34x, 3.4.2 release) but fails to be parsed by JavaNCSS (30.51).

        Show
        Joachim Sauer added a comment - This .java file contains the example the example given above. It compiles correctly in javac (1.6.0_13 and 1.5.0_18) as well as the eclipse compiler (0.894_R34x, 3.4.2 release) but fails to be parsed by JavaNCSS (30.51).
        Hide
        Sébastien Reynaud added a comment -

        attached the patch.

        Show
        Sébastien Reynaud added a comment - attached the patch.
        Hide
        Herve Boutemy added a comment -

        patch included in r171
        thank you Sébastien

        Show
        Herve Boutemy added a comment - patch included in r171 thank you Sébastien

          People

          • Assignee:
            Herve Boutemy
            Reporter:
            Joachim Sauer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: