Skip to content

Exception "expecting EOF" #30

Closed
romani opened this Issue Oct 27, 2013 · 1 comment

1 participant

@romani
Checkstyle member
romani commented Oct 27, 2013

Created: 2011-08-24
Creator: Bjoern Kimminich
SF issue: 652

For the following code the Eclipse Checkstyle Plug-in 5.6 reports a strange error in line 6, the same from command line execution on :
"Folgende Ausnahme ist aufgetreten - expecting EOF, found 'getterMethod'"

public static Method findGetterMethod(Class<?> beanClass, String propertyName, Class<?> propertyType) {
    String getterName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
    Method getterMethod = findMethod(beanClass, getterName, new Class[] {}, propertyType);
    if (getterMethod == null && (boolean.class.equals(propertyType) || Boolean.class.equals(propertyType))) {
        getterName = "is" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
        getterMethod = findMethod(beanClass, getterName, new Class[] {}, propertyType);
    }
    return getterMethod;
}

my test:

22:33 ~/Temp/4 $ java -cp file:///home/rivanov/java/git-others/checkstyle/target/checkstyle-5.7-SNAPSHOT-all.jar com.puppycrawl.tools.checkstyle.Main -c file:///home/rivanov/java/git-others/checkstyle/sun_checks.xml /home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java
/home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java:13:15: expecting RPAREN, found '.'
/home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java:13:21: expecting IDENT, found '.'
/home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java:14:21: expecting IDENT, found '.'
Starting audit...
/home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java:0: File does not end with a newline.
/home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java:7:1: File contains tab characters (this is the first instance).
/home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java:13: Line has trailing spaces.
/home/rivanov/workspace-test/test/src/test/CheckStyleErrorTest.java:16:4: Got an exception - expecting EOF, found 'Class'
Audit done.

My File:

package test;

import java.lang.reflect.Method;

public class CheckStyleErrorTest {

    public static void main(String[] args) {
        Class[] classes = new Class[] {};
    }

    public static Method findGetterMethod(Class<?> beanClass,
            String propertyName, Class<?> propertyType, Method getterMethod) {
        if ((boolean.class.equals(propertyType) 
                || Boolean.class.equals(propertyType))) {
            propertyName = "";
            Class[] classes = new Class[] {}; //// Exception is here!!!
        }
        return getterMethod;
    }

    private static Method findMethod(Class<?> beanClass, String getterName,
            Class[] classes, Class<?> propertyType) {
        // TODO Auto-generated method stub
        return null;
    }
}
@romani
Checkstyle member
romani commented Jul 28, 2014

looks like is not reproducible after fix for #207.

@romani romani closed this Jul 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.