Say I have private final static int N = 1
in class A
Is there any chance to 'hack' so that N becomes 2(without touching the source file A.java)?
The set
pointcut seems not work on these final
fields.
The thing is, I have the source code of some project, and I'm making some modifications to it to deploy it in our region. I'm trying to make these changes without touching the source file unless I have to.
@VinceEmigh reflection wouldn't work in my case. The source code looks like:
class MyClass
private final static String[] NAMES = {"Name1", "Name2", "Name3"};
public void createIsland() {
//something
int i = getNumberOfIsland();
String name = NAMES[i];
createIslandWithName(name);
//something
}
end
The thing is I need to change those hard coded NAMES
to something else