Bug 456357 - Unexpected Xlint:unresolvableMember warning for array of generic type
Summary: Unexpected Xlint:unresolvableMember warning for array of generic type
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.4   Edit
Hardware: PC Windows 8
: P3 normal (vote)
Target Milestone: 1.8.5   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-30 10:36 EST by Alexander Kriegisch CLA
Modified: 2018-03-13 12:40 EDT (History)
2 users (show)

See Also:


Attachments
Eclipse project reproducing the problem (4.79 KB, application/x-zip-compressed)
2014-12-30 10:36 EST, Alexander Kriegisch CLA
no flags Details
Screenshot of relevant Eclipse setting (33.22 KB, image/png)
2014-12-30 10:37 EST, Alexander Kriegisch CLA
no flags Details
Screenshot of Eclipse compiler warning (10.62 KB, image/png)
2014-12-30 10:38 EST, Alexander Kriegisch CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kriegisch CLA 2014-12-30 10:36:49 EST
Created attachment 249664 [details]
Eclipse project reproducing the problem

Andrew Eisenberg and I were dealing with this problem:
http://stackoverflow.com/questions/27673960/aspectj-and-mapstring-object-array

I have taken some time to create a reproduceable Eclipse project (see attachment).

Problem description: In an annotation-style aspect targetting a method with a parameter type such as Map<String, Object>[] - please note the array, it only happens when the type is an array the the generic type is specific, not raw - Ajc spits out a warning such as:

[warning] can not resolve this member:
void de.scrum_master.app.SampleUtil.sampleMethod(java.util.Map[])
[Xlint:unresolvableMember]
Comment 1 Alexander Kriegisch CLA 2014-12-30 10:37:51 EST
Created attachment 249665 [details]
Screenshot of relevant Eclipse setting
Comment 2 Alexander Kriegisch CLA 2014-12-30 10:38:16 EST
Created attachment 249666 [details]
Screenshot of Eclipse compiler warning
Comment 3 Andrew Clement CLA 2015-01-07 19:23:13 EST
This appears to be due to some code that is erasing generics which fails to do its job if the generic type is an array form (the array hides the generic and this code doesn't think it has to do anything). It also seems to require that a call joinpoint is involved because that requires extra 'resolution' (chasing down what was being called) where an execution joinpoint has all the information right there and doesn't go through the broken generics erasing process.

Thanks for the testcase, extremely useful.
Comment 4 Jan Hornych CLA 2018-03-07 07:01:23 EST
(In reply to Andrew Clement from comment #3)
> This appears to be due to some code that is erasing generics which fails to
> do its job if the generic type is an array form (the array hides the generic
> and this code doesn't think it has to do anything). It also seems to require
> that a call joinpoint is involved because that requires extra 'resolution'
> (chasing down what was being called) where an execution joinpoint has all
> the information right there and doesn't go through the broken generics
> erasing process.
> 
> Thanks for the testcase, extremely useful.

Hi Andrew,

I don't understand what is the solution of this problem. I faced the same issue in my project. Is the use of generics arrays as parameter wrong? Or is this warning irrelevant? In generics, I have to use the generics arrays in these ways, but I want to avoid this warning...

Thank you, J.
Comment 5 Andrew Clement CLA 2018-03-13 12:40:38 EDT
The bug was marked fixed in 1.8.5 so the problem mentioned in the testcase that Alexander created, and my fix for that are all in the code now. I just downloaded the testcase again - got the problem in 1.8.4 and no problem in 1.8.5.

What version of AspectJ are you using?

Can you provide me a code sample that is failing in the same way for you on a recent AspectJ?

Or, what about the error - specifically what member are you seeing as unresolved and what is the parameter/return signature - where are the generics involved in it?