fix: broken composition of fully qualified name in TypeProxy

This commit is contained in:
zaaarf 2023-03-27 20:12:36 +02:00
parent ac4ce489b7
commit ab7fbd3f6e
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C
2 changed files with 5 additions and 5 deletions

View file

@ -37,10 +37,10 @@ public abstract class QualifiableProxy extends AbstractProxy {
* @return the parent, or null if the parent was the root element * @return the parent, or null if the parent was the root element
*/ */
protected static String extractParentFromFQN(String fqn) { protected static String extractParentFromFQN(String fqn) {
String lastSeparator = fqn.contains("$") ? "\\$" : "\\."; String lastSeparator = fqn.contains("$") ? "$" : ".";
String[] split = fqn.split(lastSeparator); int pos = fqn.lastIndexOf(lastSeparator);
if(split.length == 1) return null; if(pos == -1) return null;
return fqn.substring(0, split[split.length - 1].length() - 1); return fqn.substring(0, pos);
} }
/** /**

View file

@ -29,7 +29,7 @@ public class TypeProxy extends QualifiableProxy {
* @param primitive whether the proxy is a primitive * @param primitive whether the proxy is a primitive
*/ */
protected TypeProxy(String name, String descriptor, int modifiers, String parent, boolean primitive) { protected TypeProxy(String name, String descriptor, int modifiers, String parent, boolean primitive) {
super(descriptor, modifiers, PackageProxy.from(parent), String.format("%s.%s", name, parent), ProxyType.TYPE); super(descriptor, modifiers, PackageProxy.from(parent), String.format("%s.%s", parent, name), ProxyType.TYPE);
this.primitive = primitive; this.primitive = primitive;
} }