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

验证或者支持在更高的 LTS 版本运行 #11

Closed
4 tasks done
Createsequence opened this issue Feb 15, 2023 · 5 comments
Closed
4 tasks done

验证或者支持在更高的 LTS 版本运行 #11

Createsequence opened this issue Feb 15, 2023 · 5 comments
Assignees
Labels
primary This is an important feature or fix that needs to be completed as a top priority refactor Refactoring code to optimize or add functionality
Milestone

Comments

@Createsequence
Copy link
Collaborator

Createsequence commented Feb 15, 2023

目标是适配 11 和 17,预期将会调整三部分内容:

  • core 模块本体;
  • spring 扩展;
  • mp 扩展;
  • springboot 的 starter 扩展;
@Createsequence Createsequence added the enhancement New feature or request label Feb 15, 2023
@Createsequence Createsequence self-assigned this Feb 15, 2023
@Createsequence Createsequence added this to the release 0.0.2-alpha milestone Feb 17, 2023
@Createsequence Createsequence removed their assignment Mar 14, 2023
@Createsequence Createsequence changed the title Support higher versions than jdk8 验证或者支持在更高的 LTS 版本运行 Mar 16, 2023
@Createsequence Createsequence added refactor Refactoring code to optimize or add functionality primary This is an important feature or fix that needs to be completed as a top priority and removed enhancement New feature or request labels Jun 30, 2023
@Createsequence
Copy link
Collaborator Author

Createsequence commented Jul 6, 2023

2023-07-06 补充:

我们在分支 feat/java-lts-support 上进行了验证,并成功升级了 JDK、SpringBoot、MybatisPlus 以及相关组件的依赖。结果显示,crane4j 在这些升级后的环境下可以正常运行。目前我们只发现了一些与 SpringBoot 和 MP 等第三方库之间兼容性的问题。然而,只要用户的项目中的对应依赖可以兼容,覆盖 crane4j 后仍然可以正常运行。

尽管如此,我们目前还不能断定升级过程一定不会产生任何问题。后续我们将在其他独立项目中进行进一步测试,以确认其无缝升级的可行性。

@iko233
Copy link
Contributor

iko233 commented Jul 30, 2023

JDK17的环境下LambdaContainer.forLambda方法下使用Function.identity()编译时会出现以下错误
cn/crane4j/spring/boot/example/ManyToManyAssembleExampleTest.java#init

不兼容的类型: 推断类型不符合下限
推断: cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo
下限: java.lang.Object,cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo

Function.identity()更换为item->item暂可运行

@Createsequence
Copy link
Collaborator Author

Createsequence commented Jul 31, 2023

JDK17的环境下LambdaContainer.forLambda方法下使用Function.identity()编译时会出现以下错误 cn/crane4j/spring/boot/example/ManyToManyAssembleExampleTest.java#init

不兼容的类型: 推断类型不符合下限 推断: cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo 下限: java.lang.Object,cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo

Function.identity()更换为item->item暂可运行

有兴趣提个PR修复一下这个问题吗?

@iko233
Copy link
Contributor

iko233 commented Jul 31, 2023

JDK17的环境下LambdaContainer.forLambda方法下使用Function.identity()编译时会出现以下错误 cn/crane4j/spring/boot/example/ManyToManyAssembleExampleTest.java#init
不兼容的类型: 推断类型不符合下限 推断: cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo 下限: java.lang.Object,cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo
Function.identity()更换为item->item暂可运行

有兴趣提个PR修复一下这个问题吗?

这个似乎是jdk17的泛型判断存在问题,我无法提供一个较好的解决方案,目前只有几个不完美的方案

  1. 更换Function.identity()为item->item
    2.显式声明LambdaContainer类型 LambdaContainer.forLambda -> LambdaContainer.<Integer>forLambda
    3.显示声明Function.identity()类型。 -> Function.<Integer>identity();

@Createsequence
Copy link
Collaborator Author

JDK17的环境下LambdaContainer.forLambda方法下使用Function.identity()编译时会出现以下错误 cn/crane4j/spring/boot/example/ManyToManyAssembleExampleTest.java#init
不兼容的类型: 推断类型不符合下限 推断: cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo 下限: java.lang.Object,cn.crane4j.spring.boot.example.ManyToManyAssembleExampleTest.Foo
Function.identity()更换为item->item暂可运行

有兴趣提个PR修复一下这个问题吗?

这个似乎是jdk17的泛型判断存在问题,我无法提供一个较好的解决方案,目前只有几个不完美的方案

  1. 更换Function.identity()为item->item
    2.显式声明LambdaContainer类型 LambdaContainer.forLambda -> LambdaContainer.<Integer>forLambda
    3.显示声明Function.identity()类型。 -> Function.<Integer>identity();

我觉得第三个方案不错。

另外,我也觉得这个问题在 JDK8 的环境下没有出现确实挺诡异的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
primary This is an important feature or fix that needs to be completed as a top priority refactor Refactoring code to optimize or add functionality
Projects
None yet
Development

No branches or pull requests

2 participants