All Classes and Interfaces
Class
Description
Most
AJavaparserMutator
will trigger over an Expression
Enables common behavior to JavaParser-based rules
Most
AJavaparserMutator
will trigger over an Statement
Deprecated.
Deprecated.
Turns 'Arrays.asList("1", 2).stream()' into 'Arrays.stream("1", 2)'
Helps preparing rules
Migrate from 'm.size() == 0’ to ’m.isEmpty()'.
Deprecated.
Turns 'boolean b = (x > 1 ) ? true : callback.doIt() || true' into 'if (x > 1) { ...
Turns '!!someBoolean()' into 'someBoolean()'
Turns `throws RuntimeException` into ``
This mutator will apply all
IMutator
fixing a CheckStyle rules.Turns 's.indexOf(subString) >= 0' into 'c.contains(subString)' in String
Turns `list.isEmpty() ? Optional.empty() : Optional.of(list.get(0))` into `list.stream().findFirst()`
Turns 'd == Double.NaN' into 'Double.isNaN(d)'
cases inspired from #description
Turns '{}' into ''
Turns `for (String string : stringList) {System.out.println(string);}`
into `stringList.forEach(s -> System.out.println(s));`
See EnhancedForLoopToStreamAnyMatchCases
See
EnhancedForLoopToStreamCollectCases
Prevent relying .equals on
Enum
typesThis mutator will apply all
IMutator
fixing ErrorProne rules.Turns 'ImmutableMap.of("k1", 0, "k2", 1)` into `ImmutableMap.builder().put("k1", 0).put("k2", 1).build()`
Turns 'Strings.repeat("abc", 3)` into `"abc".repeat(3)`
This mutator will apply all
IMutator
improving Guava usage.Turns 's == null || s.isEmpty()` into `Strings.isNullOrEmpty(s)`
An
IMutator
which can edit a JavaParser Node
Helpers knowing what could be the impact of given rule
Formatter for Java
This class is dedicated to refactoring.
This mutator will apply all
IMutator
fixing ErrorProne rules.Migrate from JUnit4 to JUnit5/Jupiter.
Turns `.stream(s -> s.size())` into `.stream(String::size)`
Turns '.stream(s -> {return s.subString(0, 2)})' into '.stream(s -> s.subString(0, 2))'
Switch o.equals("someString") to "someString".equals(o)
Turns 'int i = 10;' into 'var i = 10'
Turns `for (int i = 0 ; i < 10 ; i ++) {System.out.println(string);}`
into `IntStream.range(0, 10).forEach(j -> System.out.println(j));`
Order modifiers according the the Java specification.
Turns 'Object.equals(1, 5)` into `1 == 5`
Turns 'Object.hashCode(1)` into `Integer.hashCode(1)`
Make easier processing on code-tree
Turns '!o.isEmpty()' into 'o.isPresent()'
This mutator will apply all
IMutator
fixing a PMD rules.Turns `new Double(d)` into `Double.valueOf(d)`
Turns `!strings.stream().anyMatch(p)` into `strings.stream().noneMatch(p)`
Turns 'c.removeAll(c)' into 'c.clear()' in Collection
Turns 'SomeClassWithConstructor(){super(); someMethod();}` into `SomeClassWithConstructor(){someMethod();}`.
Deprecated.
This mutator will apply all
IMutator
considered safe (e.g.This mutator will apply all
IMutator
considered not-trivial.This mutator will apply all
IMutator
considered safe (e.g.Turns `!(a == 2)` into `a != 2`
Turns `boolean b=false; if(X) b=true;` into `boolean b=X;`
BEWARE: One may argue this is a relevant change only if the boolean is not written after its initialization, hence if
the boolean can be turned into a `final` variable.
Deprecated.
Deprecated.
Turns `IntStream.range(0, s.length()).forEach(j -> { int c = s.charAt(j); sb.append(c); });`
into `IntStream.range(0, s.length()).map(j -> s.charAt(j)).forEach(c -> sb.append(c))`
This mutator will apply all
IMutator
fixing a Sonar rule.This mutator will apply all
IMutator
fixing SpotBugs rules.Turns 's.filter(p).findAny().isPresent()' into 's.anyMatch(predicate)'
Helps building mutators around
Stream
Turns 's.indexOf(subString) >= 0' into 'c.contains(subString)' in String
Turns `s.replaceAll("abc", "")` into `s.replace("abc", "")`
Turns '"someString".toString()' into '"someString"'
Turns `Integer integer = Integer.valueOf(2)` into `Integer integer = 2`
Turns 'java.lang.String' into 'String'
Remove imports from a Java source file by analyzing
ImportDeclaration
.Turns '.stream((s) -> s.subString(0, 2))' into '.stream(s -> s.subString(0, 2))'
Turns 'public static final someMethod();' into 'someMethod();' in interfaces
Turns `int i = 0;;` into `int i = 0;`
Migrate from 'm.size() == 0’ to ’m.isEmpty()'.
Deprecated.
Deprecated.
Turns 's.indexOf("s")’ into ’s.indexOf('s')'.
Migrate from 'm.length() == 0’ to ’m.isEmpty()'.
Turns '"a\r\n" + "b\r\n"’ into ’"""aEOLbEOL"""'
Turns 'int i = 1234567’ into ’int i = 1_234_567'