Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Generic View Type #24

Closed
bennyhuo opened this issue Feb 7, 2023 · 15 comments
Closed

Support Generic View Type #24

bennyhuo opened this issue Feb 7, 2023 · 15 comments
Labels
bug Something isn't working
Milestone

Comments

@bennyhuo
Copy link
Member

bennyhuo commented Feb 7, 2023

Generated files from layout contains generic view type cannot compile.

image

The type of pickerView is UIKitOptionsExtPickerView<T>.

Consider generating Java source code to avoid the generic arguments by taking advance of the Java raw type.

@jarvan11
Copy link

企业微信截图_1691995248830
Error:One type argument expected for class BannerViewPager<T : Any!>
泛型报错,不支持这种么?

@RicardoJiang
Copy link
Contributor

企业微信截图_1691995248830 Error:One type argument expected for class BannerViewPager<T : Any!> 泛型报错,不支持这种么?

是的,还不支持泛型类型,可以先把这种 layout 加入 blackList 不生成代码,这部分 layout 手动迁移到 findViewById 或者 ViewBinding

@bennyhuo bennyhuo added this to the 1.8.20-1.2.0 milestone Aug 17, 2023
bennyhuo added a commit that referenced this issue Aug 17, 2023
@bennyhuo
Copy link
Member Author

bennyhuo commented Aug 17, 2023

试一下 1.8.20-1.2.0-SNAPSHOT。

@jarvan11
Copy link

1.8.20-1.2.0-SNAPSHOT
@bennyhuo Could not find com.kanyun.kace:kace-gradle-plugin:1.8.20-1.2.0-SNAPSHOT.
企业微信截图_16922444726469

@RicardoJiang
Copy link
Contributor

1.8.20-1.2.0-SNAPSHOT
@bennyhuo Could not find com.kanyun.kace:kace-gradle-plugin:1.8.20-1.2.0-SNAPSHOT.
企业微信截图_16922444726469

snapshot 依赖需要添加如下 maven 仓库地址:
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" }

@jarvan11
Copy link

1.8.20-1.2.0-SNAPSHOT
@bennyhuo @RicardoJiang 加了也不行,没看到1.8.20-1.2.0相关的。
https://s01.oss.sonatype.org/content/repositories/snapshots/com/kanyun/kace/kace-gradle-plugin/
企业微信截图_16922511704975

@RicardoKanYun
Copy link

1.8.20-1.2.0-SNAPSHOT
@bennyhuo @RicardoJiang 加了也不行,没看到1.8.20-1.2.0相关的。
https://s01.oss.sonatype.org/content/repositories/snapshots/com/kanyun/kace/kace-gradle-plugin/
企业微信截图_16922511704975

现在好了,再看看

@jarvan11
Copy link

企业微信截图_1691995248830 Error:One type argument expected for class BannerViewPager<T : Any!> 泛型报错,不支持这种么?

@bennyhuo @RicardoKanYun 接入1.8.20-1.2.0-SNAPSHOT,还有这个地方的泛型报错,
error:One type argument expected for class BannerViewPager<T : Any!>
企业微信截图_16922569385241

@bennyhuo
Copy link
Member Author

稍等,我 Fix 一下

@bennyhuo
Copy link
Member Author

已经更新,再编译一下试试,版本号不变

@jarvan11
Copy link

已经更新,再编译一下试试,版本号不变

@bennyhuo 更新编译了,还是不行
企业微信截图_16922616352552
附BannerViewPager三方库类:
企业微信截图_16922616994408

@bennyhuo
Copy link
Member Author

看样子你没有拉到最新的包,编译生成的代码应该是这样:

image

KaceViewUtils 是这次提交新加的

@jarvan11
Copy link

看样子你没有拉到最新的包,编译生成的代码应该是这样:

image KaceViewUtils 是这次提交新加的

嗯,可以了,SNAPSHOT版本不能实时更新问题,设置下SNAPSHOT依赖gradle默认缓存时间就好了。
但是KaceViewUtils没找到(Unresolved reference: KaceViewUtils)?
企业微信截图_16922631916644

@bennyhuo
Copy link
Member Author

kace-runtime 也需要清一下缓存的

@bennyhuo
Copy link
Member Author

没有问题的话我准备直接发正式版了。有问题可以随时把 issue 打开。

bennyhuo added a commit that referenced this issue Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants