javacompound-type

Compound type in java


In open-jdk 7-b147 in class com.sun.tools.javac.code.Type we have the following method

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;

}

What does mean compound type in Java?


Solution

  • Researching on Google, they appear to be an academically proposed "extension" to Java.

    "Compound types" are described as a specifier for reference-types which must implement multiple classes or interfaces. This is intended to help static verifiability & compile-time correctness when multiple APIs (interfaces) must all be implemented.

    Invented example:

    [CustomerService,IRpcGateway,IOSGiComponent] custSvc = new CustomerService();
    

    I found the following links: