JavaNCSS

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
  • Component/s: None
  • 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
    25/May/09 4:05 AM
    0.2 kB
    Joachim Sauer
  2. JAVANCSS-17_patch.diff
    28/May/09 4:45 AM
    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

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: