mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-28 18:25:30 +00:00
Fixed: #2498 Public traits with same name were not distinguishable
This commit is contained in:
@@ -212,7 +212,7 @@ public class FullMultinameAVM2Item extends AVM2Item {
|
||||
writer.append("*");
|
||||
} else {
|
||||
Reference<DottedChain> customNsRef = new Reference<>(null);
|
||||
String localName = constants.getMultiname(multinameIndex).getNameAndCustomNamespace(localData.usedDeobfuscations, localData.abc, localData.fullyQualifiedNames, false, true, customNsRef);
|
||||
String localName = constants.getMultiname(multinameIndex).getNameAndCustomNamespace(localData.usedDeobfuscations, localData.abc, fullyQualifiedNames, false, true, customNsRef);
|
||||
DottedChain customNs = customNsRef.getVal();
|
||||
if (customNs != null) {
|
||||
String nsname = customNs.getLast();
|
||||
|
||||
@@ -89,7 +89,7 @@ public class ClassNameMultinameUsage extends MultinameUsage implements Definitio
|
||||
}
|
||||
}
|
||||
if (other instanceof ClassNameMultinameUsage) {
|
||||
return sameMultinameName(other);
|
||||
return sameMultinameName(other, true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ConstVarNameMultinameUsage extends ConstVarMultinameUsage implement
|
||||
if ((other instanceof ConstVarNameMultinameUsage) || (other instanceof MethodNameMultinameUsage)) {
|
||||
TraitMultinameUsage otherTrait = (TraitMultinameUsage) other;
|
||||
if (otherTrait.classIndex == classIndex && otherTrait.traitsType == traitsType && otherTrait.parentTraitIndex == parentTraitIndex) {
|
||||
if (other.sameMultinameName(this)) {
|
||||
if (other.sameMultinameName(this, false)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MethodNameMultinameUsage extends MethodMultinameUsage implements De
|
||||
if ((other instanceof MethodNameMultinameUsage) || (other instanceof ConstVarNameMultinameUsage)) {
|
||||
TraitMultinameUsage otherTrait = (TraitMultinameUsage) other;
|
||||
if (otherTrait.classIndex == classIndex && otherTrait.traitsType == traitsType && otherTrait.parentTraitIndex == parentTraitIndex) {
|
||||
if (other.sameMultinameName(this)) {
|
||||
if (other.sameMultinameName(this, false)) {
|
||||
|
||||
if (other instanceof MethodNameMultinameUsage) {
|
||||
MethodNameMultinameUsage otherM = (MethodNameMultinameUsage) other;
|
||||
|
||||
@@ -75,9 +75,10 @@ public abstract class MultinameUsage implements Usage {
|
||||
/**
|
||||
* Checks if this multiname name is the same as other multiname name.
|
||||
* @param other Other multiname usage
|
||||
* @param includePublic Include public namespaces?
|
||||
* @return True if names are the same
|
||||
*/
|
||||
protected boolean sameMultinameName(MultinameUsage other) {
|
||||
protected boolean sameMultinameName(MultinameUsage other, boolean includePublic) {
|
||||
Multiname thisM = abc.constants.getMultiname(multinameIndex);
|
||||
Multiname otherM = other.abc.constants.getMultiname(other.multinameIndex);
|
||||
if (thisM == null && otherM == null) {
|
||||
@@ -106,8 +107,8 @@ public abstract class MultinameUsage implements Usage {
|
||||
}
|
||||
|
||||
//public or package internal are colliding when have same package ns
|
||||
if ((thisNs.kind == Namespace.KIND_PACKAGE || thisNs.kind == Namespace.KIND_PACKAGE_INTERNAL)
|
||||
&& (otherNs.kind == Namespace.KIND_PACKAGE || otherNs.kind == Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
if (includePublic && ((thisNs.kind == Namespace.KIND_PACKAGE || thisNs.kind == Namespace.KIND_PACKAGE_INTERNAL)
|
||||
&& (otherNs.kind == Namespace.KIND_PACKAGE || otherNs.kind == Namespace.KIND_PACKAGE_INTERNAL))) {
|
||||
return Objects.equals(thisNs.getName(abc.constants), otherNs.getName(other.abc.constants));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user