Bug 466481 - [null][quick fix] Quick fix for SE5 annotation is inappropriately offered for null type annotation problem
Summary: [null][quick fix] Quick fix for SE5 annotation is inappropriately offered for...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-05 14:02 EDT by Stephan Herrmann CLA
Modified: 2022-11-10 14:13 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 Stephan Herrmann CLA 2015-05-05 14:02:42 EDT
This is a subset of bug 427423:

With compiler configured for null type annotations, and this code:

//---
package m7test;

import java.util.Set;
import java.util.function.*;
import java.util.stream.*;

import org.eclipse.jdt.annotation.NonNull;
public class StreamTest2 {
	void test(Stream<@NonNull String> s) {
		s.collect(new Collector<@NonNull String, Object, Integer>() {
			@Override
			public Supplier<Object> supplier() {
				return null;
			}
			@Override
			public BiConsumer<Object, String> accumulator() {
				return null;
			}
			@Override
			public BinaryOperator<Object> combiner() {
				return null;
			}
			@Override
			public Function<Object, Integer> finisher() {
				return null;
			}
			@Override
			public Set<java.util.stream.Collector.Characteristics> characteristics() {
				return null;
			}
		});
	}
}
//---

compiler correctly complains against the return type of accumulator():

The return type is incompatible with 'BiConsumer<Object,@NonNull String>' returned from Collector<String,Object,Integer>.accumulator() (mismatching null constraints)

The offered quick fix ("Change return type of accumulator(..) to '@NonNull'"), however, is wrong, producing
   public @NonNull BiConsumer<Object, String> accumulator()
instead of
   public BiConsumer<Object, @NonNull String> accumulator()


While bug 427423 is about more sophisticated quick fixes, that RFE isn't going to make it for Mars.

I should, however, try to suppress the quick fix when it is about to propose junk.
Comment 1 Stephan Herrmann CLA 2015-05-05 14:03:40 EDT
Tentatively putting on my list.
Comment 2 Stephan Herrmann CLA 2017-05-16 12:05:21 EDT
Ran out of time for 4.7. Bulk move to 4.8.
Comment 3 Eclipse Genie CLA 2020-11-10 18:28:37 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.
Comment 4 Eclipse Genie CLA 2022-11-10 14:13:41 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.