Bug 574968 - [content assist] broken override method proposals in anonymous classes with diamond operator
Summary: [content assist] broken override method proposals in anonymous classes with d...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.20   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Kalyan Prasad Tatavarthi CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 575919
  Show dependency tree
 
Reported: 2021-07-22 06:32 EDT by Julian Honnen CLA
Modified: 2023-11-14 10:18 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Honnen CLA 2021-07-22 06:32:36 EDT
Given the following example

FileVisitor<Path> test = new java.nio.file.SimpleFileVisitor<>() {
	visitFile|
};

content assist inserts

public java.nio.file.FileVisitResult visitFile(Object file, java.nio.file.attribute.BasicFileAttributes attrs) throws java.io.IOException {};

which is both wrong (Object file should be a Path, doesn't honor method template) and contains redundant code (fully qualified types, trailing semicolon).



If the type parameter is specified, content assist works as expected:

FileVisitor<Path> test = new java.nio.file.SimpleFileVisitor<***Path***>() {
	@Override
	public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
		// TODO Auto-generated method stub
		return super.visitFile(file, attrs);
	}
};


tested with Version: 2021-09 (4.21)
Build id: I20210721-1800
Comment 1 Christoph Laeubrich CLA 2021-11-02 03:23:27 EDT
@Julian thanks for finding a minimal example for this, this is really an annoying bug it seems it also happens when there is a lot of nesting of inner classes.
Comment 2 Eclipse Genie CLA 2023-11-14 10:18:23 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.