This repository was archived by the owner on Feb 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
1657 ignore otto annotions for not enhanced classes #1658
Merged
WonderCsabo
merged 2 commits into
androidannotations:develop
from
dodgex:1657_ignore_otto_annotions_for_not_enhanced_classes
Dec 17, 2015
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
.../androidannotations-otto/otto/src/test/java/org/androidannotations/otto/EnhancedBean.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /** | ||
| * Copyright (C) 2010-2015 eBusiness Information, Excilys Group | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed To in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
| package org.androidannotations.otto; | ||
|
|
||
| import org.androidannotations.annotations.EBean; | ||
|
|
||
| import com.squareup.otto.Produce; | ||
| import com.squareup.otto.Subscribe; | ||
|
|
||
| @EBean | ||
| public class EnhancedBean { | ||
|
|
||
| @Subscribe | ||
| public void subscriber(String fakeEvent) { | ||
| } | ||
|
|
||
| @Produce | ||
| public String producer() { | ||
| return ""; | ||
| } | ||
| } |
31 changes: 31 additions & 0 deletions
31
...droidannotations-otto/otto/src/test/java/org/androidannotations/otto/NonEnhancedBean.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /** | ||
| * Copyright (C) 2010-2015 eBusiness Information, Excilys Group | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed To in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
| package org.androidannotations.otto; | ||
|
|
||
| import com.squareup.otto.Produce; | ||
| import com.squareup.otto.Subscribe; | ||
|
|
||
| public class NonEnhancedBean { | ||
|
|
||
| @Subscribe | ||
| public void subscriber(String fakeEvent) { | ||
| } | ||
|
|
||
| @Produce | ||
| public String producer() { | ||
| return ""; | ||
| } | ||
| } |
65 changes: 65 additions & 0 deletions
65
...idannotations-otto/otto/src/test/java/org/androidannotations/otto/OttoGenerationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /** | ||
| * Copyright (C) 2010-2015 eBusiness Information, Excilys Group | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed To in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
| package org.androidannotations.otto; | ||
|
|
||
| import static org.junit.Assert.assertFalse; | ||
| import static org.junit.Assert.assertTrue; | ||
|
|
||
| import java.io.File; | ||
|
|
||
| import org.androidannotations.internal.AndroidAnnotationProcessor; | ||
| import org.androidannotations.testutils.AAProcessorTestHelper; | ||
| import org.junit.Before; | ||
| import org.junit.Test; | ||
|
|
||
| public class OttoGenerationTest extends AAProcessorTestHelper { | ||
|
|
||
| @Before | ||
| public void setUp() { | ||
| addManifestProcessorParameter(OttoGenerationTest.class); | ||
| addProcessor(AndroidAnnotationProcessor.class); | ||
| } | ||
|
|
||
| @Test | ||
| public void enhancedClassCompilesSuccessfully() { | ||
| assertCompilationSuccessful(compileFiles(EnhancedBean.class)); | ||
| } | ||
|
|
||
| @Test | ||
| public void nonEnhancedClassCompilesSuccessfully() { | ||
| assertCompilationSuccessful(compileFiles(NonEnhancedBean.class)); | ||
| } | ||
|
|
||
| @Test | ||
| public void enhancedClassGeneratesCode() { | ||
| CompileResult result = compileFiles(EnhancedBean.class); | ||
| File generatedFile = toGeneratedFile(EnhancedBean.class); | ||
|
|
||
| assertCompilationSuccessful(result); | ||
|
|
||
| assertTrue(generatedFile.exists()); | ||
| } | ||
|
|
||
| @Test | ||
| public void nonEnhancedClassDoesNotGenerateCode() { | ||
| CompileResult result = compileFiles(NonEnhancedBean.class); | ||
| File generatedFile = toGeneratedFile(NonEnhancedBean.class); | ||
|
|
||
| assertCompilationSuccessful(result); | ||
|
|
||
| assertFalse(generatedFile.exists()); | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
...Annotations/androidannotations-otto/otto/src/test/java/org/androidannotations/otto/R.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /** | ||
| * Copyright (C) 2010-2015 eBusiness Information, Excilys Group | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| * use this file except in compliance with the License. You may obtain a copy of | ||
| * the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed To in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| * License for the specific language governing permissions and limitations under | ||
| * the License. | ||
| */ | ||
| package org.androidannotations.otto; | ||
|
|
||
| public class R { | ||
| } |
26 changes: 26 additions & 0 deletions
26
...dannotations-otto/otto/src/test/resources/org/androidannotations/otto/AndroidManifest.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- | ||
|
|
||
| Copyright (C) 2010-2015 eBusiness Information, Excilys Group | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
| use this file except in compliance with the License. You may obtain a copy of | ||
| the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed To in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
| License for the specific language governing permissions and limitations under | ||
| the License. | ||
|
|
||
| --> | ||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| package="org.androidannotations.otto" | ||
| android:versionCode="1" | ||
| android:versionName="1.0" > | ||
|
|
||
| <application /> | ||
|
|
||
| </manifest> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need the next
enclosingElementHasEnhancedComponentAnnotation()call?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, i have not touched it as i was not sure why exaclty it was there...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but i think, we can remove it.. double checking should not be necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, i am talking about this. https://github.com/dodgex/androidannotations/blob/1657_ignore_otto_annotions_for_not_enhanced_classes/AndroidAnnotations/androidannotations-otto/otto/src/main/java/org/androidannotations/otto/handler/AbstractOttoHandler.java#L48
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a empty line? :D maybe because i already removed the check you were talking about? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.