Search code examples
javaeclipsesupercsv

Eclipse Super CSV is not recognizing method correctly


I just used super csv in a project that I just turned in and worked just fine. I have the jar in my build path and everything just like the first project. So where is my issue, in the first project, I had used the

void write(Object... columns) throws IOException;

method and it worked just fine.. I was putting in different values that would be used, line int, int, long, long, long, long, long, long is what I put in for the first time and it worked just fine...

Now in my second project, IN THE SAME WORKSPACE, eclipse recognizes the same method as

void write(Object[] columns) throws IOException;

I really dont know how to fix this, any suggestions would be great!


Solution

  • I believe Rekin is on the right track.

    If your project's compiler compliance is less than 1.5, then var-arg methods will lose their variable argument functionality in Eclipse, and will appear as they are really implemented (as an array).

    That's probably the key thing Java beginners need to know about var-args - they're really just a convenient way to simplify passing arrays into methods. You're still passing an array in and if you don't supply any var-args then the array you pass in is actually null.

    Super CSV is compiled for Java 1.5, so you shouldn't use it with an older JDK. Fixing this (right-click on your project, it's under Java Compiler) should restore the var-arg notation in Eclipse.