"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/FileBasedKotlinClass.java" between
kotlin-1.3.20.tar.gz and kotlin-1.3.21.tar.gz

About: Kotlin is a Java like statically typed programming language for the JVM, Android and the browser. Source code.

FileBasedKotlinClass.java  (kotlin-1.3.20):FileBasedKotlinClass.java  (kotlin-1.3.21)
skipping to change at line 37 skipping to change at line 37
import org.jetbrains.kotlin.name.ClassId; import org.jetbrains.kotlin.name.ClassId;
import org.jetbrains.kotlin.name.FqName; import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.name.Name; import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.constants.ClassLiteralValue; import org.jetbrains.kotlin.resolve.constants.ClassLiteralValue;
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType; import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.org.objectweb.asm.*; import org.jetbrains.org.objectweb.asm.*;
import java.util.*; import java.util.*;
import static org.jetbrains.org.objectweb.asm.ClassReader.*; import static org.jetbrains.org.objectweb.asm.ClassReader.*;
import static org.jetbrains.org.objectweb.asm.Opcodes.ASM5; import static org.jetbrains.org.objectweb.asm.Opcodes.API_VERSION;
public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass { public abstract class FileBasedKotlinClass implements KotlinJvmBinaryClass {
private final ClassId classId; private final ClassId classId;
private final int classVersion; private final int classVersion;
private final KotlinClassHeader classHeader; private final KotlinClassHeader classHeader;
private final InnerClassesInfo innerClasses; private final InnerClassesInfo innerClasses;
protected FileBasedKotlinClass( protected FileBasedKotlinClass(
@NotNull ClassId classId, @NotNull ClassId classId,
int classVersion, int classVersion,
skipping to change at line 96 skipping to change at line 96
// TODO public to be accessible in companion object of subclass, workaround for KT-3974 // TODO public to be accessible in companion object of subclass, workaround for KT-3974
@Nullable @Nullable
public static <T> T create( public static <T> T create(
@NotNull byte[] fileContents, @NotNull byte[] fileContents,
@NotNull Function4<ClassId, Integer, KotlinClassHeader, InnerClasses Info, T> factory @NotNull Function4<ClassId, Integer, KotlinClassHeader, InnerClasses Info, T> factory
) { ) {
ReadKotlinClassHeaderAnnotationVisitor readHeaderVisitor = new ReadKotli nClassHeaderAnnotationVisitor(); ReadKotlinClassHeaderAnnotationVisitor readHeaderVisitor = new ReadKotli nClassHeaderAnnotationVisitor();
Ref<String> classNameRef = Ref.create(); Ref<String> classNameRef = Ref.create();
Ref<Integer> classVersion = Ref.create(); Ref<Integer> classVersion = Ref.create();
InnerClassesInfo innerClasses = new InnerClassesInfo(); InnerClassesInfo innerClasses = new InnerClassesInfo();
new ClassReader(fileContents).accept(new ClassVisitor(ASM5) { new ClassReader(fileContents).accept(new ClassVisitor(API_VERSION) {
@Override @Override
public void visit(int version, int access, @NotNull String name, Str ing signature, String superName, String[] interfaces) { public void visit(int version, int access, @NotNull String name, Str ing signature, String superName, String[] interfaces) {
classNameRef.set(name); classNameRef.set(name);
classVersion.set(version); classVersion.set(version);
} }
@Override @Override
public void visitInnerClass(@NotNull String name, String outerName, String innerName, int access) { public void visitInnerClass(@NotNull String name, String outerName, String innerName, int access) {
innerClasses.add(name, outerName, innerName); innerClasses.add(name, outerName, innerName);
} }
skipping to change at line 148 skipping to change at line 148
@NotNull @NotNull
@Override @Override
public KotlinClassHeader getClassHeader() { public KotlinClassHeader getClassHeader() {
return classHeader; return classHeader;
} }
@Override @Override
public void loadClassAnnotations(@NotNull AnnotationVisitor annotationVisito r, @Nullable byte[] cachedContents) { public void loadClassAnnotations(@NotNull AnnotationVisitor annotationVisito r, @Nullable byte[] cachedContents) {
byte[] fileContents = cachedContents != null ? cachedContents : getFileC ontents(); byte[] fileContents = cachedContents != null ? cachedContents : getFileC ontents();
new ClassReader(fileContents).accept(new ClassVisitor(ASM5) { new ClassReader(fileContents).accept(new ClassVisitor(API_VERSION) {
@Override @Override
public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitAnnota tion(@NotNull String desc, boolean visible) { public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitAnnota tion(@NotNull String desc, boolean visible) {
return convertAnnotationVisitor(annotationVisitor, desc, innerCl asses); return convertAnnotationVisitor(annotationVisitor, desc, innerCl asses);
} }
@Override @Override
public void visitEnd() { public void visitEnd() {
annotationVisitor.visitEnd(); annotationVisitor.visitEnd();
} }
}, SKIP_CODE | SKIP_DEBUG | SKIP_FRAMES); }, SKIP_CODE | SKIP_DEBUG | SKIP_FRAMES);
skipping to change at line 173 skipping to change at line 173
@NotNull AnnotationVisitor visitor, @NotNull String desc, @NotNull I nnerClassesInfo innerClasses @NotNull AnnotationVisitor visitor, @NotNull String desc, @NotNull I nnerClassesInfo innerClasses
) { ) {
AnnotationArgumentVisitor v = visitor.visitAnnotation(resolveNameByDesc( desc, innerClasses), SourceElement.NO_SOURCE); AnnotationArgumentVisitor v = visitor.visitAnnotation(resolveNameByDesc( desc, innerClasses), SourceElement.NO_SOURCE);
return v == null ? null : convertAnnotationVisitor(v, innerClasses); return v == null ? null : convertAnnotationVisitor(v, innerClasses);
} }
@NotNull @NotNull
private static org.jetbrains.org.objectweb.asm.AnnotationVisitor convertAnno tationVisitor( private static org.jetbrains.org.objectweb.asm.AnnotationVisitor convertAnno tationVisitor(
@NotNull AnnotationArgumentVisitor v, @NotNull InnerClassesInfo inne rClasses @NotNull AnnotationArgumentVisitor v, @NotNull InnerClassesInfo inne rClasses
) { ) {
return new org.jetbrains.org.objectweb.asm.AnnotationVisitor(ASM5) { return new org.jetbrains.org.objectweb.asm.AnnotationVisitor(API_VERSION ) {
@Override @Override
public void visit(String name, @NotNull Object value) { public void visit(String name, @NotNull Object value) {
if (value instanceof Type) { if (value instanceof Type) {
v.visitClassLiteral(Name.identifier(name), resolveKotlinName ByType((Type) value, innerClasses)); v.visitClassLiteral(Name.identifier(name), resolveKotlinName ByType((Type) value, innerClasses));
} }
else { else {
v.visit(name == null ? null : Name.identifier(name), value); v.visit(name == null ? null : Name.identifier(name), value);
} }
} }
@Override @Override
public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitArray( String name) { public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitArray( String name) {
AnnotationArrayArgumentVisitor arv = v.visitArray(Name.identifie r(name)); AnnotationArrayArgumentVisitor arv = v.visitArray(Name.identifie r(name));
return arv == null ? null : new org.jetbrains.org.objectweb.asm. AnnotationVisitor(ASM5) { return arv == null ? null : new org.jetbrains.org.objectweb.asm. AnnotationVisitor(API_VERSION) {
@Override @Override
public void visit(String name, @NotNull Object value) { public void visit(String name, @NotNull Object value) {
if (value instanceof Type) { if (value instanceof Type) {
arv.visitClassLiteral(resolveKotlinNameByType((Type) value, innerClasses)); arv.visitClassLiteral(resolveKotlinNameByType((Type) value, innerClasses));
} }
else { else {
arv.visit(value); arv.visit(value);
} }
} }
skipping to change at line 231 skipping to change at line 231
@Override @Override
public void visitEnd() { public void visitEnd() {
v.visitEnd(); v.visitEnd();
} }
}; };
} }
@Override @Override
public void visitMembers(@NotNull MemberVisitor memberVisitor, @Nullable byt e[] cachedContents) { public void visitMembers(@NotNull MemberVisitor memberVisitor, @Nullable byt e[] cachedContents) {
byte[] fileContents = cachedContents != null ? cachedContents : getFileC ontents(); byte[] fileContents = cachedContents != null ? cachedContents : getFileC ontents();
new ClassReader(fileContents).accept(new ClassVisitor(ASM5) { new ClassReader(fileContents).accept(new ClassVisitor(API_VERSION) {
@Override @Override
public FieldVisitor visitField(int access, @NotNull String name, @No tNull String desc, String signature, Object value) { public FieldVisitor visitField(int access, @NotNull String name, @No tNull String desc, String signature, Object value) {
AnnotationVisitor v = memberVisitor.visitField(Name.identifier(n ame), desc, value); AnnotationVisitor v = memberVisitor.visitField(Name.identifier(n ame), desc, value);
if (v == null) return null; if (v == null) return null;
return new FieldVisitor(ASM5) { return new FieldVisitor(API_VERSION) {
@Override @Override
public org.jetbrains.org.objectweb.asm.AnnotationVisitor vis itAnnotation(@NotNull String desc, boolean visible) { public org.jetbrains.org.objectweb.asm.AnnotationVisitor vis itAnnotation(@NotNull String desc, boolean visible) {
return convertAnnotationVisitor(v, desc, innerClasses); return convertAnnotationVisitor(v, desc, innerClasses);
} }
@Override @Override
public void visitEnd() { public void visitEnd() {
v.visitEnd(); v.visitEnd();
} }
}; };
} }
@Override @Override
public MethodVisitor visitMethod(int access, @NotNull String name, @ NotNull String desc, String signature, String[] exceptions) { public MethodVisitor visitMethod(int access, @NotNull String name, @ NotNull String desc, String signature, String[] exceptions) {
MethodAnnotationVisitor v = memberVisitor.visitMethod(Name.ident ifier(name), desc); MethodAnnotationVisitor v = memberVisitor.visitMethod(Name.ident ifier(name), desc);
if (v == null) return null; if (v == null) return null;
int methodParamCount = Type.getArgumentTypes(desc).length; int methodParamCount = Type.getArgumentTypes(desc).length;
return new MethodVisitor(ASM5) { return new MethodVisitor(API_VERSION) {
private int visibleAnnotableParameterCount = methodParamCoun t; private int visibleAnnotableParameterCount = methodParamCoun t;
private int invisibleAnnotableParameterCount = methodParamCo unt; private int invisibleAnnotableParameterCount = methodParamCo unt;
@Override @Override
public org.jetbrains.org.objectweb.asm.AnnotationVisitor vis itAnnotation(@NotNull String desc, boolean visible) { public org.jetbrains.org.objectweb.asm.AnnotationVisitor vis itAnnotation(@NotNull String desc, boolean visible) {
return convertAnnotationVisitor(v, desc, innerClasses); return convertAnnotationVisitor(v, desc, innerClasses);
} }
@Override @Override
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)