honor abstract modifier for classes
This commit is contained in:
@@ -5,6 +5,7 @@ import com.intellij.psi.PsiElement;
|
|||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
|
import org.jetbrains.jet.lexer.JetTokens;
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
import org.objectweb.asm.MethodVisitor;
|
import org.objectweb.asm.MethodVisitor;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
@@ -32,8 +33,11 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
|||||||
if (!(myClass instanceof JetObjectDeclaration)) {
|
if (!(myClass instanceof JetObjectDeclaration)) {
|
||||||
interfaces.add(JetTypeMapper.jvmNameForInterface(descriptor));
|
interfaces.add(JetTypeMapper.jvmNameForInterface(descriptor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isAbstract = myClass instanceof JetClass && ((JetClass) myClass).hasModifier(JetTokens.ABSTRACT_KEYWORD);
|
||||||
|
|
||||||
v.visit(Opcodes.V1_6,
|
v.visit(Opcodes.V1_6,
|
||||||
Opcodes.ACC_PUBLIC,
|
Opcodes.ACC_PUBLIC | (isAbstract ? Opcodes.ACC_ABSTRACT : 0),
|
||||||
jvmName(),
|
jvmName(),
|
||||||
null,
|
null,
|
||||||
superClass,
|
superClass,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.jetbrains.jet.codegen;
|
package org.jetbrains.jet.codegen;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,4 +108,11 @@ public class ClassGenTest extends CodegenTestCase {
|
|||||||
public void testSimpleBox() throws Exception {
|
public void testSimpleBox() throws Exception {
|
||||||
blackBoxFile("classes/simpleBox.jet");
|
blackBoxFile("classes/simpleBox.jet");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAbstractClass() throws Exception {
|
||||||
|
loadText("abstract class SimpleClass() { }");
|
||||||
|
|
||||||
|
final Class aClass = loadAllClasses(generateClassesInFile()).get("SimpleClass$$Impl");
|
||||||
|
assertTrue((aClass.getModifiers() & Modifier.ABSTRACT) != 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user