Rework class objects
Class objects have name "Default" by default
Do not produce synthetic class objects
Class objects have new semantics:
class "A" has class object "B" if literal "A" can be used as a value of type "B"
Class objects act like ordinary nested objects
i.e. are accessible from class scope via getClassifier()
Jvm backend: class object fields and class have the name of class object ("Default")
as opposed to special "OBJECT$" and "object"
Serialization: only the name of class object is needed to serialize data
This commit is contained in:
-19
@@ -120,25 +120,6 @@ public class CliLightClassGenerationSupport extends LightClassGenerationSupport
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetClassOrObject> findClassOrObjectDeclarations(@NotNull FqName fqName, @NotNull final GlobalSearchScope searchScope) {
|
||||
if (JvmAbi.isClassObjectFqName(fqName)) {
|
||||
Collection<JetClassOrObject> parentClasses = findClassOrObjectDeclarations(fqName.parent(), searchScope);
|
||||
return ContainerUtil.mapNotNull(
|
||||
parentClasses,
|
||||
new Function<JetClassOrObject, JetClassOrObject>() {
|
||||
@Override
|
||||
public JetClassOrObject fun(JetClassOrObject classOrObject) {
|
||||
if (classOrObject instanceof JetClass) {
|
||||
JetClassObject classObject = ((JetClass) classOrObject).getClassObject();
|
||||
if (classObject != null) {
|
||||
return classObject.getObjectDeclaration();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Collection<ClassDescriptor> classDescriptors = ResolveSessionUtils.getClassDescriptorsByFqName(getModule(), fqName);
|
||||
|
||||
return ContainerUtil.mapNotNull(classDescriptors, new Function<ClassDescriptor, JetClassOrObject>() {
|
||||
|
||||
Reference in New Issue
Block a user