You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
@Artyomcool, i think we cannot solve this by just calling APTCodeModelHeper.typeMirrorToJClass(), because the generated type is not yet present, so we cannot get the TypeMirror in the first place. I think it is impossible to add type arguments to the constructor call, is it? So we just should use the raw constructor?
Sorry, but the code makes no sence for me. This been is a singleton, right? So, who is supposed to define the T? AA just can't do that.
But the same problem could be faced with simple beans too. In this case we will be able to resolve a type, I think.
@gnuhel You are using it right. The generation has a bug, but i think i have a fix already. You should never reference the generated types only if there is no other solution (for example in manifest, or generated shared preferences).
it is a bug, as i wrote 4 hours ago and also check out the label. 😉 If you are really eager to see it, you can build this (WIP) branch. Hopefully this will be merged soon, so you can use it in a SNAPSHOT release, but i cannot see now when it will be fixed in a next stable release.
Activity
WonderCsabo commentedon May 8, 2015
This is indeed a bug, thanks for reporting!
@Artyomcool, i think we cannot solve this by just calling
APTCodeModelHeper.typeMirrorToJClass(), because the generated type is not yet present, so we cannot get theTypeMirrorin the first place. I think it is impossible to add type arguments to the constructor call, is it? So we just should use the raw constructor?Artyomcool commentedon May 8, 2015
Sorry, but the code makes no sence for me. This been is a singleton, right? So, who is supposed to define the T? AA just can't do that.
But the same problem could be faced with simple beans too. In this case we will be able to resolve a type, I think.
Artyomcool commentedon May 8, 2015
I mean, if the bean is a singleton, it can have only one instance, so it can have only one T across the app.
WonderCsabo commentedon May 8, 2015
@Artyomcool i quickly created this, WDYT?
Artyomcool commentedon May 8, 2015
Sorry, code to complex to get the idea without a context ))
WonderCsabo commentedon May 8, 2015
OK, i will create a PR soon.
Artyomcool commentedon May 8, 2015
Oh, I see. Looks like there is a problem with resolving generic, that are not directly defined, e.g. in the extending class
Artyomcool commentedon May 8, 2015
Please, don't rush with PR, look at my comments first. There is nothing you can do with singletons.
WonderCsabo commentedon May 8, 2015
Actually, the same problem is here inside a non-generic bean.
Artyomcool commentedon May 8, 2015
Oh, you are talking about handling '''@restservice''', aren't you? But in the case of trivial beans, we can use existing helpers, right?
WonderCsabo commentedon May 8, 2015
There are two helpers here:
typeMirrorToJClass: we cannot get theTypeMirrorbecause the type does not exist yetgenerifyStaticHelper:JClassis notJGenerifiableSo we should add that narrow solution which i proposed.
I mean the problem arises with a code like this:
Artyomcool commentedon May 8, 2015
What exactly type is not exists? There is a problem with your solution:
I'm not sure (i havn't reach a pc yet), but your solution shouldn't work.
WonderCsabo commentedon May 8, 2015
https://github.com/WonderCsabo/androidannotations/tree/1402_RestServiceGeneric
WonderCsabo commentedon May 8, 2015
The generated
GenericClient_does not exist at the time of annotation processing, so we cannot use itsTypeMirror.gnuhel commentedon May 8, 2015
@Artyomcool
you are right with Singleton. I haven't thought about it. But you can remove
(scope = EBean.Scope.Singleton)or should I use
@RestService HrRestClient_<T> restClient;instead?I can only try it on Monday again.
WonderCsabo commentedon May 8, 2015
@gnuhel You are using it right. The generation has a bug, but i think i have a fix already. You should never reference the generated types only if there is no other solution (for example in manifest, or generated shared preferences).
Artyomcool commentedon May 8, 2015
@WonderCsabo, don't you think, that @gnuhel still should remove a singleton scope?
WonderCsabo commentedon May 8, 2015
i was responding to this question only. Yeah, the singleton scope does not make sense in this case, because nobody can substitute the type parameter.
gnuhel commentedon May 8, 2015
@Artyomcool @WonderCsabo
So it is a bug? Can I expect a fix soon?
WonderCsabo commentedon May 8, 2015
it is a bug, as i wrote 4 hours ago and also check out the label. 😉 If you are really eager to see it, you can build this (WIP) branch. Hopefully this will be merged soon, so you can use it in a SNAPSHOT release, but i cannot see now when it will be fixed in a next stable release.
gnuhel commentedon May 8, 2015
Cool thank you
WonderCsabo commentedon Jun 10, 2015
Fixed.