Bug 508247 - Annotation based null analysis, false positive with AspectJ
Summary: Annotation based null analysis, false positive with AspectJ
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.9   Edit
Hardware: PC Windows 7
: P3 critical (vote)
Target Milestone: 1.8.10   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-27 08:46 EST by Frank Benoit CLA
Modified: 2017-01-09 12:00 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Benoit CLA 2016-11-27 08:46:00 EST
This code

@NonNullByDefault
public class Fut {

	Object test() throws IOException {
		Optional<Object> res = Optional.ofNullable(null/*1*/);
		if( !res.isPresent() ){
			throw new RuntimeException();
		}
		return res.get();/*2*/
	}
}

I have this compiling without AspectJ with no problems.
The eea file for Optional is like this:
class java/util/Optional
get
 ()TT;
 ()T1T;
ofNullable
 <T:Ljava/lang/Object;>(TT;)Ljava/util/Optional<TT;>;
 <T:Ljava/lang/Object;>(T0T;)Ljava/util/Optional<TT;>;


Now when i add the AspectJ nature, i have problems in /*1*/. In my code base, i have as well the problem in /*2*/. Not triggered in this example.
Comment 1 Frank Benoit CLA 2016-11-28 03:30:38 EST
I set to critical, as it influences all java projects
Comment 2 Andrew Clement CLA 2016-12-08 15:12:14 EST
You didn't include the exact error message but I've seen something that appears to now be resolved with 1.8.10. Please grab an AJDT from the 4.6 dev update site and let me know if it helps?
Comment 3 Frank Benoit CLA 2017-01-07 18:40:36 EST
Sorry, i will not test. 
I removed AspectJ from my projects.
You may close this ticket.
Comment 4 Andrew Clement CLA 2017-01-09 12:00:33 EST
The big JDT upgrade for 1.8.10 included a fix for something like this. I'm presuming that addressed this problem. If anyone hits this in future, please reopen.