java中的复合类型

5 java openjdk compound-type

7-b147类中的open-jdk 中,com.sun.tools.javac.code.Type我们有以下方法

public boolean isCompound(){
    return tsym.completer==null
    // Compound types can't have a completer.  Calling
    // flags() will complete the symbol causing the
    // compiler to load classes unnecessarily.  This led
    // to regression 6180021.
    && (tsym.flags() & COMPOUND)!=0;

}
Run Code Online (Sandbox Code Playgroud)

Java中的复合类型是什么意思?

Tho*_*s W 3

通过 Google 研究,它们似乎是学术上提出的 Java“扩展”。

“复合类型”被描述为必须实现多个类或接口的引用类型的说明符。这是为了在必须全部实现多个 API(接口)时帮助静态验证和编译时正确性。

发明的例子:

[CustomerService,IRpcGateway,IOSGiComponent] custSvc = new CustomerService();
Run Code Online (Sandbox Code Playgroud)

我找到了以下链接: