Skip to content

Commit 0bfc417

Browse files
committedAug 12, 2019
Use “$init” for constructors in Java.registerClass()
For consistency with the class wrappers.
1 parent b4fc55f commit 0bfc417

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎lib/class-factory.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1841,10 +1841,11 @@ function ClassFactory (vm) {
18411841
const methodNames = Object.keys(methods);
18421842
const methodEntries = methodNames.reduce((result, name) => {
18431843
const entry = methods[name];
1844+
const rawName = (name === '$init') ? '<init>' : name;
18441845
if (entry instanceof Array) {
1845-
result.push(...entry.map(e => [name, e]));
1846+
result.push(...entry.map(e => [rawName, e]));
18461847
} else {
1847-
result.push([name, entry]);
1848+
result.push([rawName, entry]);
18481849
}
18491850
return result;
18501851
}, []);

‎test/re/frida/ClassCreationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public void classWithUserConstructorsCanBeImplemented() throws ClassNotFoundExce
362362
" buf: 'java.lang.StringBuilder'," +
363363
" }," +
364364
" methods: {" +
365-
" '<init>': [{" +
365+
" $init: [{" +
366366
" returnType: 'void'," +
367367
" argumentTypes: []," +
368368
" implementation: function () {" +

0 commit comments

Comments
 (0)
Please sign in to comment.