[ checkstyle-Bugs-1667137 ] Exception - expecting EOF still in version 4.3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[ checkstyle-Bugs-1667137 ] Exception - expecting EOF still in version 4.3

SourceForge.net
Bugs item #1667137, was opened at 2007-02-23 06:48
Message generated for change (Comment added) made by derekc
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=1667137&group_id=29721

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core Framework
Group:  release 4.3
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Harri (n116373)
Assigned to: Nobody/Anonymous (nobody)
Summary: Exception - expecting EOF still in version 4.3

Initial Comment:
The following class causes an exception in checkstyle 4.3, at least with eclipse-cs 4.3.0 plugin:
package foo.bar;

import java.util.List;

interface Foo {
    public <T> List<T> bar(T foobar);
}

public class CheckstyleBug {

    public void foo() {
        Foo foo = new Foo() {
            public <T> List<T> bar(T foobar) {
                return null;
            }
        };
    }
   
}

If the anonymous inner class is converted to a real class, the exception disappeares.

The log file contains:
!ENTRY com.atlassw.tools.eclipse.checkstyle 1 0 2007-02-23 16:41:09.342

!MESSAGE Checkstyle-Plugin: RecognitionException occured.

!STACK 0

D:\work\...\src\test\java\foo\bar\CheckstyleBug.java:15:13: expecting EOF, found '}'

        at antlr.Parser.match(Parser.java:211)

        at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer.compilationUnit(GeneratedJavaRecognizer.java:210)

        at com.puppycrawl.tools.checkstyle.TreeWalker.parse(TreeWalker.java:579)

        at com.puppycrawl.tools.checkstyle.TreeWalker.parse(TreeWalker.java:542)

        at com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:243)

        at com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:590)

        at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:239)

        at com.atlassw.tools.eclipse.checkstyle.builder.Auditor.runAudit(Auditor.java:193)

        at com.atlassw.tools.eclipse.checkstyle.builder.CheckstyleBuilder.handleBuildSelection(CheckstyleBuilder.java:341)

        at com.atlassw.tools.eclipse.checkstyle.builder.CheckstyleBuilder.build(CheckstyleBuilder.java:212)

        at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:603)

...

----------------------------------------------------------------------

Comment By: Derek (derekc)
Date: 2012-07-18 03:50

Message:
We are looking into adopting checkstyle but hitting this on several classes
as well (which will sadly prevent adoption).  It would be awesome to get a
new version out with the patch referenced from the previous comment applied
(assuming it works of course).

----------------------------------------------------------------------

Comment By: Lukas Platinsky (laky23)
Date: 2011-08-18 04:13

Message:
I proposed a patch to this bug, which can be found at
http://sourceforge.net/tracker/?func=detail&aid=3393810&group_id=29721&atid=397080

----------------------------------------------------------------------

Comment By: Brendan Humphreys (brendanh)
Date: 2011-01-12 19:15

Message:
This is still present in 5.3. The following code reproduces the error:

class CheckstyleIsBroken {

    void checkstyleIsBroken() {
        CheckstyleIsBroken borkage = new CheckstyleIsBroken() {

            <T extends CheckstyleIsBroken> T borked(T brokenness) {
                return brokenness;
            }
        };
    }
}






----------------------------------------------------------------------

Comment By: rms (rmsid)
Date: 2009-03-16 09:54

Message:
There are 2 problems here.
For the generics problem, in (line 2311 of mine)
com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaRecognizer,
checkstyle-4.4, in the typeParameters method, it wants to read:
  if (!(isThereASingleGtToEmit()) && inputState.guessing == 0)
rather than:
  if (!(isThereASingleGtToEmit()))

For the second problem, there is a missing case: COMMA in the
arrayInitializer method (line 4533 in mine).
Adding:
  case:COMMA:
  {
   match(COMMA);
   break;
  }
(in line 4621) works.

----------------------------------------------------------------------

Comment By: Tim Moore (moreginger)
Date: 2009-02-19 06:51

Message:
I'm still seeing the original bug with a generic method in Checkstyle 4.4.

----------------------------------------------------------------------

Comment By: Michal Dobisek (mdobisek)
Date: 2008-04-15 04:18

Message:
Logged In: YES
user_id=2063595
Originator: NO

I am getting the same error in Checkstyle 4.4 from this piece of code:

public class CheckstyleBug {
    public static void main(String[] args) {
        int[] myArray = new int[] { , };
        System.out.println(myArray.length);
    }
}

Checkstyle aparently gets confused by the odd (but valid) expression "{ ,
};"

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397078&aid=1667137&group_id=29721

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Checkstyle-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/checkstyle-devel
Loading...