3939import org .jetbrains .java .decompiler .util .TextUtil ;
4040import org .jetbrains .java .decompiler .util .collections .VBStyleCollection ;
4141import org .vineflower .kotlin .expr .KAnnotationExprent ;
42- import org .vineflower .kotlin .metadata .StructKotlinMetadataAttribute ;
42+ import org .vineflower .kotlin .metadata .KotlinMetadata ;
4343import org .vineflower .kotlin .struct .*;
4444import org .vineflower .kotlin .util .KTypes ;
4545import org .vineflower .kotlin .util .KUtils ;
@@ -154,8 +154,8 @@ private boolean invokeProcessors(TextBuffer buffer, ClassNode node) {
154154 }
155155
156156 public void writeClassHeader (StructClass cl , TextBuffer buffer , ImportCollector importCollector ) {
157- StructKotlinMetadataAttribute ktData = cl .getAttribute (StructKotlinMetadataAttribute .KEY );
158- if (ktData != null && ktData .metadata instanceof StructKotlinMetadataAttribute .File ) {
157+ KotlinMetadata ktData = cl .getAttribute (KotlinMetadata .KEY );
158+ if (ktData != null && ktData .metadata instanceof KotlinMetadata .File ) {
159159 for (Key <?> key : ANNOTATION_ATTRIBUTES ) {
160160 StructAnnotationAttribute attr = cl .getAttribute ((Key <StructAnnotationAttribute >) key );
161161 if (attr != null ) {
@@ -187,7 +187,7 @@ public void writeClassHeader(StructClass cl, TextBuffer buffer, ImportCollector
187187 KotlinImportCollector kotlinImportCollector = new KotlinImportCollector (importCollector );
188188 kotlinImportCollector .writeImports (buffer , true );
189189
190- if (ktData != null && ktData .metadata instanceof StructKotlinMetadataAttribute .Class cls ) {
190+ if (ktData != null && ktData .metadata instanceof KotlinMetadata .Class cls ) {
191191 if (cls .proto ().getTypeAliasCount () > 0 ) {
192192 List <ProtoBuf .TypeAlias > typeAliases = cls .proto ().getTypeAliasList ();
193193 for (ProtoBuf .TypeAlias typeAlias : typeAliases ) {
@@ -221,15 +221,15 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) {
221221 ConstantPool pool = cl .getPool ();
222222
223223 KotlinChooser .parseMetadataFor (cl );
224- StructKotlinMetadataAttribute ktData = cl .getAttribute (StructKotlinMetadataAttribute .KEY );
224+ KotlinMetadata ktData = cl .getAttribute (KotlinMetadata .KEY );
225225
226226 DecompilerContext .getLogger ().startWriteClass (cl .qualifiedName );
227227
228228 int kotlinFlags ;
229229 if (ktData == null ) {
230230 appendComment (buffer , "Class flags could not be determined" , indent );
231231 kotlinFlags = 0 ;
232- } else if (ktData .metadata instanceof StructKotlinMetadataAttribute .Class cls ) {
232+ } else if (ktData .metadata instanceof KotlinMetadata .Class cls ) {
233233 kotlinFlags = cls .proto ().getFlags ();
234234 } else {
235235 kotlinFlags = 0 ;
@@ -255,13 +255,13 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) {
255255 return ;
256256 }
257257
258- if (ktData != null && ktData .metadata instanceof StructKotlinMetadataAttribute .File ) {
258+ if (ktData != null && ktData .metadata instanceof KotlinMetadata .File ) {
259259 writeKotlinFile (node , buffer , indent , ktData );
260260 return ;
261261 }
262262
263263 Optional <ClassNode > companion ;
264- if (ktData != null && ktData .metadata instanceof StructKotlinMetadataAttribute .Class cls && cls .proto ().hasCompanionObjectName ()) {
264+ if (ktData != null && ktData .metadata instanceof KotlinMetadata .Class cls && cls .proto ().hasCompanionObjectName ()) {
265265 String name = ktData .nameResolver .resolve (cls .proto ().getCompanionObjectName ());
266266 companion = node .nested .stream ()
267267 .filter (n -> n .simpleName .equals (name ))
@@ -309,7 +309,7 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) {
309309 ClassNode companionNode = companion .get ();
310310 KotlinChooser .parseMetadataFor (companionNode .classStruct );
311311
312- StructKotlinMetadataAttribute companionKtData = companionNode .classStruct .getAttribute (StructKotlinMetadataAttribute .KEY );
312+ KotlinMetadata companionKtData = companionNode .classStruct .getAttribute (KotlinMetadata .KEY );
313313 if (companionKtData != null ) {
314314 if (companionKtData .getProperties () != null ) {
315315 fieldsToIgnore .addAll (companionKtData .getProperties ().associatedFields ());
@@ -504,7 +504,7 @@ public void writeClass(ClassNode node, TextBuffer buffer, int indent) {
504504 }
505505 }
506506
507- private void writeKotlinFile (ClassNode node , TextBuffer buffer , int indent , StructKotlinMetadataAttribute ktData ) {
507+ private void writeKotlinFile (ClassNode node , TextBuffer buffer , int indent , KotlinMetadata ktData ) {
508508 ClassWrapper wrapper = node .getWrapper ();
509509 StructClass cl = wrapper .getClassStruct ();
510510
@@ -547,7 +547,7 @@ private void writeKotlinFile(ClassNode node, TextBuffer buffer, int indent, Stru
547547 }
548548
549549 Set <StructField > fieldsToSkip = Optional .ofNullable (ktData )
550- .map (StructKotlinMetadataAttribute ::getProperties )
550+ .map (KotlinMetadata ::getProperties )
551551 .map (KProperty .Data ::associatedFields )
552552 .orElse (Set .of ());
553553
@@ -600,7 +600,7 @@ private void writeKotlinFile(ClassNode node, TextBuffer buffer, int indent, Stru
600600 }
601601
602602 //TODO update this to use Kotlin's metadata
603- private void writeAnnotationDefinition (ClassNode node , TextBuffer buffer , int indent , StructKotlinMetadataAttribute ktData ) {
603+ private void writeAnnotationDefinition (ClassNode node , TextBuffer buffer , int indent , KotlinMetadata ktData ) {
604604 ClassWrapper wrapper = node .getWrapper ();
605605 StructClass cl = wrapper .getClassStruct ();
606606
@@ -724,7 +724,7 @@ private void writeAnnotationDefinition(ClassNode node, TextBuffer buffer, int in
724724 buffer .appendLineSeparator ();
725725 }
726726
727- private void writeClassDefinition (ClassNode node , TextBuffer buffer , int indent , StructKotlinMetadataAttribute ktData , int kotlinFlags ) {
727+ private void writeClassDefinition (ClassNode node , TextBuffer buffer , int indent , KotlinMetadata ktData , int kotlinFlags ) {
728728 if (node .type == ClassNode .Type .ANONYMOUS ) {
729729 buffer .append (" {" ).appendLineSeparator ();
730730 return ;
@@ -827,7 +827,7 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent,
827827
828828 boolean appendedColon = false ;
829829 boolean wroteSupertype = Optional .ofNullable (ktData )
830- .map (StructKotlinMetadataAttribute ::getConstructors )
830+ .map (KotlinMetadata ::getConstructors )
831831 .map (KConstructor .Data ::primary )
832832 .map (constructor -> constructor .writePrimaryConstructor (wrapper , buffer , indent ))
833833 .orElse (false );
@@ -902,8 +902,8 @@ public void writeField(ClassWrapper wrapper, StructClass cl, StructField fd, Tex
902902 }
903903 appendAnnotations (buffer , indent , fd , TypeAnnotation .FIELD );
904904
905- StructKotlinMetadataAttribute classData = cl .getAttribute (StructKotlinMetadataAttribute .KEY );
906- boolean isInFile = classData != null && classData .metadata instanceof StructKotlinMetadataAttribute .File ;
905+ KotlinMetadata classData = cl .getAttribute (KotlinMetadata .KEY );
906+ boolean isInFile = classData != null && classData .metadata instanceof KotlinMetadata .File ;
907907 appendJvmAnnotations (buffer , indent , fd , isInterface , isInFile , cl .getPool (), TypeAnnotation .FIELD );
908908
909909 buffer .appendIndent (indent );
@@ -1062,8 +1062,8 @@ public boolean writeMethod(ClassNode node, StructMethod mt, int methodIndex, Tex
10621062
10631063 appendAnnotations (buffer , indent , mt , TypeAnnotation .METHOD_RETURN_TYPE );
10641064
1065- StructKotlinMetadataAttribute classData = node .classStruct .getAttribute (StructKotlinMetadataAttribute .KEY );
1066- boolean isInFile = classData != null && classData .metadata instanceof StructKotlinMetadataAttribute .File ;
1065+ KotlinMetadata classData = node .classStruct .getAttribute (KotlinMetadata .KEY );
1066+ boolean isInFile = classData != null && classData .metadata instanceof KotlinMetadata .File ;
10671067 appendJvmAnnotations (buffer , indent , mt , isInterface , isInFile , cl .getPool (), TypeAnnotation .METHOD_RETURN_TYPE );
10681068
10691069 buffer .appendIndent (indent );
0 commit comments