Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

AA: 3.1 - Otto support #1131

Closed
davidjorgensen opened this issue Sep 9, 2014 · 19 comments
Closed

AA: 3.1 - Otto support #1131

davidjorgensen opened this issue Sep 9, 2014 · 19 comments

Comments

@davidjorgensen
Copy link

Congratulations on the release of AA 3.1. Awesome work by everyone.

So, did you decide to remove support for Otto, or what happened in the process? Maybe I am missing something?

Regards,
David

@WonderCsabo
Copy link
Member

We did not drop Otto support. We changed our code generation so we now copy all non-AA annotations (like com.squareup.otto.Produce) when we override a method. So you just have to simply use the annotations from Otto, AFAIK. Please see the discussion in #782. @yDelouis I hope i am correct here.

@davidjorgensen
Copy link
Author

If I just update AA from 3.0.1 to 3.1 my Otto implementation breaks

@atali
Copy link

atali commented Sep 9, 2014

Hello
Yesterday, I upgraded to 3.1 and my otto annotation do not work anymore.
Le 9 sept. 2014 11:22, "David Jørgensen" notifications@github.com a écrit
:

If I just update AA from 3.0.1 to 3.1 my Otto implementation breaks


Reply to this email directly or view it on GitHub
#1131 (comment)
.

@WonderCsabo
Copy link
Member

Can you guys provide a simple projekt which uses AA and Otto?

@atali
Copy link

atali commented Sep 9, 2014

Hello,

It will be a little bit complex to do a sample project, but I can extract some logics :

public abstract class AbstractScreen extends Fragment {

@subscribe
public void onSessionDataChanged(SessionDataChangedEvent event) {

}

}

Then I have a class that derived from class AbstractScreen

@efragment(R.layout.navigation_action_pos)
public class ActionNavigationScreen extends AbstractScreen {

}

In 3.0.1, I got the following method generated

@Override
@Subscribe
public void onSessionDataChanged(final SessionDataChangedEvent event) {
    ActionNavigationScreen_.super.onSessionDataChanged(event);
}

But in 3.1, nothing is generated .

Hope that helps.

Best regards,
Atali

Le 9 sept. 2014 à 12:31, Csaba Kozák notifications@github.com a écrit :

Can you guys provide a simple projekt which uses AA and Otto?
On Sep 9, 2014 12:05 PM, "Atali" notifications@github.com wrote:

Hello
Yesterday, I upgraded to 3.1 and my otto annotation do not work anymore.
Le 9 sept. 2014 11:22, "David Jørgensen" notifications@github.com a
écrit
:

If I just update AA from 3.0.1 to 3.1 my Otto implementation breaks

Reply to this email directly or view it on GitHub
<
https://github.com/excilys/androidannotations/issues/1131#issuecomment-54944390>

.

Reply to this email directly or view it on GitHub
#1131 (comment)
.


Reply to this email directly or view it on GitHub.

@WonderCsabo
Copy link
Member

Are you using the annotation procesing version of otto as described in the wiki?

@atali
Copy link

atali commented Sep 9, 2014

Maybe I have missing out on something , because I have read the following wiki :
https://github.com/excilys/androidannotations/wiki/OttoIntegration

There is no mention of annotation processing version of otto :-(

Le 9 sept. 2014 à 12:48, Csaba Kozák notifications@github.com a écrit :

Are you using the annotation procesing version of otto as described in the
wiki?

@yDelouis
Copy link
Contributor

yDelouis commented Sep 9, 2014

We copy non-AA annotations from the class to the generated class.
But we don't copy non-AA annotations from the parent to the child generated class. This case was handled before 3.1.
A workaround would be to override the method in the child class and to annotate it with @Subscribe.

@WonderCsabo
Copy link
Member

You should use otto 2.0 wip version which walks parent classes too find annotations.

@davidjorgensen
Copy link
Author

aah.. so I was missing something.. I do apologize.. Carry on.. :)

@WonderCsabo
Copy link
Member

@yDelouis should we copy from parent classes? I do not think so, since the lib which uses the annotation should check parent classes anyway. AAs is only breaks this if the lib wants to get annotations from the leaf class, but we fixed that by copying.

@yDelouis
Copy link
Contributor

yDelouis commented Sep 9, 2014

If don't think so either.

@atali
Copy link

atali commented Sep 9, 2014

Nobody seems to work on this branch :(

Le 9 sept. 2014 à 13:01, Csaba Kozák notifications@github.com a écrit :

You should use otto 2.0 wip version which walks parent classes too find
annotations.

Reply to this email directly or view it on GitHub.

@WonderCsabo
Copy link
Member

That branch is dead. I think you guys should try greenrobot eventbus.

@atali
Copy link

atali commented Sep 9, 2014

It’s weird, because in 3.0.1 the annotations is copied from parent to generated class. I switched back to 3.0.1 and tested it again, the method with annotation is copied.

In 3.1, I also overrided the method on the child and annotate it with @subscribe, but still the method is not generated. The log below :

:13:21.197 [main] INFO o.a.AndroidAnnotationProcessor:84 - Initialize AndroidAnnotations 3.1 with options {trace=true, logLevel=info, logConsoleAppender=true}
13:13:21.257 [main] INFO o.a.AndroidAnnotationProcessor:108 - Start processing for 31 annotations on 457 elements
13:13:21.391 [main] INFO o.a.AndroidAnnotationProcessor:171 - AndroidManifest.xml found: AndroidManifest [applicationPackage=com.zenittude, componentQualifiedNames=[com.zenittude.v2.module.takeaway.TakeAwayActivity_, com.zenittude.SimpleAuthenticationActivity_, com.zenittude.ToggleFeatureActivity_, com.zenittude.StartupActivity_, com.zenittude.SplashScreenActivity_, com.zenittude.sync.SyncService_, com.zenittude.provider.ImageContentProvider_, com.zenittude.provider.ProductContentProvider_, com.zenittude.provider.OrderPaymentSummaryContentProvider_], permissionQualifiedNames=[android.permission.RECORD_AUDIO, android.permission.ACCESS_NETWORK_STATE, android.permission.WRITE_EXTERNAL_STORAGE, android.permission.MOUNT_UNMOUNT_FILESYSTEMS, android.permission.CAMERA, android.permission.VIBRATE, android.permission.GET_ACCOUNTS, android.permission.USE_CREDENTIALS, android.permission.MANAGE_ACCOUNTS, android.permission.AUTHENTICATE_ACCOUNTS, android.permission.WAKE_LOCK, android.permission.INTERNET, android.permission.READ_SYNC_STATS, android.permission.READ_SYNC_SETTINGS, android.permission.WRITE_SYNC_SETTINGS], applicationClassName=com.zenittude.MainApplication, libraryProject=false, debugabble=true, minSdkVersion=16, maxSdkVersion=-1, targetSdkVersion=21]
13:13:21.392 [main] INFO o.a.r.ProjectRClassFinder:50 - Found project R class: com.zenittude.R
13:13:21.400 [main] INFO o.a.r.AndroidRClassFinder:44 - Found Android class: android.R
13:13:21.417 [main] INFO o.a.p.ModelValidator:42 - Validating elements
13:13:21.535 [main] INFO o.a.p.ModelProcessor:69 - Processing root elements
13:13:21.617 [main] INFO o.a.p.ModelProcessor:77 - Processing enclosed elements
13:13:21.810 [main] INFO o.a.AndroidAnnotationProcessor:250 - Number of files generated by AndroidAnnotations: 190
13:13:21.812 [main] INFO o.a.g.ApiCodeGenerator:52 - Writting following API classes in project: []
13:13:22.513 [main] INFO o.a.p.TimeStats:81 - Time measurements: [Whole Processing = 1256 ms], [Generate Sources = 703 ms], [Process Annotations = 281 ms], [Extract Annotations = 129 ms], [Validate Annotations = 113 ms], [Find R Classes = 20 ms], [Extract Manifest = 5 ms],
13:13:22.513 [main] INFO o.a.AndroidAnnotationProcessor:122 - Finish processing
13:17:22.570 [pool-1-thread-2] INFO o.a.AndroidAnnotationProcessor:84 - Initialize AndroidAnnotations 3.1 with options {}
13:17:22.638 [pool-1-thread-2] INFO o.a.AndroidAnnotationProcessor:108 - Start processing for 3 annotations on 1 elements
13:17:22.643 [pool-1-thread-2] DEBUG o.a.h.AndroidManifestFinder:137 - AndroidManifest.xml file found in parent folder /Users/atali/Development/igguane_old/iresto/zen-android/zen-pos: /Users/atali/Development/igguane_old/iresto/zen-android/zen-pos/AndroidManifest.xml
13:17:22.643 [pool-1-thread-2] DEBUG o.a.h.AndroidManifestFinder:74 - Found android.library=false property in project.properties
13:17:22.653 [pool-1-thread-2] INFO o.a.AndroidAnnotationProcessor:171 - AndroidManifest.xml found: AndroidManifest [applicationPackage=com.zenittude, componentQualifiedNames=[com.zenittude.v2.module.takeaway.TakeAwayActivity_, com.zenittude.SimpleAuthenticationActivity_, com.zenittude.ToggleFeatureActivity_, com.zenittude.StartupActivity_, com.zenittude.SplashScreenActivity_, com.zenittude.sync.SyncService_, com.zenittude.provider.ImageContentProvider_, com.zenittude.provider.ProductContentProvider_, com.zenittude.provider.OrderPaymentSummaryContentProvider_], permissionQualifiedNames=[android.permission.RECORD_AUDIO, android.permission.ACCESS_NETWORK_STATE, android.permission.WRITE_EXTERNAL_STORAGE, android.permission.MOUNT_UNMOUNT_FILESYSTEMS, android.permission.CAMERA, android.permission.VIBRATE, android.permission.GET_ACCOUNTS, android.permission.USE_CREDENTIALS, android.permission.MANAGE_ACCOUNTS, android.permission.AUTHENTICATE_ACCOUNTS, android.permission.WAKE_LOCK, android.permission.INTERNET, android.permission.READ_SYNC_STATS, android.permission.READ_SYNC_SETTINGS, android.permission.WRITE_SYNC_SETTINGS], applicationClassName=com.zenittude.MainApplication, libraryProject=false, debugabble=true, minSdkVersion=16, maxSdkVersion=-1, targetSdkVersion=21]
13:17:22.653 [pool-1-thread-2] INFO o.a.r.ProjectRClassFinder:50 - Found project R class: com.zenittude.R
13:17:22.668 [pool-1-thread-2] INFO o.a.r.AndroidRClassFinder:44 - Found Android class: android.R
13:17:22.705 [pool-1-thread-2] INFO o.a.p.ModelValidator:42 - Validating elements
13:17:22.705 [pool-1-thread-2] DEBUG o.a.p.ModelValidator:62 - Validating with EFragmentHandler: [com.zenittude.v2.module.takeaway.navigation.ActionNavigationScreen]
13:17:22.710 [pool-1-thread-2] DEBUG o.a.p.ModelValidator:62 - Validating with ClickHandler: [onNewOrderButtonClicked(), onTablesManagmentButtonClicked(), onOrdersButtonClicked(), onCustomerSearchButtonClicked(), onStatisticsButtonClicked(), onPrintTicketButtonClicked(), onExitButtonClicked()]
13:17:22.717 [pool-1-thread-2] DEBUG o.a.p.ModelValidator:62 - Validating with BeanHandler: [eventBus, sessionManager, newOrderManager, navigationManager]
13:17:22.727 [pool-1-thread-2] INFO o.a.p.ModelProcessor:69 - Processing root elements
13:17:22.727 [pool-1-thread-2] DEBUG o.a.p.ModelProcessor:160 - Processing root elements EFragmentHandler: [com.zenittude.v2.module.takeaway.navigation.ActionNavigationScreen]
13:17:22.746 [pool-1-thread-2] INFO o.a.p.ModelProcessor:77 - Processing enclosed elements
13:17:22.749 [pool-1-thread-2] INFO o.a.AndroidAnnotationProcessor:250 - Number of files generated by AndroidAnnotations: 1
13:17:22.751 [pool-1-thread-2] INFO o.a.g.ApiCodeGenerator:52 - Writting following API classes in project: []
13:17:22.752 [pool-1-thread-2] DEBUG o.a.g.SourceCodewriter:55 - Generating class: com.zenittude.v2.module.takeaway.navigation.ActionNavigationScreen_
13:17:22.785 [pool-1-thread-2] INFO o.a.p.TimeStats:81 - Time measurements: [Whole Processing = 146 ms], [Find R Classes = 44 ms], [Generate Sources = 35 ms], [Process Annotations = 29 ms], [Validate Annotations = 16 ms], [Extract Manifest = 12 ms], [Extract Annotations = 3 ms],
13:17:22.785 [pool-1-thread-2] INFO o.a.AndroidAnnotationProcessor:122 - Finish processing

Le 9 sept. 2014 à 12:57, Yoann Delouis notifications@github.com a écrit :

We copy non-AA annotations from the class to the generated class.
But we don't copy non-AA annotations from the parent to the child generated class. This case was handled before 3.1.
A workaround would be to override the method in the child class and to annotate it with @subscribe.


Reply to this email directly or view it on GitHub.

@atali
Copy link

atali commented Sep 9, 2014

Thanks for the tips ! https://github.com/greenrobot/EventBus seems to be great :-) I will give a try soon. Until the migration, I will be stick with AA 3.0.1.

Le 9 sept. 2014 à 13:25, Csaba Kozák notifications@github.com a écrit :

greenrobot eventbus

@WonderCsabo
Copy link
Member

There is no need to generate the methods, since otto 2.0 wip can walk parent classes and it will find your methods annotated with @subscribe.

@WonderCsabo
Copy link
Member

I tend to close this ticket, since the problem is in the stable version of Otto (not walking to parent classes), and not in AA.

I am also wondering we should remove the Otto integration page from the wiki. Since the stable version of Otto can be used with AA as without AA (we copy non-AA annotations), there is no need to describe integration. Also that page points the user to an abandoned version of Otto, which is unfortunate. @PerfectCarl what do you think?.

@WonderCsabo
Copy link
Member

I am closing this ticket in favor of the referenced one, because that is more focused on the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants