Eclipse PDE: Syntax error, type annotations are available only when source level is at least 1.8

StackOverflow https://stackoverflow.com/questions/23629116

  •  21-07-2023
  •  | 
  •  

Question

I am having hundreds of the same error: Syntax error, type annotations are available only when source level is at least 1.8 after installing the WindowBuilder Eclipse plug-in. My setup is with Java 7, and I cannot upgrade to Java 8 yet. I have Java 7 and 8 installed, but my JRE and compiler are set to Java 7 via Window > Preferences > Java.

I believe that I found the problem, which is related to the org.eclipse.jdt.annotation plug-in, described here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434033

Any suggestions on how to fix this problem?

I noticed that I now have two org.eclipse.jdt.annotation plug-ins, versions 1.1.0 and 2.0.0. The problem is that 2.0.0 has a dependency on Java 1.8, and all of my plugins are referencing 2.0.0. I believe that changing these references to the earlier version should solve this, correct? How can I do this?

As a test, I altered my manifest file on one of my plug-in projects, but it does not remove the errors. Here is an excerpt where I tried to reference the 1.1.0 bundle version:

Require-Bundle: org.eclipse.ui,
 org.eclipse.core.resources,
 org.eclipse.core.runtime,
 org.eclipse.jdt.core,
 org.eclipse.ltk.core.refactoring,
 org.eclipse.jdt.ui,
 com.kivancmuslu.www.solstice.common,
 com.kivancmuslu.www.util.eclipse,
 com.kivancmuslu.www.util.eclipse.ui,
 org.eclipse.ui.workbench.texteditor,
 org.eclipse.ui.ide,
 org.eclipse.ui.editors,
 org.eclipse.jface.text,
 com.kivancmuslu.www.utils,
 org.eclipse.ui.console,
 org.eclipse.jdt.annotation;bundle-version="1.1.0"

UPDATE Yes, I am running Luna. After changing the last line of my manifest from

 org.eclipse.jdt.annotation;bundle-version="1.1.0"

to

 org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)"

the errors are gone. Thank you.

Was it helpful?

Solution

Big thanks to @greg-449 for bringing up the suggestion mentioned in the bug report, the credit goes to him. I am posting this answer for completeness and to help others:


Yes, I am running Luna. After changing the last line of my manifest from

 org.eclipse.jdt.annotation;bundle-version="1.1.0"

to

 org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)"

the errors are gone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top