java - Does removing the "final" keyword affect binary compatibility? -
if remove final
keyword method or other "thing", users of class have recompile?
technically, won't have recompile.
i cannot think of repercussions can result removing final keyword method / attribute may lead loss in compatibility should not give problems.
tested sample code , there no runtime errors:
public class test2{ public static final string test = "hello!"; } public class test { public static void main (string [] args) { system.out.println(test2.test); } }
- compiled test.java
- ran test.java -> output = "hello!"
modified test2.java:
public class test2{ public static string test = "hello!"; }
compiled test2.java
- ran test.java -> output = "hello!"
Comments
Post a Comment