Bug 498055 - Code templates do not work in anonymous nested class after a return statement
Summary: Code templates do not work in anonymous nested class after a return statement
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 10
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-18 08:43 EDT by Christoph Schneegans CLA
Modified: 2017-02-21 12:33 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Schneegans CLA 2016-07-18 08:43:01 EDT
Consider the following Java source code:

public class Test {
	Object X = new Object() {
		Object x() {
			if (System.currentTimeMillis() < 0) {
			    sys
				return new Object() {
				};
			} else {
			    sys
				return null;
			}
		}
	};
}

When you hit Ctrl+Space after the first "sys" statement, Eclipse will show a list of code proposals, including the well-known templates "sysout", "syserr" and "systrace. This is the expected behavior.

However, when you hit Ctrl+Space after the second "sys" statement, the pop-up menu does not contain any templates, but simply says "No Default Proposals".

-- Configuration Details --
Product: Eclipse 4.6.0.20160613-1800 (org.eclipse.epp.package.jee.product)
Installed Features:
 org.eclipse.jdt 3.12.0.v20160606-1100
Comment 1 Christoph Schneegans CLA 2017-02-21 12:33:46 EST
This problem is still present in the current Eclipse release:

Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600
Eclipse Java Development Tools 3.12.2.v20161124-1400