Rename: SIGNATURES -> LIGHT_CLASSES
This commit is contained in:
@@ -22,7 +22,7 @@ public enum ClassBuilderMode {
|
|||||||
*/
|
*/
|
||||||
FULL,
|
FULL,
|
||||||
/**
|
/**
|
||||||
* Only function signatures
|
* Generating light classes: Only function signatures
|
||||||
*/
|
*/
|
||||||
SIGNATURES,
|
LIGHT_CLASSES,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(functionDescriptor);
|
AnnotationCodegen.forMethod(mv, typeMapper).genAnnotations(functionDescriptor);
|
||||||
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES) return;
|
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) return;
|
||||||
|
|
||||||
generateParameterAnnotations(functionDescriptor, mv, jvmSignature);
|
generateParameterAnnotations(functionDescriptor, mv, jvmSignature);
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ public class FunctionCodegen extends GenerationStateAware {
|
|||||||
int flags = getVisibilityAccessFlag(constructorDescriptor);
|
int flags = getVisibilityAccessFlag(constructorDescriptor);
|
||||||
MethodVisitor mv = classBuilder.newMethod(null, flags, "<init>", "()V", null, null);
|
MethodVisitor mv = classBuilder.newMethod(null, flags, "<init>", "()V", null, null);
|
||||||
|
|
||||||
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES) {
|
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
else if (state.getClassBuilderMode() == ClassBuilderMode.FULL) {
|
||||||
|
|||||||
@@ -151,8 +151,8 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
|
|
||||||
int access = 0;
|
int access = 0;
|
||||||
|
|
||||||
if (state.getClassBuilderMode() == ClassBuilderMode.SIGNATURES && !DescriptorUtils.isTopLevelDeclaration(descriptor)) {
|
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES && !DescriptorUtils.isTopLevelDeclaration(descriptor)) {
|
||||||
// ClassBuilderMode.SIGNATURES means we are generating light classes & looking at a nested or inner class
|
// ClassBuilderMode.LIGHT_CLASSES means we are generating light classes & looking at a nested or inner class
|
||||||
// Light class generation is implemented so that Cls-classes only read bare code of classes,
|
// Light class generation is implemented so that Cls-classes only read bare code of classes,
|
||||||
// without knowing whether these classes are inner or not (see ClassStubBuilder.EMPTY_STRATEGY)
|
// without knowing whether these classes are inner or not (see ClassStubBuilder.EMPTY_STRATEGY)
|
||||||
// Thus we must write full accessibility flags on inner classes in this mode
|
// Thus we must write full accessibility flags on inner classes in this mode
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class MemberCodegen extends GenerationStateAware {
|
|||||||
ClassDescriptor descriptor = state.getBindingContext().get(BindingContext.CLASS, aClass);
|
ClassDescriptor descriptor = state.getBindingContext().get(BindingContext.CLASS, aClass);
|
||||||
|
|
||||||
if (descriptor == null || ErrorUtils.isError(descriptor) || descriptor.getName().equals(JetPsiUtil.NO_NAME_PROVIDED)) {
|
if (descriptor == null || ErrorUtils.isError(descriptor) || descriptor.getName().equals(JetPsiUtil.NO_NAME_PROVIDED)) {
|
||||||
if (state.getClassBuilderMode() != ClassBuilderMode.SIGNATURES) {
|
if (state.getClassBuilderMode() != ClassBuilderMode.LIGHT_CLASSES) {
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Generating bad descriptor in ClassBuilderMode = " + state.getClassBuilderMode() + ": " + descriptor);
|
"Generating bad descriptor in ClassBuilderMode = " + state.getClassBuilderMode() + ": " + descriptor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ public class JetTypeMapper extends BindingTraceAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ErrorUtils.isError(descriptor)) {
|
if (ErrorUtils.isError(descriptor)) {
|
||||||
if (classBuilderMode != ClassBuilderMode.SIGNATURES) {
|
if (classBuilderMode != ClassBuilderMode.LIGHT_CLASSES) {
|
||||||
throw new IllegalStateException(generateErrorMessageForErrorType(descriptor));
|
throw new IllegalStateException(generateErrorMessageForErrorType(descriptor));
|
||||||
}
|
}
|
||||||
Type asmType = Type.getObjectType("error/NonExistentClass");
|
Type asmType = Type.getObjectType("error/NonExistentClass");
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ import org.jetbrains.jet.codegen.ClassBuilderMode;
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public ClassBuilderMode getClassBuilderMode() {
|
public ClassBuilderMode getClassBuilderMode() {
|
||||||
return ClassBuilderMode.SIGNATURES;
|
return ClassBuilderMode.LIGHT_CLASSES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class LightClassUtil {
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
if (PsiTreeUtil.getParentOfType(declaration, JetFunction.class, JetProperty.class) != null) {
|
if (PsiTreeUtil.getParentOfType(declaration, JetFunction.class, JetProperty.class) != null) {
|
||||||
// Can't get wrappers for internal declarations. Their classes are not generated during calcStub
|
// Can't get wrappers for internal declarations. Their classes are not generated during calcStub
|
||||||
// with ClassBuilderMode.SIGNATURES mode, and this produces "Class not found exception" in getDelegate()
|
// with ClassBuilderMode.LIGHT_CLASSES mode, and this produces "Class not found exception" in getDelegate()
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ public class JetJavaFacadeTest extends JetLightCodeInsightFixtureTestCase {
|
|||||||
|
|
||||||
assertNotNull(String.format("Failed to wrap jetClass '%s' to class", jetClass.getText()), lightClass);
|
assertNotNull(String.format("Failed to wrap jetClass '%s' to class", jetClass.getText()), lightClass);
|
||||||
|
|
||||||
// This invokes codegen with ClassBuilderMode = SIGNATURES
|
// This invokes codegen with ClassBuilderMode = LIGHT_CLASSES
|
||||||
// No exception/error should happen here
|
// No exception/error should happen here
|
||||||
lightClass.getDelegate();
|
lightClass.getDelegate();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user