Kraagenskul
Kraagenskul

Reputation: 464

Java Compiled Class with Uncalled Method That calls a Missing Method

I had to do a patch of a particular class, which we will call Foo. I fixed the issue, tested it, and posted the compiled Foo class a patch folder and that was posted to a QA server. The problem is, that I forgot that I had made a change to a method in Foo. That method calls a new method from another class (called Widget) that isn't in the current version on the server. The method in Foo is not currently called anywhere in the code on the server.

Summary:

Posted to a server a compiled version of Foo which has an uncalled public method that makes a call to a method in Widget that does not exist on that server.

Will this break anything? I tested the code on QA and everything seems to be fine.

Please note I am aware that patching this way is not recommended; we are actually in the process of upgrading the project's build and deploy mechanisms to avoid problems like this going forward.

Thanks

Upvotes: 0

Views: 130

Answers (2)

Denys Séguret
Denys Séguret

Reputation: 382122

If you don't call or try to load your method (using reflection), there is no reason for a break.

edit : I'm not sure at all that instantiating the Method using reflection would break something.

Upvotes: 3

Gilberto Torrezan
Gilberto Torrezan

Reputation: 5267

No, it will not break anything. Actually, there are several frameworks out there that you can use only a part of it, without including all the dependency jars, and it works just fine.

Upvotes: 2

Related Questions