Check that the Compiler compliance level
is set to at least 1.5 for your project:
Project > Properties > Java Compiler
if Enable project specific settings
is not set, use the Configue Workspace Settings...
link on that page to check the global Compiler compliance level
.