Open priyanthabuddhika opened 7 months ago
I fear that final method parameters might just exist in the Java language, but and in the byte code/JVM. (I'm saying "might" because I don't know much about the JVM specification...)
I've just observed that for the simple example
class C {
void method(int p1, final int p2) {
}
}
javap
does not show any difference between the parameters p1
and p2
in the byte code:
void method(int, int);
descriptor: (II)V
flags: (0x0000)
Code:
stack=0, locals=3, args_size=3
0: return
So the descriptor: (II)V
might be everything that is available to ArchUnit. (I'm saying "might"...)
I am trying to create a custom arch unit rule to validate if method parameters have a final modifier. However, JavaParameter class does not seems to have a getModifiers method like JavaMethod class. Is this achievable with current ArchUnit API ?
I'm using ArchUnit 1.2.1 version.
This is a code sample of what I'm trying to achieve.