| 1 | //////////////////////////////////////////////////////////////////////////////// | |
| 2 | // checkstyle: Checks Java source code for adherence to a set of rules. | |
| 3 | // Copyright (C) 2001-2018 the original author or authors. | |
| 4 | // | |
| 5 | // This library is free software; you can redistribute it and/or | |
| 6 | // modify it under the terms of the GNU Lesser General Public | |
| 7 | // License as published by the Free Software Foundation; either | |
| 8 | // version 2.1 of the License, or (at your option) any later version. | |
| 9 | // | |
| 10 | // This library is distributed in the hope that it will be useful, | |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | // Lesser General Public License for more details. | |
| 14 | // | |
| 15 | // You should have received a copy of the GNU Lesser General Public | |
| 16 | // License along with this library; if not, write to the Free Software | |
| 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 18 | //////////////////////////////////////////////////////////////////////////////// | |
| 19 | ||
| 20 | package com.puppycrawl.tools.checkstyle.checks.naming; | |
| 21 | ||
| 22 | import java.util.Locale; | |
| 23 | ||
| 24 | /** | |
| 25 | * This enum represents access modifiers. | |
| 26 | * Access modifiers names are taken from JLS: | |
| 27 | * https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.6 | |
| 28 | * | |
| 29 | * @author Andrei Selkin | |
| 30 | */ | |
| 31 | public enum AccessModifier { | |
| 32 | ||
| 33 | /** Public access modifier. */ | |
| 34 | PUBLIC, | |
| 35 | /** Protected access modifier. */ | |
| 36 | PROTECTED, | |
| 37 | /** Package access modifier. */ | |
| 38 | PACKAGE, | |
| 39 | /** Private access modifier. */ | |
| 40 | PRIVATE; | |
| 41 | ||
| 42 | @Override | |
| 43 | public String toString() { | |
| 44 |
1
1. toString : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/naming/AccessModifier::toString to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return getName(); |
| 45 | } | |
| 46 | ||
| 47 | private String getName() { | |
| 48 |
1
1. getName : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/naming/AccessModifier::getName to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return name().toLowerCase(Locale.ENGLISH); |
| 49 | } | |
| 50 | ||
| 51 | /** | |
| 52 | * Factory method which returns an AccessModifier instance that corresponds to the | |
| 53 | * given access modifier name represented as a {@link String}. | |
| 54 | * The access modifier name can be formatted both as lower case or upper case string. | |
| 55 | * For example, passing PACKAGE or package as a modifier name | |
| 56 | * will return {@link AccessModifier#PACKAGE}. | |
| 57 | * | |
| 58 | * @param modifierName access modifier name represented as a {@link String}. | |
| 59 | * @return the AccessModifier associated with given access modifier name. | |
| 60 | */ | |
| 61 | public static AccessModifier getInstance(String modifierName) { | |
| 62 |
1
1. getInstance : mutated return of Object value for com/puppycrawl/tools/checkstyle/checks/naming/AccessModifier::getInstance to ( if (x != null) null else throw new RuntimeException ) → KILLED |
return valueOf(AccessModifier.class, modifierName.trim().toUpperCase(Locale.ENGLISH)); |
| 63 | } | |
| 64 | ||
| 65 | } | |
Mutations | ||
| 44 |
1.1 |
|
| 48 |
1.1 |
|
| 62 |
1.1 |