Community
Participate
Working Groups
When nesting more than one layer of anonymous class, PDT is incorrectly exposing methods of nested classes to code completion. (these should only be exposed at the level to which they apply. I will attach a screenshot.
Created attachment 279827 [details] illustration of methods being exposed incorrectly it appears that PDT is aware that the depth of the methods is different but ignores it in proposing possibilities (I'm inferring this by looking at the light grey information to the right of the displayed properties) To hopefully assist, here follows the exact code shown in the screenshot... <?php class main { static function level1($val) : object { return new class($val) { private $value; function __construct(string $value) { $this->value = $value; } function level2() : object { return new class($this->value) { private $value2; function __construct(?string $value2) { $this->value2 = $value2; } function uppercase() { print strtoupper($this->value2); } function lowercase() { print strtolower($this->value2); } }; } }; } } $a = main::level1("frED"); $a->level2()->lowercase(); $a->
Issue persists in PDT 7.0.0.201910011154
New Gerrit change created: https://git.eclipse.org/r/155113
Gerrit change https://git.eclipse.org/r/155113 was merged to [master]. Commit: http://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=f020a880603f26c3a7019b83b1fbf41fbd6bb6ee
Fixed in 7.1. Thank You for report with example!
Created attachment 281360 [details] Duplicates ? My pleasure! I have just upgraded to 7.1 and I notice 2 things: 1. OK: code completion is now showing the correct methods. 2. ISSUE: the methods are showing twice This screenshot should hopefully illustrate the above.
Please see previous comment and screenshot explaining reason for re-opening
Could you clean your project first? Menu -> Project -> Clean and select your project. I cannot reproduce on mac. Maybe this is a problem on Windows hmmm
oops - my bad :) I had the file existing already in the project and created a new ...which meant that it was showing the methods from both files. I have deleted the new "duplicate" file and tested in the original - and all good! thanks very much for sorting - apologies for causing time waste.