Bug 113861 - [generics] field-get problems when generic field is used.
Summary: [generics] field-get problems when generic field is used.
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M4   Edit
Hardware: PC Linux
: P3 critical (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-26 14:01 EDT by Misha Kantarovich CLA
Modified: 2005-10-28 03:27 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 Misha Kantarovich CLA 2005-10-26 14:01:17 EDT
Hi, 

When i'm compiling the following example, i'm getting this errors:

TestAspect.aj:21 [error] incompatible return type applying to field-get
(java.util.Set com.mprv.secsph.Test.intsSet)

Test.java:18 [error] incompatible return type applying to field-get
(java.util.Set com.mprv.secsph.Test.intsSet)

Here is the example
-------------------

Java Code:

package com;

public class Test {

	Set<Integer> intsSet;

	public Set<Integer> foo() {
18:         return intsSet;
	}
}

Aspect:

public privileged aspect TestAspect {
    pointcut gettingMember(Test t) :
                target(t) &&
                get(!public Set<Integer> com.*.*) &&
                !within(TestAspect);

21: Set<Integer> around(Test t) : gettingMemberCollection(t)  {
        Set s =  proceed(t);
        return s;
    }
}

I've tried many kinds of workarounds, and the only thing which worked, is 
defining the member field without using generics (regular Set) ... 

One more disturbing is, that this fiture worked(!) in M2 release. 

This is an example of the functionality that worked in my project (with M2), 
but now, also reports the same error:

Java code is the same, Aspect is:

public privileged aspect TestAspect {
    pointcut gettingMember(Test t) :
                target(t) &&
                get(!public Set com.*.*) &&
                !within(TestAspect);

    Set around(Test t) : gettingMemberCollection(t)  {
        Set s =  proceed(t);
        return s;
    }
}

Is it a bug? Or am i doing something wrong?

Thanks!
Misha.
Comment 1 Andrew Clement CLA 2005-10-27 03:22:11 EDT
Doesnt look like you are doing anything wrong.  And I am not surprised it worked
in M2 and fails now, M2 was not generics aware and it would have been working
'by accident'.  Now the whole compiler/weaver is much more aware of generics and
this kind of thing is going to happen whilst we get it right.
Comment 2 Andrew Clement CLA 2005-10-27 12:26:48 EDT
I can see why this is failing, fix almost ready.
Comment 3 Andrew Clement CLA 2005-10-27 14:01:52 EDT
Fix checked in, waiting on build before closing.  As suspected it was that the
system was more generics aware ... apart from in one place ;)
Comment 4 Misha Kantarovich CLA 2005-10-27 14:10:18 EDT
(In reply to comment #3)
> Fix checked in, waiting on build before closing.  As suspected it was that the
> system was more generics aware ... apart from in one place ;)

Thanks!
I'll download the build as soon as it will be there ... 
Comment 5 Andrew Clement CLA 2005-10-28 03:27:20 EDT
fix available in the latest dev build from the AJ download page.