Simulating Multiple Inheritance in Java
Problem:
I am trying to obfuscate code and create wrapper classes to access code implementation. Problem is that some parameters in methods have different types. (i.e.
public class Example{
ExampleImpl exampleImpl;
public void setExample(Problem exam) {
exampleImpl.setExample(exam);//complile error
//error message: problemImpl is not of type problem
}
}
public class ExampleImpl {
public void setExample(ProblemImpl exam) {
//do something
}
The objects Problem and ProblemImpl are abstract class that provode some implementation.
I know I have to sumulate multipule inheritance but its really have to changed the abstract classes to inherate each other. Problem with that is the ProblemImpl abstract class will be obfuscated.
Any suggestions.
[843 byte] By [
sean1414a] at [2007-10-2 7:03:10]

I understand I need an obfucator to mangle my code, but I only want the implimentation to get obfucated. I will then create an api class that is a skelton of my implementation class.
e.i
//My API - Skelton of Impl class
class example{
ExampleImpl impl;
public setExample(Problem api) {
impl.setExample(api) //Compile error since Problem is of another type
}
//My implementation
class exampleImpl {
public void setExample(ProblemImpl impl) {
//My implmemetation code
}
Rule: Implementations can only talk to other Implementations.
> Right, the implementation is the only code that will
> be obfucated but I still need to created a wrapper
> for the obfucstacted objects so our clients can
> implement there own code.
The obfuscator should have options that allow you to tune it. Some but not all of the API should be public. You should set it so it doesn't mess with those.
> Right, the implementation is the only code that will
> be obfucated but I still need to created a wrapper
> for the obfucstacted objects so our clients can
> implement there own code.
I don't see exactly what the problem is. You create your API, you implement it and you obfuscate only the implementation (the obfuscator should give you a way to do so). In this way your clients can implement the API and you have your implementation obfuscated.