Bug 542939 - [content assist] NPE from 'CompletionEngine'
Summary: [content assist] NPE from 'CompletionEngine'
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.10   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-19 18:09 EST by Kris De Volder CLA
Modified: 2023-01-10 04:00 EST (History)
0 users

See Also:


Attachments
error from error log (8.54 KB, text/plain)
2018-12-19 18:09 EST, Kris De Volder CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kris De Volder CLA 2018-12-19 18:09:24 EST
Created attachment 276965 [details]
error from error log

This code in the editor:

package com.example;

import java.util.Date;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Profile("cloud")
public class CloudSupport {
	
	@Value(ad-)
	
	@GetMapping(value = "/hello")
	public String hello() {
		return "Hello from the cloud";
	}

	@GetMapping(value = "/bye")
	public String bye() {
		return "So long and thanks for all the fish!";
	}

	@GetMapping(value = "/date")
	public String date() {
		return new Date().toString();
	}
	
}

Place cursor right after the '-' in '@Value(ad-)'. Press CTRL-SPACE.

A error popup shows up with the 'usual' error that a completion proposal computer misbehaved and maybe I wanted to disable it.

Also an error in the error log. See the attachement.

If you need more context to reproduce. The source code above can be pasted into the 'chatter-web-ui' sample maven project from here: 

https://github.com/kdvolder/chatter/tree/59c28ce1e1cd8dbc47c1e92160752cf1fe4a44b9/chatter-web-ui
Comment 1 Noopur Gupta CLA 2018-12-19 23:38:29 EST
From the stack trace:
java.lang.NullPointerException
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.findLocalMethods(CompletionEngine.java:9199)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.findMethods(CompletionEngine.java:10527)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.findVariablesAndMethods(CompletionEngine.java:12561)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.completionOnSingleNameReference(CompletionEngine.java:3729)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1941)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:2266)
	at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:136)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:368)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:358)
	at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(JavaCompletionProposalComputer.java:253)
...

Exception is coming from CompletionEngine. Moving to JDT Core.
Comment 2 Eclipse Genie CLA 2020-12-09 09:50:04 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 3 Eclipse Genie CLA 2023-01-10 04:00: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.