Bug 574338 - [content assist] [regression] no content assist for variables in conditional blocks
Summary: [content assist] [regression] no content assist for variables in conditional ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.21   Edit
Hardware: All All
: P3 major with 1 vote (vote)
Target Milestone: 4.21 M1   Edit
Assignee: Stephan Herrmann CLA
QA Contact: Vikas Chandra CLA
URL:
Whiteboard:
Keywords: regression
: 574716 575746 575811 (view as bug list)
Depends on:
Blocks: 574913
  Show dependency tree
 
Reported: 2021-06-20 05:12 EDT by Fred Bricon CLA
Modified: 2021-10-14 08:03 EDT (History)
12 users (show)

See Also:


Attachments
screenshot showing the bg (77.24 KB, image/png)
2021-10-11 23:53 EDT, Morgwai Kotarbinski CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fred Bricon CLA 2021-06-20 05:12:57 EDT
Related to bug #574215

Version: 2021-09 (4.21)
Build id: I20210617-1800

public class Snippet {
	private boolean flag;

	private void test(List<String> c) {
		if (flag) {
                        | // content assist here
			List<String> scs = c.subList(0, 1);
		}
	}

	String test() {
		return null;
	}
}

Content assist only offers the type Snippet, not test() or c.
Comment 1 Fred Bricon CLA 2021-06-20 05:16:26 EDT
As in bug #574215, if you add a semicolon after the cursor, content assist works
Comment 2 Eclipse Genie CLA 2021-06-21 06:06:05 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/182297
Comment 4 Stephan Herrmann CLA 2021-06-21 08:09:57 EDT
Released for 4.21 M1, thanks.
Comment 5 Manoj N Palat CLA 2021-07-07 01:08:15 EDT
Verified with Eclipse. Version: 2021-09 (4.21) Build id: I20210706-1800
Comment 6 Stephan Herrmann CLA 2021-07-09 17:12:20 EDT
*** Bug 574716 has been marked as a duplicate of this bug. ***
Comment 7 Andrey Loskutov CLA 2021-09-10 14:10:16 EDT
*** Bug 575811 has been marked as a duplicate of this bug. ***
Comment 8 Andrey Loskutov CLA 2021-09-10 14:11:14 EDT
*** Bug 575746 has been marked as a duplicate of this bug. ***
Comment 9 Morgwai Kotarbinski CLA 2021-10-11 23:41:11 EDT
THIS IS NOT FIXED!! bug still persists in 4.21!
specifically it stops to work in 2 level nested for-loops.
Comment 10 Morgwai Kotarbinski CLA 2021-10-11 23:53:31 EDT
Created attachment 287296 [details]
screenshot showing the bg

it doesn't even need to be nested for, it turns: see the screenshot.
Comment 11 Morgwai Kotarbinski CLA 2021-10-12 03:07:12 EDT
this situation also shows how out of touch with reality eclipse release policy is: instead of releasing the supposed fix as an update to 2021-06 and get users feedback  if it really works, the eclipse team decided to wait with releasing the fix until 2021-09 release. Now 2021-09 is also broken: congratulations...

I hope someone will learn a lesson from this and we will not have to wait for the fix until 2021-12...
Comment 12 Phil Beauvoir CLA 2021-10-12 03:40:40 EDT
@Piotr I'm using 4.21 on Windows, Mac and Linux and can't reproduce the issue. Perhaps you could post exact steps to reproduce and details on your setup?
Comment 13 Stephan Herrmann CLA 2021-10-12 03:44:52 EDT
(In reply to Piotr Morgwai Kotarbinski from comment #10)
> Created attachment 287296 [details]
> screenshot showing the bg
> 
> it doesn't even need to be nested for, it turns: see the screenshot.

I tried your exact example in a pristine Eclipse 2021-09 (4.21), and could not detect any problem. Completion is proposed as expected.

At this point I suggest to cool down, while together we search for a reason why things on your machine look different.

For a start please check the Preferences at Java > Editor > Content Assist > Advanced. Is the option "Java Proposals" checked in the upper box?
Comment 14 Morgwai Kotarbinski CLA 2021-10-12 04:14:34 EDT
@Stepah, sure happy to help :)

My exact environment:
build id 20210910-1417)
Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components)
Version: 2021-09 (4.21.0)
Build id: 20210910-1417
OS: Linux, v.5.4.0-87-generic, x86_64 / gtk 3.22.30, WebKit 2.32.4
Java vendor: Oracle Corporation
Java runtime version: 16.0.2+7-67
Java version: 16.0.2

It's a quite fresh profile created in June after I had to downgrade from 2021-06 to 2021-03 (due to this bug exactly). As far as I remember the only changes to default installation settings was installing protobuf-plugin, adding openJdk-11, importing my code-style and customizing perspective. Yesterday, after upgrading from 2021-03 to 09 I also installed some official CDT tools.

I've just verified `Java > Editor > Content Assist > Advanced > "Java Proposals` and it was unchecked. I've checked it, clicked `close and apply` but no effect.

The full code as it is partially convered in the screenshot:

```
package pl.morgwai.samples;

public class Sample {

	public static void main(String[] args) {
		for (int i = 0; i < 32; i++) {
			System.out.
			System.out.println();
		}
	}
}
```

placing cursor after `System.out.` and pressing `ctr`+`space` gives empty list of proposals.

I've just verified 1 more time that It was working perfectly fine in 2021-03 (I've made a backup of my settings before the upgrade to 2021-09, learnt by my June experience)

Please let me know if you need any more details.
Comment 15 Holger Voormann CLA 2021-10-12 04:20:43 EDT
(In reply to Piotr Morgwai Kotarbinski from comment #14)
That's a different issue: see bug 575631.
Comment 16 Morgwai Kotarbinski CLA 2021-10-12 04:23:40 EDT
1 more detail: the way I upgraded from 2021-03 to 2021-09 was to replace the whole `eclipse` folder by the one from `eclipse-jee-2021-09-R-linux-gtk-x86_64.tar.gz` file.
Comment 17 Morgwai Kotarbinski CLA 2021-10-12 04:34:56 EDT
(In reply to Holger Voormann from comment #15)
> (In reply to Piotr Morgwai Kotarbinski from comment #14)
> That's a different issue: see bug 575631.

While there may be indeed 2 different bugs in the eclipse code, it looks pretty much the same from user perspective: you write a loop and inside the loop code-completion does not work.
Comment 18 Morgwai Kotarbinski CLA 2021-10-12 04:37:58 EDT
...and I came here following the link you added in an SO thread named "Eclipse content assist fails in loops after upgrade to 2021-06 (4.20.0)"  ;-)
Comment 19 Bruno Lacombe CLA 2021-10-12 11:39:06 EDT
I get same problem
I use :
- Windows 10 Pro (French edition) 64bit
- Version: 2021-09 (4.21.0) Build id: 20210910-1417 (Java 16.0.2+7-67)
- zip download from Eclipse : eclipse-jee-2021-09-R-win32-x86_64.zip



Plugins :
- [x] MailSnag test email ...
- [x] EasyShell 2.1.0 (20/20)
- [x] Autodetect Encoding
- [x] Run Jetty Run 1.3.5
- [x] Asciidoctor Editor 2.0.3
Comment 20 Bruno Lacombe CLA 2021-10-12 11:54:09 EDT
If there are an ";" : after "System.out." " the completion is working !


see code :

public class Sniper {


  public static void main(String[] args) {
    for (int i = 0; i < 32; i++) {
      System.out.;     
      
      System.out.print(false);
    }
  }
}


I suppose that completion look after the current pointer, and current line.
Comment 21 Stephan Herrmann CLA 2021-10-12 12:07:17 EDT
This is going to be a tough one: we have plenty of confirmation that this bug and some duplicates have effectively been fixed. Also comment 12 and comment 13 show it's not a matter of the code example, as we have tested the exact same code - and it worked.

Ergo, the next likely causes would be:
1. different preference configuration
2. broken workspace / project state
3. installation did not effectively install the fix

Ad 1.: please attach screen shot of the preference page mentioned in comment 13.

Ad 2.: can it be reproduced in a fresh new workspace?

Ad 3.: easiest way to check: please attach the content of Help > About Eclipse ... > Installation Details > Configuration
(we only need the list of plugins with exact versions, actually)


If in the end we find a way to reproduce a problem, we will most likely create a new bugzilla entry.
Comment 22 Morgwai Kotarbinski CLA 2021-10-12 13:41:59 EDT
(In reply to Stephan Herrmann from comment #21)
(...)
> 
> If in the end we find a way to reproduce a problem, we will most likely
> create a new bugzilla entry.

As pointed in #c15 an entry already exists: I guess all further discussion should be moved there, no?
Comment 23 Holger Voormann CLA 2021-10-12 13:44:37 EDT
(In reply to Bruno Lacombe from comment #20)
> ...
> see code : ...
According to your code, you are talking about bug 575631, which is similar, but not the same, and not yet fixed.

I can confirm (and you should also be able to verify) that this bug has been fixed with the example code given by the bug description.

Sorry for the noise caused by my Stack Overflow answer (https://stackoverflow.com/a/68265945/6505250) referring to this bug. I added a note to avoid further noise.
Comment 24 Stephan Herrmann CLA 2021-10-12 17:04:22 EDT
I apologize that my testing in comment 13 didn't succeed to produce the bug. As a weak excuse I could say that reproducing a bug from a screenshot is less likely than doing so from a full code example :)

Anyway, for posterity let's repeat that this bug (see comment 0) is verified fixed in 4.21, whereas bug 575631 is still waiting for a fix.
Comment 25 Bruno Lacombe CLA 2021-10-14 06:48:01 EDT
I confirm completion not propose "print..." in this code (below)
In fact it propose nothinn

I try on Eclipse 2021 (not plugin) from (https://rhlx01.hs-esslingen.de/pub/Mirrors/eclipse/eclipse/downloads/drops4/S-4.22M1-202109291800/eclipse-SDK-4.22M1-win32-x86_64.zip ) :

  Version: 2021-12 (4.22)
  Build id: I20210929-1800

and on (my production env) :

  Version: 2021-09 (4.21.0)
  Build id: 20210910-1417


----
public class MyTest {

  public static void main(String[] args) {
    for (int i = 0; i < 32; i++) {
        System.out.p //Completion not work here after the point
        System.out.println("hello");
    }
}

  String test() {
    return null;
  }
}
----
Comment 26 Stephan Herrmann CLA 2021-10-14 08:03:11 EDT
(In reply to Bruno Lacombe from comment #25)
> I confirm completion not propose "print..." in this code (below)

That's bug 575631. Please move the discussion to that bug (I'm on it).