Eclipse自动完成:Java 1.7通用钻石 [英] Eclipse Auto Complete: Java 1.7 Generics Diamond
问题描述
我刚刚升级到Luna(从开普勒),我注意到一些(但令人讨厌)的问题:
自动完成缺乏为变量中已经指定的泛型生成钻石的可能性初始化。例如,当我输入:
I just upgraded to Luna (from Kepler) and I noticed some little (yet annoying) problem:
The auto completion lacks the possibility to generate diamonds "<>" for already specified generics in variable initialisation. For Example, when I type:
Set<String> mySet = new HashSet
我会期望,它自动完成到
I would expect, that it gets auto-completed to
Set<String> mySet = new HashSet<>();
而不是
Set<String> mySet = new HashSet<String>();
我正在使用JDK 1.7,合规级别也设置为1.7。
I am using JDK 1.7 and the compliance level is set to 1.7 also.
它也很奇怪,当我在自动完成期间多次击中STRG + Space,直到它再次达到java自动完成,然后按Enter输入预期的钻石。
Its also very strange that when I hit STRG+Space multiple times during auto-completing till it reaches java-autocompletion again and then hit Enter it delivers the expected diamonds.
这看起来很像我的错误。
这个错误是已知的,这个问题有什么解决方法吗?无法找到与此主题相关的任何内容。
This looks very much like a bug to me.
Is this bug "known" and is there any workaround for this issue? Could not find anything related to this topic.
推荐答案
您很可能安装了代码推荐器插件-在。不幸的是,此插件受到打破此功能的错误#435597 的影响
You have most likely installed the Code Recommenders plug-in. Unfortunately this plug-in is affected by bug #435597 which breaks this functionality.
只有在默认的内容辅助列表中启用了某些提案类型 em>(Eclipse首选项> Java>编辑器>内容辅助>高级)。例如,我可以通过禁用以下提议类型来恢复正确的行为:
This bug appears to occur only if you have certain proposal kinds enabled in the "'default' content assist list" (Eclipse Preferences > Java > Editor > Content Assist > Advanced). For example I could get back the correct behavior by disabling the following proposal kinds:
- 基本提案
- JPA提案
- 模板提案
(最后一个可能是最烦人的,如果你正在使用代码模板...)
(the last one is likely the most annoying if you are using code templates…)
当您使用 ctrl + 空格骑车时,您实际上达到了 Java提案(而不是智能Java提案(代码推荐者)),这不会受到此错误的影响。
When you are cycling with ctrl+space, you are actually reaching the "Java Proposals" (instead of the "Intelligent Java Proposals (Code Recommenders)"), which is not affected by this bug.
此错误计划安装在版本2.2.0 在2015年6月。目前最好的方式是:
This bug is scheduled for release 2.2.0 in June 2015. The best you can do for the moment is:
- 建议,以检查哪些触发您的错误(可能在执行之前先获取当前设置的屏幕截图);
- Vo te 针对错误#435597 和 bug#435660 以使其得到修正;
- <强>建议补丁修复这些错误: - )
- Play with the proposals to check which ones trigger the bug for you (maybe take a screenshot of your current setup before doing that);
- Vote for bug #435597 and bug #435660 to get them fixed;
- Propose patches for fixing those bugs :-)
这篇关于Eclipse自动完成:Java 1.7通用钻石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!