Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Error: "annotations are only available if source level is 1.5"
Error: "annotations are only available if source level is 1.5" [message #656051] Wed, 23 February 2011 16:46 Go to next message
Neil Bartlett is currently offline Neil Bartlett
Messages: 93
Registered: July 2009
Member
Hi, I'm having more adventures with EMF in a non-plugin project.

After generating my model code for the first time, I am unable to reload
the genmodel from the annotated Java. Looking in the error log, I
noticed this error:

"A problem was detected while parsing a Java fileLine 60: Syntax
error, annotations are only available if source level is 1.5
Line 105: Syntax error, annotations are only available if source level
is 1.5"

However the project definitely is at source level 1.5. From my
..settings/org.eclipse.jdt.core.prefs:

org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5

And from my .classpath:

<classpathentry kind="con"
path=" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte rnal.debug.ui.launcher.StandardVMType/J2SE-1.5 "/>

So, where is EMF getting the idea that this project is not at source
level 1.5? And why does this problem only happen after I generate model
code for the first time?

Many thanks,
Neil
Re: Error: "annotations are only available if source level is 1.5" [message #656054 is a reply to message #656051] Wed, 23 February 2011 17:06 Go to previous messageGo to next message
Neil Bartlett is currently offline Neil Bartlett
Messages: 93
Registered: July 2009
Member
In fact this problem is also happening even on a completely
straightforward "by the book" PDE project.

I can only ever generate model code once. After that, EMF chokes on the
annotations in its own generated code.

Regards,
Neil


On 23/02/2011 21:46, Neil Bartlett wrote:
> Hi, I'm having more adventures with EMF in a non-plugin project.
>
> After generating my model code for the first time, I am unable to reload
> the genmodel from the annotated Java. Looking in the error log, I
> noticed this error:
>
> "A problem was detected while parsing a Java fileLine 60: Syntax error,
> annotations are only available if source level is 1.5
> Line 105: Syntax error, annotations are only available if source level
> is 1.5"
>
> However the project definitely is at source level 1.5. From my
> .settings/org.eclipse.jdt.core.prefs:
>
> org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
> org.eclipse.jdt.core.compiler.compliance=1.5
> org.eclipse.jdt.core.compiler.source=1.5
>
> And from my .classpath:
>
> <classpathentry kind="con"
> path=" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte rnal.debug.ui.launcher.StandardVMType/J2SE-1.5 "/>
>
>
> So, where is EMF getting the idea that this project is not at source
> level 1.5? And why does this problem only happen after I generate model
> code for the first time?
>
> Many thanks,
> Neil
Re: Error: "annotations are only available if source level is 1.5" [message #656063 is a reply to message #656054] Wed, 23 February 2011 19:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
Neil,

Maybe the MANIFEST.MF has contradictory settings? (Which seems related
to your previous question.)


Neil Bartlett wrote:
> In fact this problem is also happening even on a completely
> straightforward "by the book" PDE project.
>
> I can only ever generate model code once. After that, EMF chokes on
> the annotations in its own generated code.
>
> Regards,
> Neil
>
>
> On 23/02/2011 21:46, Neil Bartlett wrote:
>> Hi, I'm having more adventures with EMF in a non-plugin project.
>>
>> After generating my model code for the first time, I am unable to reload
>> the genmodel from the annotated Java. Looking in the error log, I
>> noticed this error:
>>
>> "A problem was detected while parsing a Java fileLine 60: Syntax error,
>> annotations are only available if source level is 1.5
>> Line 105: Syntax error, annotations are only available if source level
>> is 1.5"
>>
>> However the project definitely is at source level 1.5. From my
>> .settings/org.eclipse.jdt.core.prefs:
>>
>> org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
>> org.eclipse.jdt.core.compiler.compliance=1.5
>> org.eclipse.jdt.core.compiler.source=1.5
>>
>> And from my .classpath:
>>
>> <classpathentry kind="con"
>> path=" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte rnal.debug.ui.launcher.StandardVMType/J2SE-1.5 "/>
>>
>>
>>
>> So, where is EMF getting the idea that this project is not at source
>> level 1.5? And why does this problem only happen after I generate model
>> code for the first time?
>>
>> Many thanks,
>> Neil
>
Re: Error: "annotations are only available if source level is 1.5" [message #656064 is a reply to message #656054] Wed, 23 February 2011 19:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
Neil,

Maybe the MANIFEST.MF has contradictory settings? (Which seems related
to your previous question.)


Neil Bartlett wrote:
> In fact this problem is also happening even on a completely
> straightforward "by the book" PDE project.
>
> I can only ever generate model code once. After that, EMF chokes on
> the annotations in its own generated code.
>
> Regards,
> Neil
>
>
> On 23/02/2011 21:46, Neil Bartlett wrote:
>> Hi, I'm having more adventures with EMF in a non-plugin project.
>>
>> After generating my model code for the first time, I am unable to reload
>> the genmodel from the annotated Java. Looking in the error log, I
>> noticed this error:
>>
>> "A problem was detected while parsing a Java fileLine 60: Syntax error,
>> annotations are only available if source level is 1.5
>> Line 105: Syntax error, annotations are only available if source level
>> is 1.5"
>>
>> However the project definitely is at source level 1.5. From my
>> .settings/org.eclipse.jdt.core.prefs:
>>
>> org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
>> org.eclipse.jdt.core.compiler.compliance=1.5
>> org.eclipse.jdt.core.compiler.source=1.5
>>
>> And from my .classpath:
>>
>> <classpathentry kind="con"
>> path=" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte rnal.debug.ui.launcher.StandardVMType/J2SE-1.5 "/>
>>
>>
>>
>> So, where is EMF getting the idea that this project is not at source
>> level 1.5? And why does this problem only happen after I generate model
>> code for the first time?
>>
>> Many thanks,
>> Neil
>
Re: Error: "annotations are only available if source level is 1.5" [message #656310 is a reply to message #656063] Thu, 24 February 2011 20:12 Go to previous messageGo to next message
Neil Bartlett is currently offline Neil Bartlett
Messages: 93
Registered: July 2009
Member
Ed, comment below.

On 24/02/2011 00:10, Ed Merks wrote:
> Neil,
>
> Maybe the MANIFEST.MF has contradictory settings? (Which seems related
> to your previous question.)

No it has nothing to do with that at all. EMF is barfing even in a
completely conventional PDE project.

I suspect there was something wrong with the workspace or the Eclipse
installation. After creating a new workspace and installing EMF tooling
into a new Eclipse, everything works again. Go figure :-/

Neil

>
>
> Neil Bartlett wrote:
>> In fact this problem is also happening even on a completely
>> straightforward "by the book" PDE project.
>>
>> I can only ever generate model code once. After that, EMF chokes on
>> the annotations in its own generated code.
>>
>> Regards,
>> Neil
>>
>>
>> On 23/02/2011 21:46, Neil Bartlett wrote:
>>> Hi, I'm having more adventures with EMF in a non-plugin project.
>>>
>>> After generating my model code for the first time, I am unable to reload
>>> the genmodel from the annotated Java. Looking in the error log, I
>>> noticed this error:
>>>
>>> "A problem was detected while parsing a Java fileLine 60: Syntax error,
>>> annotations are only available if source level is 1.5
>>> Line 105: Syntax error, annotations are only available if source level
>>> is 1.5"
>>>
>>> However the project definitely is at source level 1.5. From my
>>> .settings/org.eclipse.jdt.core.prefs:
>>>
>>> org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
>>> org.eclipse.jdt.core.compiler.compliance=1.5
>>> org.eclipse.jdt.core.compiler.source=1.5
>>>
>>> And from my .classpath:
>>>
>>> <classpathentry kind="con"
>>> path=" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.inte rnal.debug.ui.launcher.StandardVMType/J2SE-1.5 "/>
>>>
>>>
>>>
>>> So, where is EMF getting the idea that this project is not at source
>>> level 1.5? And why does this problem only happen after I generate model
>>> code for the first time?
>>>
>>> Many thanks,
>>> Neil
>>
Re: Error: "annotations are only available if source level is 1.5" [message #667665 is a reply to message #656064] Sat, 30 April 2011 16:32 Go to previous messageGo to next message
Torkild U. Resheim is currently offline Torkild U. Resheim
Messages: 9
Registered: July 2009
Junior Member
Hi guys,

I'm having the same problem on two different projects using Eclipse 3.6.2. I've tried setting the projects to use both 1.5 and 1.6, to no avail. Did you figure this one out Neil?

Thanks,
Torkild
Re: Error: "annotations are only available if source level is 1.5" [message #667672 is a reply to message #667665] Sun, 01 May 2011 01:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
Hi Torkild

Check that the annotation next to the JRE System Library for your
project in the Project explorer doesn't say 1.4 or lower.

Check that the Complaince level in your genmodel is not 1.4.

Try "Update the classpath settings" from the manifest overview page.

Make sure Build automatically is on.

Try a clean all projects.

Try a close all projects, then open again.

Try a new Workspace.

Regards

Ed Willink


On 30/04/2011 21:32, Torkild U. Resheim wrote:
> Hi guys,
>
> I'm having the same problem on two different projects using Eclipse
> 3.6.2. I've tried setting the projects to use both 1.5 and 1.6, to no
> avail. Did you figure this one out Neil?
>
> Thanks,
> Torkild
Re: Error: "annotations are only available if source level is 1.5" [message #676477 is a reply to message #667672] Sat, 04 June 2011 14:49 Go to previous messageGo to next message
Torkild U. Resheim is currently offline Torkild U. Resheim
Messages: 9
Registered: July 2009
Junior Member
Thanks Ed,

Did everything except starting a new workspace (it will just take too much time) to no avail. So I filed bug 348304.
(no subject) [message #687384 is a reply to message #667672] Sat, 04 June 2011 14:49 Go to previous messageGo to next message
Torkild U. Resheim is currently offline Torkild U. Resheim
Messages: 9
Registered: July 2009
Junior Member
Thanks Ed,

Did everything except starting a new workspace (it will just take too much time) to no avail. So I filed bug 348304.
Re: Error: "annotations are only available if source level is 1.5" [message #710932 is a reply to message #656051] Fri, 05 August 2011 11:34 Go to previous messageGo to next message
thedug  is currently offline thedug
Messages: 2
Registered: August 2011
Junior Member
Did you ever figure this one out? I'm having the same problem.

Douglas

[Updated on: Fri, 05 August 2011 11:34]

Report message to a moderator

Re: Error: &quot;annotations are only available if source level is 1.5&quot; [message #710949 is a reply to message #710932] Fri, 05 August 2011 11:59 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4035
Registered: July 2009
Senior Member
Hi

Read the thread. It point at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=348304 where the solution
lies.

The above and the thread provide many alternatives too.

Regards

Ed Willink

On 05/08/2011 16:34, thedug wrote:
> Did you ever figure this one out? I'm having the same problem.
>
> Douglas
Re: Error: &quot;annotations are only available if source level is 1.5&quot; [message #929585 is a reply to message #710949] Mon, 01 October 2012 11:31 Go to previous messageGo to next message
Peter Rimshnick is currently offline Peter Rimshnick
Messages: 4
Registered: September 2012
Junior Member
I'm having the same problem, even though I'm using EMF 2.8. Curiously, when the genModel compliance level is set to 1.4, I get three errors of this type, but when I set it to 50 or above I get many more errors of this type. My project compliance is set to 1.5, my JRE is 60.
Re: Error: &amp;quot;annotations are only available if source level is 1.5&amp;quot; [message #930209 is a reply to message #929585] Tue, 02 October 2012 01:30 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
There is a long thread in that bugzilla; I'm not sure if you tried all
those things. In any case, something about your JDT settings or your
installed JREs must be a little off, but I can't guess that from what
you've said.


On 01/10/2012 5:31 PM, Peter Rimshnick wrote:
> I'm having the same problem, even though I'm using EMF 2.8. Curiously,
> when the genModel compliance level is set to 1.4, I get three errors
> of this type, but when I set it to 50 or above I get many more errors
> of this type. My project compliance is set to 1.5, my JRE is 60.
Previous Topic:[CDO] 'Decoration Calculation' error using CDO Sessions View
Next Topic:Dynamic Model: invalid classifier
Goto Forum:
  


Current Time: Fri Aug 29 01:36:33 EDT 2014

Powered by FUDForum. Page generated in 0.03158 seconds