Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enum_NoOrdinal and Enum_UserFriendlyName get violated upon every Enum #235

Open
emopers opened this issue Apr 21, 2016 · 1 comment
Open

Comments

@emopers
Copy link

emopers commented Apr 21, 2016

During our running of JavaMOP we found that Enum_NoOrdinal and Enum_UserFriendlyName seem to be violated upon every method invocation on an Enum object and lead to large amount of violations. We're not sure what's the problem behind that, but it seems like a bug. Furthermore, violating these two properties won't lead to any substantial functional bugs or performance degradation in programs.

@xiaohe27
Copy link
Contributor

@emopers I am not able to reproduce this problem when monitoring the code below via the jar created from those two properties, only the true violation is reported, nothing more:

public class Main {
    public enum Day {
        SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
        THURSDAY, FRIDAY, SATURDAY
    }

    public static void main(String[] args) {
    // write your code here
        System.out.println(Day.SATURDAY.name()); //only report violation if the second property is used.
        System.out.println(Day.FRIDAY.ordinal());  //only report violation if the first property is used.
        System.out.println(Day.THURSDAY.toString()); //no violation is reported
        System.out.println(Day.TUESDAY.hashCode()); //no violation is reported
    }

Can you provide a more concrete example that is reproducible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants