babyfish-ct / jimmer

A revolutionary ORM framework for both java and kotlin.
Apache License 2.0
876 stars 88 forks source link

优化 `Entity` 中 is 开头非 `boolean` 类型属性的编译报错信息 #777

Closed Fs-DXMY closed 1 week ago

Fs-DXMY commented 1 week ago

正常情况

Entity 实体中 isXxx() 的返回值类型为非 boolean / Boolean 的引用类型时,编译报错提示如下:

Illegal property "com.xxx.SomeEntity.isXxx", the method whose name starts with "is" return returns boolean type

异常情况

当返回值类型为 Java 基本类型,如 int 时,编译报错信息不友好,以 Maven 为例:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project xxx: Fatal error compiling: java.lang.NullPointerException: Cannot invoke "javax.lang.model.element.Element.toString()" because the return value of "javax.lang.model.util.Types.asElement(javax.lang.model.type.TypeMirror)" is null -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
babyfish-ct commented 1 week ago

Try 0.9.15