Bug 431976 - thisJoinPoint may not have been initialized
Summary: thisJoinPoint may not have been initialized
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.8.1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-04 03:40 EDT by Reto Urfer CLA
Modified: 2014-06-12 12:45 EDT (History)
2 users (show)

See Also:


Attachments
aspectj plugin to reproduce the bug (7.30 KB, application/x-zip-compressed)
2014-04-04 03:40 EDT, Reto Urfer CLA
no flags Details
Spring's AbstractDependencyInjectionAspect (3.08 KB, application/octet-stream)
2014-06-10 09:33 EDT, Sam Brannen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reto Urfer CLA 2014-04-04 03:40:03 EDT
Created attachment 241601 [details]
aspectj plugin to reproduce the bug

In case an aspect is defined as privileged and the variable thisJoindPoint is used in an advice you get the compile error:

The local variable thisJoinPoint may not have been initialized
Comment 1 Andrew Clement CLA 2014-04-04 15:33:50 EDT
This is due to some new variable usage flow checking in the Eclipse Java8 compiler. Fixed. Thanks for the test case!
Comment 2 Reto Urfer CLA 2014-04-05 03:52:57 EDT
Great, when will there be a new build so i can test together with the fix for Bug 431541? 

We want to Switch our master development branch to Java8 but to do this a Need a working Aspectj & AJDT
Comment 3 Andrew Clement CLA 2014-04-07 11:13:56 EDT
I have a few other bugs to try and wrap up before I build a new AspectJ+AJDT, so maybe wednesday.
Comment 4 Reto Urfer CLA 2014-04-22 03:29:51 EDT
I checked the fix and found another case where thisJoinPoint is not initialized.

if thisJointPoint is used within an if Statement in the pointcut Definition it  is also marked as not initilialized.

Just modify the example attached the following way to reproduce it:

void around(): execution(boolean Control.forceFocus ()) && 
    if(thisJoinPoint.getTarget().getClass().getName().equals("org.eclipse.swt.widgets.Control")) {
   thisJoinPoint.getThis();
}
Comment 5 Sam Brannen CLA 2014-06-10 09:31:53 EDT
Hi Andy,

I'm seeing this issue when building Spring Framework master (i.e. 4.1) with the latest Spring Tool Suite build:

spring-tool-suite-3.6.0.CI-B1887973-e4.4-macosx-cocoa-x86_64-installer.dmg

Specifically:

The local variable thisJoinPoint may not have been initialized	AbstractDependencyInjectionAspect.aj	/spring-aspects/src/main/java/org/springframework/beans/factory/aspectj	line 57	Java Problem

When do think a fix will be available in STS builds?

Or... is there a patch that can be applied to STS nightly builds?

Cheers,

Sam
Comment 6 Sam Brannen CLA 2014-06-10 09:33:19 EDT
Created attachment 244115 [details]
Spring's AbstractDependencyInjectionAspect

Attached source code for Spring's AbstractDependencyInjectionAspect.
Comment 7 Andrew Clement CLA 2014-06-11 10:54:15 EDT
I just fixed another variant where thisEnclosingJoinPointStaticPart was a problem too.

@Sam the AJDT builds for 4.4 are failing is the problem, I think that is part of the problem so the fix isn't available in something installable right now. We'll get it sorted soon.

@Reto I'll take a look at your variants

I will likely do an upgrade to the latest JDT very soon (as eclipse 4.4 is being finished up) and put out a 1.8.1 with all these changes in.
Comment 8 Andrew Clement CLA 2014-06-11 13:46:37 EDT
Ok, the AJDT for 4.4 builds are in better shape now (one running at the moment). I've fixed all the variants of this I am aware of. The latest one Reto showed was the variable being used in an if() clause. The previous fix dealt with it occurring in an advice so I expanded that fix to cover ifs. The next build should be good, it is also available as a 1.8.1.BUILD-SNAPSHOT in the Spring maven repo.

When the build https://build.spring.io/browse/AJDT-AE44-65 completes, you should be able to install it and try it out Sam.
Comment 9 Sam Brannen CLA 2014-06-11 15:30:09 EDT
@Andy: Build #65 failed. I see you that triggered another one, and I'm watching that build plan now. So I'll hopefully get to try it out soon.
Comment 10 Sam Brannen CLA 2014-06-12 03:11:13 EDT
I installed an update from https://build.spring.io/browse/AJDT-AE44-66/artifact/shared/update-site/, and that seems to have done the trick.

Thanks!
Comment 11 Reto Urfer CLA 2014-06-12 06:23:32 EDT
My open case seems also to be solved

Thanks
Comment 12 Andrew Clement CLA 2014-06-12 12:45:52 EDT
thanks for confirming the fix.