Eclipse的自动完成:Java的泛型1.7钻石 [英] Eclipse Auto Complete: Java 1.7 Generics Diamond
问题描述
我刚刚升级到露娜(来自开普勒),我注意到一些小的(但恼人的)问题:结果
自动完成没有产生钻石的可能性<>为变量初始化已指定泛型。例如,当我输入:
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 +空格多次自动完成,直到它再次达到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.
推荐答案
您最有可能安装在 code条引荐插件。不幸的是这个插件是由错误#435597 打破这一功能受到影响。
You have most likely installed the Code Recommenders plug-in. Unfortunately this plug-in is affected by bug #435597 which breaks this functionality.
这个错误只出现如果你有一定的建议种发生的中启用了默认内容辅助列表的(的Eclipse preferences>的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建议
- 模板建议
(最后一个可能是最讨厌的,如果你正在使用code模板...)
(the last one is likely the most annoying if you are using code templates…)
当您使用循环<大骨节病> CTRL 骨节病> + <大骨节病>空格骨节病>,你实际上是达到了 Java的建议的(而不是智能Java的建议(code条引荐)的),这是不受此漏洞。
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.
This bug is scheduled for release 2.2.0 in June 2015. The best you can do for the moment is:
- 的提案播放以检查哪些触发你的bug(也许把你的当前设置的屏幕截图在这之前);
- 投票作为 BUG#435597 并的bug#435660 ,让他们固定;
- 提出的补丁作为修复这些bug: - )
- 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屋!