[S90-JAVA] Avoid use of static in interface
Bad usage:
public interface Color {
public static final int RED = 0xff0000;// Noncompliant
public static final int BLACK = 0x000000;// Noncompliant
public static final int WHITE = 0xffffff;// Noncompliant
}
Good usage:
public enum Color {
RED,// Compliant
BLACK,// Compliant
WHITE;// Compliant
}
Hello @ggeoffroy68,
I have questions about this new rule.
I agree with you public static final keywords are useless. For example, we can have an interface with variables like int RED = 0xff0000;.
But why is it a "green" rule ?
And why enum usage is better that an interface with variables ? maybe one enum is better of one interface + 3 variables ?
Do you have a scientific paper about this subject ?
thank you.
Hi @ggeoffroy68 , we are migrating this repo to a new one : please see https://github.com/green-code-initiative/ecocode/pull/7







