Reputation: 10093
So here's my situation: I have a .jar file with 2 .class files in it, both import from a library I do not have access to (the library is proprietary and somehow hidden, so no way of getting it).
Now I'd like to change the implementation of these .class files. Decompiling is no problem, however since I don't have the libraries the code depends on I cannot compile. I have heard of creating "stubs" for the missing methods, but I don't know enough about java to figure out how to create such stubs in this case (if that is even possible some pointers in the right direction would be appreciated).
Is there some way I can make my modified files compile? Like forcing the compiler to ignore the missing methods? Or is my only option something like a Java Bytecode Editor?
Upvotes: 1
Views: 763
Reputation: 136012
If a decompile class uses some missing dependency eg
class X {
void x() {
y.Y y = new y.Y();
y.y();
}
}
you should create a stub for it
package y;
public class Y {
public void y() {
}
}
Upvotes: 1