Create error type if reflection class isn't found

Introduce a new diagnostic fired when reflection types aren't found in the
classpath
This commit is contained in:
Alexander Udalov
2014-05-08 22:02:11 +04:00
parent 9503056dd5
commit 845e3323f9
9 changed files with 50 additions and 19 deletions
@@ -227,7 +227,7 @@ public class ErrorUtils {
}
}
private static final ErrorClassDescriptor ERROR_CLASS = new ErrorClassDescriptor("");
private static final ErrorClassDescriptor ERROR_CLASS = new ErrorClassDescriptor(null);
@NotNull
public static JetScope createErrorScope(@NotNull String debugMessage) {
@@ -17,6 +17,7 @@
package org.jetbrains.jet.lang.types.error;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorImpl;
@@ -32,13 +33,12 @@ import java.util.List;
import static org.jetbrains.jet.lang.types.ErrorUtils.*;
public final class ErrorClassDescriptor extends ClassDescriptorImpl {
public ErrorClassDescriptor(@NotNull String debugMessage) {
super(getErrorModule(), Name.special("<ERROR CLASS: " + debugMessage + ">"), Modality.OPEN, Collections.<JetType>emptyList());
ConstructorDescriptorImpl errorConstructor =
ConstructorDescriptorImpl.create(this, Annotations.EMPTY, true);
public class ErrorClassDescriptor extends ClassDescriptorImpl {
public ErrorClassDescriptor(@Nullable String name) {
super(getErrorModule(), Name.special(name == null ? "<ERROR CLASS>" : "<ERROR CLASS: " + name + ">"),
Modality.OPEN, Collections.<JetType>emptyList());
ConstructorDescriptorImpl errorConstructor = ConstructorDescriptorImpl.create(this, Annotations.EMPTY, true);
errorConstructor.initialize(Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(),
Visibilities.INTERNAL, false);
errorConstructor.setReturnType(createErrorType("<ERROR RETURN TYPE>"));