Skip to content

Commit 8822658

Browse files
author
Mihail Slavchev
committed
create dex with correct name when Java class name is explicitly specified
1 parent ed7e696 commit 8822658

2 files changed

Lines changed: 22 additions & 27 deletions

File tree

binding-generator/src/main/java/com/tns/bindings/Dump.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -189,30 +189,23 @@ else if (c.isArray())
189189
return buf.toString();
190190
}
191191

192-
public void generateProxy(ApplicationWriter aw, String proxyName, ClassDescriptor classTo, String[] methodOverrides, int ignored)
193-
{
194-
HashSet<String> methodOverridesSet = new HashSet<String>();
195-
for (int i = 0; i < methodOverrides.length; i++)
196-
{
197-
String methodOverride = methodOverrides[i];
198-
methodOverridesSet.add(methodOverride);
199-
}
200-
201-
generateProxy(aw, proxyName, classTo, methodOverridesSet, null, null);
202-
}
203-
204192
public void generateProxy(ApplicationWriter aw, String proxyName, ClassDescriptor classTo, HashSet<String> methodOverrides, HashSet<ClassDescriptor> implementedInterfaces, AnnotationDescriptor[] annotations)
205193
{
206194
String classSignature = getAsmDescriptor(classTo);
207195

208-
String tnsClassSignature = LCOM_TNS +
209-
classSignature.substring(1, classSignature.length() - 1).replace("$", "_");
196+
String tnsClassSignature;
197+
if (proxyName.contains(".")) {
198+
tnsClassSignature = "L" + proxyName.replace('.', '/') + ";";
199+
} else {
200+
tnsClassSignature = LCOM_TNS +
201+
classSignature.substring(1, classSignature.length() - 1).replace("$", "_");
210202

211-
if(!classTo.isInterface()) {
212-
tnsClassSignature += CLASS_NAME_LOCATION_SEPARATOR + proxyName;
213-
}
203+
if (!classTo.isInterface()) {
204+
tnsClassSignature += CLASS_NAME_LOCATION_SEPARATOR + proxyName;
205+
}
214206

215-
tnsClassSignature += ";";
207+
tnsClassSignature += ";";
208+
}
216209

217210
ClassVisitor cv = generateClass(aw, classTo, classSignature, tnsClassSignature, implementedInterfaces, annotations);
218211
MethodDescriptor[] methods = getSupportedMethods(classTo, methodOverrides, implementedInterfaces);

binding-generator/src/main/java/com/tns/bindings/ProxyGenerator.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ public String generateProxy(String proxyName, ClassDescriptor classToProxy, Hash
5656
aw.visitEnd();
5757
byte[] generatedBytes = aw.toByteArray();
5858

59-
String proxyFileName = classToProxy.getName().replace('$', '_');
59+
String proxyFileName;
6060

61-
if(!isInterface)
62-
{
63-
proxyFileName += Dump.CLASS_NAME_LOCATION_SEPARATOR + proxyName;
64-
}
65-
66-
if (proxyThumb != null)
67-
{
68-
proxyFileName += "-" + proxyThumb;
61+
if (proxyName.contains(".")) {
62+
proxyFileName = proxyName;
63+
} else {
64+
proxyFileName = classToProxy.getName().replace('$', '_');
65+
if (!isInterface) {
66+
proxyFileName += Dump.CLASS_NAME_LOCATION_SEPARATOR + proxyName;
67+
}
68+
if (proxyThumb != null) {
69+
proxyFileName += "-" + proxyThumb;
70+
}
6971
}
7072

7173
if (IsLogEnabled) System.out.println("Generator: Saving proxy with file name: " + proxyFileName);

0 commit comments

Comments
 (0)