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
Fix for @ViewById generic issues #1353
Merged
yDelouis
merged 3 commits into
androidannotations:develop
from
WonderCsabo:1351_viewByIdGenerics
Apr 6, 2015
Merged
Changes from all commits
Commits
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
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
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
35 changes: 35 additions & 0 deletions
35
...oidannotations/src/test/java/org/androidannotations/viewbyid/GenericViewByIdActivity.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,35 @@ | ||
| /** | ||
| * 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.viewbyid; | ||
|
|
||
| import org.androidannotations.annotations.EActivity; | ||
| import org.androidannotations.annotations.ViewById; | ||
| import org.androidannotations.eviewgroup.SomeGenericViewGroup; | ||
|
|
||
| import android.app.Activity; | ||
|
|
||
| @EActivity | ||
| public class GenericViewByIdActivity extends Activity { | ||
|
|
||
| @ViewById | ||
| SomeGenericViewGroup<CharSequence> view; | ||
|
|
||
| @ViewById | ||
| SomeGenericViewGroup<?> view2; | ||
|
|
||
| @ViewById | ||
| SomeGenericViewGroup<? extends CharSequence> view3; | ||
| } |
9 changes: 9 additions & 0 deletions
9
AndroidAnnotations/androidannotations/src/test/java/org/androidannotations/viewbyid/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,9 @@ | ||
| package org.androidannotations.viewbyid; | ||
|
|
||
| public class R { | ||
| public static final class id { | ||
| public static final int view = 0x7f06000a; | ||
| public static final int view2 = 0x7f06000b; | ||
| public static final int view3 = 0x7f06000c; | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
...ations/androidannotations/src/test/java/org/androidannotations/viewbyid/ViewByIdTest.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,36 @@ | ||
| /** | ||
| * 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.viewbyid; | ||
|
|
||
| import org.androidannotations.AndroidAnnotationProcessor; | ||
| import org.androidannotations.utils.AAProcessorTestHelper; | ||
| import org.junit.Before; | ||
| import org.junit.Test; | ||
|
|
||
| public class ViewByIdTest extends AAProcessorTestHelper { | ||
|
|
||
| @Before | ||
| public void setUp() { | ||
| addManifestProcessorParameter(ViewByIdTest.class); | ||
| addProcessor(AndroidAnnotationProcessor.class); | ||
| } | ||
|
|
||
| @Test | ||
| public void viewByIdGenericViewCompiles() { | ||
| assertCompilationSuccessful(compileFiles(GenericViewByIdActivity.class)); | ||
| } | ||
|
|
||
| } |
28 changes: 28 additions & 0 deletions
28
...androidannotations/src/test/resources/org/androidannotations/viewbyid/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,28 @@ | ||
| <?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.viewbyid" | ||
| android:versionCode="1" | ||
| android:versionName="1.0" > | ||
|
|
||
| <application> | ||
| <activity android:name="org.androidannotations.viewbyid.GenericViewByIdActivity_" /> | ||
| </application> | ||
|
|
||
| </manifest> |
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.
I changed this because now we do not need the
TypeElementpassed to this method, which is not always available. I know this is ugly and an anti-pattern, but the other way is using 30 lines of reflective code to access the needed values from CodeModel. 😟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.
I'm okay with that.