Got rid of constructors/initializers zoo in simple function descriptors
This commit is contained in:
+18
-21
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.jet.lang.resolve.java.descriptor;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
@@ -27,26 +28,9 @@ import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implements JavaCallableMemberDescriptor {
|
||||
private Boolean hasStableParameterNames = null;
|
||||
|
||||
public JavaMethodDescriptor(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull Name name
|
||||
) {
|
||||
this(containingDeclaration, annotations, name, Kind.DECLARATION);
|
||||
}
|
||||
|
||||
private JavaMethodDescriptor(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull Name name,
|
||||
@NotNull Kind kind
|
||||
) {
|
||||
super(containingDeclaration, annotations, name, kind);
|
||||
}
|
||||
|
||||
private JavaMethodDescriptor(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull SimpleFunctionDescriptor original,
|
||||
@Nullable SimpleFunctionDescriptor original,
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull Name name,
|
||||
@NotNull Kind kind
|
||||
@@ -54,6 +38,15 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
|
||||
super(containingDeclaration, original, annotations, name, kind);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static JavaMethodDescriptor createJavaMethod(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@NotNull Annotations annotations,
|
||||
@NotNull Name name
|
||||
) {
|
||||
return new JavaMethodDescriptor(containingDeclaration, null, annotations, name, Kind.DECLARATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableParameterNames() {
|
||||
assert hasStableParameterNames != null : "hasStableParameterNames was not set: " + this;
|
||||
@@ -66,9 +59,13 @@ public class JavaMethodDescriptor extends SimpleFunctionDescriptorImpl implement
|
||||
|
||||
@Override
|
||||
protected FunctionDescriptorImpl createSubstitutedCopy(DeclarationDescriptor newOwner, boolean preserveOriginal, Kind kind) {
|
||||
JavaMethodDescriptor result = preserveOriginal
|
||||
? new JavaMethodDescriptor(newOwner, getOriginal(), getAnnotations(), getName(), kind)
|
||||
: new JavaMethodDescriptor(newOwner, getAnnotations(), getName(), kind);
|
||||
JavaMethodDescriptor result = new JavaMethodDescriptor(
|
||||
newOwner,
|
||||
preserveOriginal ? getOriginal() : null,
|
||||
getAnnotations(),
|
||||
getName(),
|
||||
kind
|
||||
);
|
||||
result.setHasStableParameterNames(hasStableParameterNames());
|
||||
return result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class SamConstructorDescriptor extends SimpleFunctionDescriptorImpl
|
||||
@NotNull ClassOrPackageFragmentDescriptor containingDeclaration,
|
||||
@NotNull JavaClassDescriptor samInterface
|
||||
) {
|
||||
super(containingDeclaration, samInterface.getAnnotations(), samInterface.getName(), Kind.SYNTHESIZED);
|
||||
super(containingDeclaration, null, samInterface.getAnnotations(), samInterface.getName(), Kind.SYNTHESIZED);
|
||||
this.samInterface = samInterface;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ public abstract class LazyJavaMemberScope(
|
||||
|
||||
internal fun resolveMethodToFunctionDescriptor(method: JavaMethod, record: Boolean = true): SimpleFunctionDescriptor {
|
||||
|
||||
val functionDescriptorImpl = JavaMethodDescriptor(_containingDeclaration, c.resolveAnnotations(method), method.getName())
|
||||
val functionDescriptorImpl = JavaMethodDescriptor.createJavaMethod(_containingDeclaration, c.resolveAnnotations(method), method.getName())
|
||||
|
||||
val c = c.child(functionDescriptorImpl, method.getTypeParameters().toSet())
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.jetbrains.jet.lang.resolve.java.descriptor.SamAdapterDescriptor;
|
||||
private final SimpleFunctionDescriptor declaration;
|
||||
|
||||
public SamAdapterFunctionDescriptor(@NotNull SimpleFunctionDescriptor declaration) {
|
||||
super(declaration.getContainingDeclaration(), declaration.getAnnotations(), declaration.getName(), Kind.SYNTHESIZED);
|
||||
super(declaration.getContainingDeclaration(), null, declaration.getAnnotations(), declaration.getName(), Kind.SYNTHESIZED);
|
||||
this.declaration = declaration;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user