Home » Language IDEs » Java Development Tools (JDT) » Generics, failure to compile, "Got an exception - expecting EOF"
| Generics, failure to compile, "Got an exception - expecting EOF" [message #220672] |
Thu, 15 December 2005 10:31  |
Eclipse User |
|
|
|
Originally posted by: matt.gumbley.mailinator.com
Background: I've upgraded my Eclipse from 3.0 to 3.1 to 3.1.1 (just by
unzipping the new version, not going through any migration process).
I've been working on one particular project throughout these upgrades,
and want to start working with Generics.
e.g. I added the following class:
public class GenericsTest {
private ArrayList<Object> myList;
public GenericsTest() {
myList = new ArrayList<Object>();
}
public void add(Object o) {
myList.add(o);
}
}
When I add this to my project, I see a Problem:
Got an exception - expecting EOF, found 'myList' (line 0)
.... which is clearly wrong. Nothing I've done so far has fixed this.
However, if I create a new Java project, and create the exact same class
there, it compiles fine.
I'm thinking that there's something somewhere in a project's metadata
that causes the JDT compiler to fail?
I have the compiler compliance level at 5.0, and I'm using the default
compliance settings. I have this set globally, not on a per-project basis.
Could anyone help me change my project's settings to get this compiling?
regards,
Matt
(Replies to the group only please)
|
|
| |
| Re: Generics, failure to compile, "Got an exception - expecting EOF" [message #220686 is a reply to message #220679] |
Thu, 15 December 2005 11:50   |
Eclipse User |
|
|
|
Originally posted by: matt.gumbley.mailinator.com
Olivier Thomann wrote:
> Matt Gumbley a écrit :
>
>> Background: I've upgraded my Eclipse from 3.0 to 3.1 to 3.1.1 (just by
>> unzipping the new version, not going through any migration process).
>
> You should not unzip on top of existing Eclipse installation.
> I would highly recommand that you create a fresh installation of 3.1.1
> and see if you still have the same problem.
> --
> Olivier
Olivier, apologies, I should have been clearer - this is what I did,
renaming my old installation, and unzipping the new version into
C:\java\eclipse. By "not going through any migration process", I mean I
didn't export project settings from the earlier version, and import them
into the new version.
It's odd that Generics work in new projects, but not in old ones...
I get the same problem when adding @SuppressWarnings("unchecked") to
methods where I'm not using generics: "Got an exception - unexpected
char: '@'"
Regards,
Matt
|
|
|
| Re: Generics, failure to compile, "Got an exception - expecting EOF" [message #220700 is a reply to message #220686] |
Thu, 15 December 2005 12:34   |
Eclipse User |
|
|
|
Originally posted by: matt.gumbley.mailinator.com
Some more info: I quit Eclipse, renamed its installation directory,
unzipped the 3.1.1 archive again, restarted, and built the offending
project successfully with generics. No problems.
Switching back to my earlier Eclipse installation, and it's OK now.
Remove the <Object> from ArrayList<Object>, and it complains about type
safety. Add it back in, and I get the error again.
Switching back to stock Eclipse, and removing <Object> and reinserting
it, and I do NOT get the error....
.... so I'm assuming that something I've installed on top of stock
Eclipse is causing the problem, since I don't get it on stock Eclipse 3.1.1.
The project this happens in has this .project:
<projectDescription>
<name>peripheral_fujitsu_f50</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder </name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature </nature>
<nature>org.eclipse.cdt.core.cnature</nature>
</natures>
</projectDescription>
I'll be putting Checkstyle and the CDT under the microscope tomorrow
(these are installed on my 'main' Eclipse' installation, as well as EPIC
for Perl and RDT for Ruby, and probably some others)...
regards,
Matt
Matt Gumbley wrote:
> Olivier Thomann wrote:
>
>> Matt Gumbley a écrit :
>>
>>> Background: I've upgraded my Eclipse from 3.0 to 3.1 to 3.1.1 (just
>>> by unzipping the new version, not going through any migration process).
>>
>>
>> You should not unzip on top of existing Eclipse installation.
>> I would highly recommand that you create a fresh installation of 3.1.1
>> and see if you still have the same problem.
>> --
>> Olivier
>
>
> Olivier, apologies, I should have been clearer - this is what I did,
> renaming my old installation, and unzipping the new version into
> C:\java\eclipse. By "not going through any migration process", I mean I
> didn't export project settings from the earlier version, and import them
> into the new version.
>
> It's odd that Generics work in new projects, but not in old ones...
>
> I get the same problem when adding @SuppressWarnings("unchecked") to
> methods where I'm not using generics: "Got an exception - unexpected
> char: '@'"
>
> Regards,
> Matt
|
|
|
| Re: Generics, failure to compile, "Got an exception - expecting EOF" [message #220757 is a reply to message #220700] |
Fri, 16 December 2005 06:33  |
Eclipse User |
|
|
|
Originally posted by: matt.gumbley.mailinator.com
It was an old version of CheckStyle (3.4.1.0) causing the problem.
However "Got an exception..." isn't the best way of reporting a problem
- nothing in the log... getting properties up on the error didn't say
scream "this is a CheckStyle problem" to me...
Unchecking the CheckStyle builder didn't cure it.
M.
|
|
|
Goto Forum:
Current Time: Thu Nov 06 13:52:00 EST 2025
Powered by FUDForum. Page generated in 0.30368 seconds
|