Constants Not Configurable

I’ve tried to implement what I described below: I had an interface with a bunch of public static final fields with the constants. Then I referenced these fields from elsewhere in the code and planned to just append a different version of the same interface to the beginning of the classpath.

The problem is that javac performs constant propagation. It recognizes that these constants are final and therefore inserts the literal value instead of using a reference to the constant field. When I remove the final modifier and turn the interface into a class, then the VM initialization craps out.

Looks like I have to come up with a different idea. Unfortunately these constants are used in many places, so patching them directly isn’t really an option.


About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in Concurrent Unit Testing. Bookmark the permalink.

Leave a Reply