Bug 574267 - [content assist] [regression] No content assist for templates in conditional blocks
Summary: [content assist] [regression] No content assist for templates in conditional ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.20   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.21 M1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: 574913
  Show dependency tree
 
Reported: 2021-06-17 07:39 EDT by Dirk Henkel CLA
Modified: 2021-07-19 10:07 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Henkel CLA 2021-06-17 07:39:21 EDT
After updating the Eclipse IDE from 4.19 to 4.20, the content assist cycling in a java editor shows 'No Template Proposals' instead of the filled template proposals list it had before the update.

The chain template proposals list is also empty, but I didn't recently use it in 4.19, so I can't tell if that is also an effect of the update.
Comment 1 Andrey Loskutov CLA 2021-06-17 08:02:27 EDT
Does it happen in every editor/code, or in a specific one? If in the specific one, please provide that. Also please attach error log.
Comment 2 Holger Voormann CLA 2021-07-06 03:18:31 EDT
I can reproduce this in the Eclipse Java IDE 2021-06 (4.20) and in the the latest build of the Eclipse SDK I20210705 with the following code:

class Sample {
	void sample(String foo) {
		if (foo != null) {
			sys // content assist here
			System.out.println();
		}
	}
}

It seems to be similar to bug 574338, since it can be reproduced with the same examples:
- bug 574338 comment 0
- bug 574215 comment 14
- Stack Overflow question https://stackoverflow.com/q/68258236/6505250
Comment 3 Andrey Loskutov CLA 2021-07-06 03:26:43 EDT
Yep, no proposal for "sys" template after "if".
Stephan, could you please take a look?
Comment 4 Eclipse Genie CLA 2021-07-06 04:53:36 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/182781
Comment 5 Stephan Herrmann CLA 2021-07-06 04:54:33 EDT
(In reply to Eclipse Genie from comment #4)
> New Gerrit change created:
> https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/182781

A real template test will follow in JDT/UI once the core part is tested & released.
Comment 7 Eclipse Genie CLA 2021-07-06 06:09:42 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182782
Comment 8 Stephan Herrmann CLA 2021-07-06 06:11:06 EDT
(In reply to Eclipse Genie from comment #7)
> New Gerrit change created:
> https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182782

Template test in JDT/UI

(In reply to Eclipse Genie from comment #6)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/182781 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=fc32ee657551f11c9c828704e0fe8e261b3f4527

Fix & core test released for 4.21 M1.
Comment 9 Holger Voormann CLA 2021-07-06 06:55:38 EDT
Wow, that was quick! Thanks Stephan!

Great to have this in 4.21 M1.
Comment 10 Stephan Herrmann CLA 2021-07-06 12:48:13 EDT
(In reply to Holger Voormann from comment #9)
> Wow, that was quick! Thanks Stephan!
> 
> Great to have this in 4.21 M1.

:)

(and at first I had no idea how template proposals could be affected by the recent changes in regular completion - now I know).
Comment 11 Stephan Herrmann CLA 2021-07-06 12:50:44 EDT
(In reply to Stephan Herrmann from comment #8)
> (In reply to Eclipse Genie from comment #7)
> > New Gerrit change created:
> > https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182782
> 
> Template test in JDT/UI

At first I noticed that TemplateCompletionTests is not contained in any test suite.
After adding it to TemplatesTestSuite build logs told me:

Jul 06, 2021 1:21:30 PM org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder buildRunner
WARNING: Ignoring test class using JUnitPlatform runner: org.eclipse.jdt.text.tests.templates.TemplatesTestSuite
Jul 06, 2021 1:21:30 PM org.junit.vintage.engine.discovery.DefensiveAllDefaultPossibilitiesBuilder$DefensiveAnnotatedBuilder buildRunner
WARNING: Ignoring test class using JUnitPlatform runner: org.eclipse.jdt.text.tests.templates.TemplatesTestSuite

This led me to discover that the two test classes (which never ran on jenkins(?)) where configured for JUnit 5 whereas other tests incl. suite classes in the vicinity where at JUnit 4.

In monkey-see-monkey-do style I configured TemplatesTestSuite and its two classes for JUnit4 ( https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182782/2..3 )

@Carsten, please check if this is consistent with your JUnit refactoring, and please confirm that JUnit 4 is the version of choice in JDT/UI.
Comment 12 Carsten Hammer CLA 2021-07-06 13:40:45 EDT
(In reply to Stephan Herrmann from comment #11)
> (In reply to Stephan Herrmann from comment #8)
> > (In reply to Eclipse Genie from comment #7)
> > > New Gerrit change created:
> > > https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182782
> > 
> > Template test in JDT/UI
> 
...
> This led me to discover that the two test classes (which never ran on
> jenkins(?)) where configured for JUnit 5 whereas other tests incl. suite
> classes in the vicinity where at JUnit 4.
> 
> In monkey-see-monkey-do style I configured TemplatesTestSuite and its two
> classes for JUnit4 (
> https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182782/2..3 )
> 
> @Carsten, please check if this is consistent with your JUnit refactoring,
> and please confirm that JUnit 4 is the version of choice in JDT/UI.

Yes, Junit 4 is fine until we apply changes not exactly but similar to
https://git.eclipse.org/r/c/platform/eclipse.platform.releng/+/177860/4/bundles/org.eclipse.test/src/org/eclipse/test/EclipseTestRunner.java to teach eclipse to be able to run integration build without suites (suites basically do not exist in Junit 5). I have not found the time to look deeper into it to find out how to test changes in this area.

The gerrit build of course works if needed without suites and in general allows to run junit 5 based tests. But having suites and tests at the same time (removing suite references from the pom files) causes multiple execution of the tests. So you have to decide to remove suites to fix this.

However, the integration build starts from ant using this limited EclipseTestRunner (without making use of ants junit5 support) and so we have to stay with juni4 at the time being.

Your changes look fine to me.


In case someone is interested see a sample to remove the suites in a single project at
https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/168859
Comment 13 Carsten Hammer CLA 2021-07-06 13:55:10 EDT
Just for completeness, suites have been introduced in 
https://github.com/junit-team/junit5/issues/744
but I'm not sure that it makes a difference for the EclipseTestRunner without further changes.
Comment 14 Stephan Herrmann CLA 2021-07-06 17:59:13 EDT
(In reply to Carsten Hammer from comment #12)
> Your changes look fine to me.

Thanks.

Meanwhile patch set #4 improves test isolation: leaked option-changes in PostFixCompletionTest caused a failure in one of the tests that never ran on jenkins.
Comment 15 Jay Arthanareeswaran CLA 2021-07-08 01:53:50 EDT
Verified for 4.21 M1 with build I20210707-1800
Comment 17 Stephan Herrmann CLA 2021-07-11 08:50:44 EDT
(In reply to Eclipse Genie from comment #16)
> Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/182782 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/
> ?id=51d459d6418ecacaebcb9e36f6df787893727ba0

integration test in JDT/UI released.