Skip to content

Commit

Permalink
Use internalShortClassName in KotlinMultiFileFacadeFixer
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjameshamilton authored and maqsoodahmadjan committed Jul 7, 2023
1 parent 943e349 commit 57d4250
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
* Copyright (c) 2002-2020 Guardsquare NV
* Copyright (c) 2002-2023 Guardsquare NV
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
Expand All @@ -22,13 +22,17 @@
package proguard.obfuscate.kotlin;

import proguard.classfile.Clazz;
import proguard.classfile.kotlin.*;
import proguard.classfile.kotlin.KotlinMetadata;
import proguard.classfile.kotlin.KotlinMultiFileFacadeKindMetadata;
import proguard.classfile.kotlin.visitor.KotlinMetadataVisitor;
import proguard.util.*;
import proguard.util.Processable;
import proguard.util.ProcessingFlags;

import static proguard.classfile.util.ClassUtil.internalPackagePrefix;
import static proguard.classfile.util.ClassUtil.internalSimpleClassName;
import static proguard.obfuscate.ClassObfuscator.*;
import static proguard.classfile.util.ClassUtil.internalShortClassName;
import static proguard.obfuscate.ClassObfuscator.hasOriginalClassName;
import static proguard.obfuscate.ClassObfuscator.newClassName;
import static proguard.obfuscate.ClassObfuscator.setNewClassName;

/**
* Ensure that multi-file class parts and multi-file facades are kept in the same package.
Expand Down Expand Up @@ -61,7 +65,7 @@ public void visitKotlinMultiFileFacadeMetadata(Clazz
for (Clazz ref : kotlinMultiFileFacadeKindMetadata.referencedPartClasses)
{
setNewClassName(ref, packagePrefix +
(internalSimpleClassName(hasOriginalClassName(ref) ? ref.getName() : newClassName(ref))));
(internalShortClassName(hasOriginalClassName(ref) ? ref.getName() : newClassName(ref))));
}

String className = newClassName(clazz);
Expand All @@ -70,7 +74,7 @@ public void visitKotlinMultiFileFacadeMetadata(Clazz
className = clazz.getName();
}

setNewClassName(clazz, packagePrefix + internalSimpleClassName(className));
setNewClassName(clazz, packagePrefix + internalShortClassName(className));
}

// Small helper methods.
Expand Down

0 comments on commit 57d4250

Please sign in to comment.