1

I have two versions of a java library, without sources. The api changes significantly between these two versions. The changed methods have no @Deprecated annotations.

Can I add these annotations to the relevant methods and classes in the compiled jar file, to help me see what I need to change in my code, without breaking the build?

I am looking for something easier than decompiling and trying to recompile the whole library. Ideally some way to supply these annotations to intellij or the java compiler without modifying the jar file at all.

HugoRune
  • 13,157
  • 7
  • 69
  • 144
  • I don't know any way to do that, but wouldn't a "find usages" of the method help you get what you want? – João Costa Apr 28 '20 at 11:06
  • 1
    That would also work. But there are so many changed methods and classes, and they are used in so many different places, that I really would prefer some way to persistently mark all of them. – HugoRune Apr 28 '20 at 11:12
  • 1
    In principle, a tool reading, patching, and writing the class files wouldn’t be hard to implement. Not that for historical reasons, deprecation is flagged via [an attribute](https://docs.oracle.com/javase/specs/jvms/se12/html/jvms-4.html#jvms-4.7.15) in the class file. When injecting the attribute, it’s not necessary to also inject the annotation. – Holger Apr 29 '20 at 09:19

0 Answers0