-
Notifications
You must be signed in to change notification settings - Fork 2.3k
generic beans hierarchy #867
generic beans hierarchy #867
Conversation
add: <? super T> bounds for extending
fix: allowing <?> wildcard
|
Did you test with the second Eclipse for functional test project ? I'm having some trouble to run this instance of Eclipse because of the following error :
I tried to force export of the local codemodel package by adding it to |
|
I didn't run it under eclipse - just mvn test. And this part worked fine for me. The only reason I've put JSuperWildcard under com/sun/codemodel is to make protected method visible for me. But if you are still getting such error - your suggestion about calling this through reflection will work. |
|
Check if they are loaded with the same class loader - it is the only thing that comes to mind. |
|
@pyricau > Any idea ? As you setup all this, you may known what's happening here |
|
Could you confirm, that there is no such problem, if you try mvn test?
|
|
Works with It seems we have a big issue if we have these classes : @EBean
public class GenericBeanB extends GenericBeanA {
}
@EBean
public abstract class GenericBeanA {
@Background
void method(String list) {
}
}In Eclipse, it fails with this exception :
That's one of the biggest problem with annotation processing. Some IDE use their own internal classes instead of regular ones provided by JDK. So, sometimes it just crash.. But in this specific case, it seems Eclipse's implementation is more strict than Java's classes as it respect the API javadoc. |
|
I'll do some tests and fix this in another PR. Then I'll come back to this one. |
|
Oh. The exception came from a line you added in your PR. I thought it was buggy before this. Could you fix this then ? |
|
Very strange issue. |
|
Yeah, there is an issue for that: |
|
Looks like it is possible to implement the substituting generic params without "asMemberOf" for our particular case. I'll try to do it. |
|
Hey. Please, check my last commit - I've implemented params lookup ahead of |
|
Still some issues to run Eclipse (I have a temporary patch by using reflection, but I think it's just a config issue). @EBean
public class SubtypedGenericBean<T extends Number> {
}Also, could add these classes in functional-test project : @EBean
public abstract class GenericBeanA<T extends Number> {
@Background
void backgroundMethod(T param) {
}
@Produce
public T genericMethod() {
return null;
}
}and |
|
BTW, I only have the VerifyError message with second Eclipse for functional-test. So if the last issue is fixed, we could merge it. |
|
Looks like GenericBeanA shouldn't be abstract. In this case we will cover case for generation GenericBeanA_. |
|
I'm using Eclipse Juno R2. However, could you try to handle the case of |
|
Yep, I'm working on the subtyped issue at the moment. |
|
Done. Also added more complicated test cases that I found during fixing your case. |
|
If the VerifyError still happens after updating eclise - open an issue, I'll be happy to help. |
|
Seems great 👍 ( I'll check tomorrow for VerifyError ) |
PR for #865