在 Serializable 类上使用 OpenJdk11 编译 Jdk8 代码库时出现编译错误:无法解析类型 java.io.Serializable。它是从所需的 .class 文件中间接引用的
[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile (default) on project test-proj: Compiler errors:
[ERROR] error at public abstract class HiberTypeMapper implements UserType, Serializable {
[ERROR] ^^^^^^^^^^^
[ERROR] /dev_loc/test-proj/src/main/java/com/hiber/HiberTypeMapper.java:13:0::0 The type java.io.Serializable cannot be resolved. It is indirectly referenced from required .class files
[ERROR]
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.4:compile (default) on project il-commons: Compiler errors:
error at public abstract class HiberTypeMapper implements UserType, Serializable {
^^^^^^^^^^^
/dev_loc/test-proj/src/main/java/com/hiber/HiberTypeMapper.java:13:0::0 The type java.io.Serializable cannot be resolved. It is indirectly referenced from required .class files
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
它抱怨的班级
package com.hiber;
import java.io.Serializable;
import org.hibernate.usertype.UserType;
public abstract class HiberTypeMapper implements UserType, Serializable {
...
}
我的版本是:
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
Maven home: /Users/jogi/Apps/apache-maven-3.5.0
Java version: 11.0.7, vendor: AdoptOpenJDK
Java home: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
请提出解决方案,Serializable 接口是 java.base 模块的一部分,为什么编译器会出错。