JDK-11将删除JDK的许多旧部分(JEP-320).对于其中一些(例如JAXB),功能将作为常规库提供.您只需添加另一个依赖项,一切正常.
但对于CORBA则不然,因为
使用Java中的CORBA开发现代应用程序没有太大的兴趣
然而,我仍然处于痛苦的境地,需要维护仍旧需要CORBA的旧应用程序,同时仍希望更新到JDK-11.
在没有删除这些应用程序的CORBA功能的情况下,是否有替换库或迁移到JDK-11的另一种好方法?
考虑以下小例子:
package prv.rli.codetest;
import java.lang.reflect.Method;
public class BreakingInterfaces {
interface Base {
BaseFoo foo();
interface BaseFoo {
}
}
interface Derived extends Base {
DerivedFoo foo();
interface DerivedFoo extends BaseFoo {
}
}
public static void main(String[] args) {
dumpDeclaredMethods(Derived.class);
}
private static void dumpDeclaredMethods(Class<?> class1) {
System.out.println("---" + class1.getSimpleName() + "---");
Method[] methods = class1.getDeclaredMethods();
for (Method method : methods) {
System.out.println(method);
}
System.out.println("----------");
}
}
Run Code Online (Sandbox Code Playgroud)
如果使用jdk1.7.0.55编译上面的示例,则输出为:
---Derived---
public abstract BreakingInterfaces$Derived$DerivedFoo BreakingInterfaces$Derived.foo()
----------
Run Code Online (Sandbox Code Playgroud)
但是当使用jdk1.8.0.25时,输出是:
---Derived---
public abstract prv.rli.codetest.BreakingInterfaces$Derived$DerivedFoo prv.rli.codetest.BreakingInterfaces$Derived.foo() …
Run Code Online (Sandbox Code Playgroud)