简体   繁体   English

Eclipse PDE:语法错误,类型注释仅在源级别至少为1.8时可用

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

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. 我有数百个相同的错误: Syntax error, type annotations are available only when source level is at least 1.8在安装WindowBuilder Eclipse插件后Syntax error, type annotations are available only when source level is at least 1.8 My setup is with Java 7, and I cannot upgrade to Java 8 yet. 我的设置是使用Java 7,但我还无法升级到Java 8。 I have Java 7 and 8 installed, but my JRE and compiler are set to Java 7 via Window > Preferences > Java . 我安装了Java 7和8,但我的JRE和编译器通过Window > Preferences > Java设置为Java 7。

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 我相信我发现了这个问题,它与org.eclipse.jdt.annotation插件相关,如下所述: 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 . 我注意到我现在有两个org.eclipse.jdt.annotation插件,版本1.1.02.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 . 问题是2.0.0依赖于Java 1.8,我的所有插件都引用了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: 以下是我试图引用1.1.0捆绑版本的摘录:

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. 更新是的,我正在运行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. 谢谢。

Big thanks to @greg-449 for bringing up the suggestion mentioned in the bug report, the credit goes to him. 非常感谢@ greg-449提出错误报告中提到的建议,归功于他。 I am posting this answer for completeness and to help others: 我发布这个答案是为了完整性并帮助其他人:


Yes, I am running Luna. 是的,我正在运行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. 错误消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 仅当源级别为5.0语法错误Java时,注释才可用 - Annotations are only available if source level is 5.0 syntax error java 语法错误,注释仅在源级别为5.0时才可用 - Maven中的AspectJ - Syntax error, annotations are only available if source level is 5.0 - AspectJ in Maven eclipse 魔法:……语法错误,可变参数仅在源代码级别为 1.5 或更高时可用 - eclipse magic: … Syntax error, varargs are only available if source level is 1.5 or greater java -Syntax错误,仅当源级别为5.0时,参数化类型才可用 - java -Syntax error, parameterized types are only available if source level is 5.0 语法错误,“for each”语句仅在源级别为 1.5 或更高时可用 - Syntax error, 'for each' statements are only available if source level is 1.5 or greater Eclipse:语法错误,参数化类型仅当源级别为 1.5 时 - Eclipse: Syntax Error, parameterized types are only if source level is 1.5 Java 8 Eclipse Luna 4.4 GWT 2.8错误:Lambda表达式仅在源级别1.8或更高级别上才允许 - Java 8 Eclipse Luna 4.4 GWT 2.8 Error: Lambda expressions are allowed only at source level 1.8 or above Java - Iterator:“语法错误,参数化类型仅在源级别为5.0时可用” - Java - Iterator: “Syntax error, parameterized types are only available if source level is 5.0” 使用1.7.0_51但语法错误,“ for each”语句仅在源级别为1.5时可用 - using 1.7.0_51 but Syntax error, 'for each' statements are only available if source level is 1.5 Neomades语法错误,仅当源级别为1.5或更高时,参数化类型才可用 - Neomades Syntax error, parameterized types are only available if source level is 1.5 or greater
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM