Bug 509327 - Improve handling of inner types of parameterized types in reflection type convertor
Summary: Improve handling of inner types of parameterized types in reflection type con...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.10   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 1.8.11   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-15 18:02 EST by Andrew Clement CLA
Modified: 2017-09-26 12:58 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2016-12-15 18:02:14 EST
After a long discussion in an email I added some diagnostics to trigger on a strange case that breaks the expectations in JavaLangTypeToResolvedTypeConverter. This gave rise to this Spring issue when someone tried 1.8.10 with spring framework.

https://jira.spring.io/browse/SPR-15019

Basically the diagnostics got triggered. Attached to that bug is a trigger project and from that I've distilled a simpler testcase. 

The problem is in the handling of inner types of parameterized types.

These present themselves as parameterized types even if they have no generics signature, *if* their outer type has a generic signature.

class Foo<T> {
  class Inner {}
  public Inner m() {}
  public Foo<String>.Inner m2() {}
}

Attempting to use the converter on the return type of m() will reveal the problem (or m2).

The right fix is to properly preserve all the generics in the AspectJ type objects built by the converter. However... there is also an issue in the bcel representation pulled from the bytecode. This issue means that for the member m2 the return type is missing the String parameterization.

So the more prudent fix is perhaps for the converter to do as the bcel version does, initially. And when there is more time go in and fix it all up on both bcel and reflection sides.
Comment 1 Andrew Clement CLA 2016-12-16 20:05:06 EST
Simpler fix is in, recognizing a simpler type with no type variables might be the inner type of a parameterized type. The more correct fix to preserve parameterization of the outer type needs more testcases because it seems to affect more than just reflectively discovered info. See the tests in ReflectionWorldTest
Comment 2 Andrew Clement CLA 2017-09-26 12:58:29 EDT
1.8.11 shipped with fix in.