Unable to fix “Syntax error, 'for each' statements are only available if source level is 1.5”

别来无恙 提交于 2019-12-10 17:27:45

问题


I am writing a Java Agent which uses parameterized collection types and enhanced-for loops. Domino Designer 8.5.3 then tells me to change the project's compliance level to 1.5 in a quick-fix action.

If I do that, the project rebuilds and nothing changes. Nothing happens if I go to the project's Java Compiler settings to set it manually, or change it in the workspace settings either. How can I get rid of this error?


回答1:


There is an annoying bug in Domino Designer. The "Compiler Compliance Level" in File / Preferences will always show 1.5 after a client restart and has no affect at all on Java Agents.

To set the compliance level for an agent open the agent and open a java class. Open Menu Project / Properties -> Java Compiler. Set to "Enable Project special settings" and set "Compiler Compliance Level" to 1.6.

To view the compliance level for a agent open the agent view, click on a agent (don't open it) an look at Properties / Fields, the fields "$JavaCompilerSource" and "$JavaCompilerTarget" will show the information.



来源:https://stackoverflow.com/questions/34273144/unable-to-fix-syntax-error-for-each-statements-are-only-available-if-source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!