AutoLogger.java

1
package com.github.dakusui.osynth.core;
2
3
import java.lang.reflect.Method;
4
5
public interface AutoLogger {
6
7
  static MethodHandlerDecorator create(AutoLogger autoLogger) {
8 2 1. create : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::create → KILLED
2. lambda$create$1 : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::lambda$create$1 → KILLED
    return (method, methodHandler) -> (MethodHandler) (synthesizedObject, args) -> {
9 1 1. lambda$null$0 : removed call to com/github/dakusui/osynth/core/AutoLogger::log → KILLED
      autoLogger.log(autoLogger.enter(synthesizedObject, method, args));
10
      Object ret;
11
      try {
12
        ret = methodHandler.handle(synthesizedObject, args);
13 1 1. lambda$null$0 : removed call to com/github/dakusui/osynth/core/AutoLogger::log → KILLED
        autoLogger.log(autoLogger.leave(synthesizedObject, method, ret));
14 1 1. lambda$null$0 : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::lambda$null$0 → KILLED
        return ret;
15
      } catch (Throwable t) {
16 1 1. lambda$null$0 : removed call to com/github/dakusui/osynth/core/AutoLogger::log → SURVIVED
        autoLogger.log(autoLogger.exception(synthesizedObject, method, t));
17
        throw t;
18
      }
19
    };
20
  }
21
22
  interface Entry {
23
24
25
    enum Type {
26
      ENTER("arguments") {
27
      },
28
      LEAVE("return") {
29
      },
30
      EXCEPTION("exception") {
31
      };
32
33
      private final String outputValueLabel;
34
35
      Type(String outputValueLabel) {
36
        this.outputValueLabel = outputValueLabel;
37
      }
38
39
      public String outputValueLabel() {
40 1 1. outputValueLabel : replaced return value with "" for com/github/dakusui/osynth/core/AutoLogger$Entry$Type::outputValueLabel → KILLED
        return this.outputValueLabel;
41
      }
42
    }
43
44
    Entry.Type type();
45
46
    Object object();
47
48
    Method method();
49
50
    Object value();
51
52
    /**
53
     * A default implementation of this method is provided to save implementation
54
     * effort for entries not need arguments.
55
     *
56
     * @return An argument array passed this entry when this represents a method entry.
57
     */
58
    default Object[] arguments() {
59
      throw new UnsupportedOperationException();
60
    }
61
62
    /**
63
     * A default implementation of this method is provided to save implementation
64
     * effort for entries not need exception.
65
     *
66
     * @return An exception detected during method execution.
67
     */
68
    default Throwable exception() {
69
      throw new UnsupportedOperationException();
70
    }
71
72
    ;
73
74
    static Entry enter(Object object, Method method, Object[] args) {
75 1 1. enter : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry::enter → KILLED
      return new Entry() {
76
        @Override
77
        public Type type() {
78 1 1. type : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::type → KILLED
          return Type.ENTER;
79
        }
80
81
        @Override
82
        public Object object() {
83 1 1. object : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::object → SURVIVED
          return object;
84
        }
85
86
        @Override
87
        public Method method() {
88 1 1. method : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::method → KILLED
          return method;
89
        }
90
91
        @Override
92
        public Object[] arguments() {
93 1 1. arguments : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::arguments → KILLED
          return args;
94
        }
95
96
        @Override
97
        public Object value() {
98 1 1. value : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::value → KILLED
          return this.arguments();
99
        }
100
      };
101
    }
102
103
    static Entry leave(Object object, Method method, Object returnedValue) {
104 1 1. leave : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry::leave → KILLED
      return new Entry() {
105
        @Override
106
        public Type type() {
107 1 1. type : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::type → KILLED
          return Type.LEAVE;
108
        }
109
110
        @Override
111
        public Object object() {
112 1 1. object : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::object → SURVIVED
          return object;
113
        }
114
115
        @Override
116
        public Method method() {
117 1 1. method : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::method → KILLED
          return method;
118
        }
119
120
        @Override
121
        public Object value() {
122 1 1. value : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::value → KILLED
          return returnedValue;
123
        }
124
      };
125
    }
126
127
    static Entry exception(Object object, Method method, Throwable exception) {
128 1 1. exception : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry::exception → KILLED
      return new Entry() {
129
        @Override
130
        public Type type() {
131 1 1. type : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::type → KILLED
          return Type.EXCEPTION;
132
        }
133
134
        @Override
135
        public Object object() {
136 1 1. object : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::object → SURVIVED
          return object;
137
        }
138
139
        @Override
140
        public Method method() {
141 1 1. method : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::method → KILLED
          return method;
142
        }
143
144
        @Override
145
        public Object value() {
146 1 1. value : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::value → KILLED
          return exception();
147
        }
148
149
        @Override
150
        public Throwable exception() {
151 1 1. exception : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::exception → KILLED
          return exception;
152
        }
153
      };
154
    }
155
  }
156
157
  default Entry enter(Object object, Method method, Object[] args) {
158 1 1. enter : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::enter → KILLED
    return Entry.enter(object, method, args);
159
  }
160
161
  default Entry leave(Object object, Method method, Object returnedValue) {
162 1 1. leave : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::leave → KILLED
    return Entry.leave(object, method, returnedValue);
163
  }
164
165
  default Entry exception(Object object, Method method, Throwable t) {
166 1 1. exception : replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::exception → KILLED
    return Entry.exception(object, method, t);
167
  }
168
169
  void log(Entry entry);
170
}

Mutations

8

1.1
Location : create
Killed by : com.github.dakusui.osynth.ut.core.SynthesizedObjectTest.differentHandlerDecorator(com.github.dakusui.osynth.ut.core.SynthesizedObjectTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::create → KILLED

2.2
Location : lambda$create$1
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::lambda$create$1 → KILLED

9

1.1
Location : lambda$null$0
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
removed call to com/github/dakusui/osynth/core/AutoLogger::log → KILLED

13

1.1
Location : lambda$null$0
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
removed call to com/github/dakusui/osynth/core/AutoLogger::log → KILLED

14

1.1
Location : lambda$null$0
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.modifyAutoLoggingBehaviorBy$compose$_thenModifiedBehaviorObserved(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::lambda$null$0 → KILLED

16

1.1
Location : lambda$null$0
Killed by : none
removed call to com/github/dakusui/osynth/core/AutoLogger::log → SURVIVED

40

1.1
Location : outputValueLabel
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with "" for com/github/dakusui/osynth/core/AutoLogger$Entry$Type::outputValueLabel → KILLED

75

1.1
Location : enter
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry::enter → KILLED

78

1.1
Location : type
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::type → KILLED

83

1.1
Location : object
Killed by : none
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::object → SURVIVED

88

1.1
Location : method
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::method → KILLED

93

1.1
Location : arguments
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::arguments → KILLED

98

1.1
Location : value
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$1::value → KILLED

104

1.1
Location : leave
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry::leave → KILLED

107

1.1
Location : type
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::type → KILLED

112

1.1
Location : object
Killed by : none
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::object → SURVIVED

117

1.1
Location : method
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::method → KILLED

122

1.1
Location : value
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$2::value → KILLED

128

1.1
Location : exception
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.enableAutoLogging(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry::exception → KILLED

131

1.1
Location : type
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.enableAutoLogging(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::type → KILLED

136

1.1
Location : object
Killed by : none
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::object → SURVIVED

141

1.1
Location : method
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.enableAutoLogging(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::method → KILLED

146

1.1
Location : value
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.enableAutoLogging(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::value → KILLED

151

1.1
Location : exception
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.enableAutoLogging(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger$Entry$3::exception → KILLED

158

1.1
Location : enter
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::enter → KILLED

162

1.1
Location : leave
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.givenAutoLoggingEnabled_whenDefaultMethod$bMethod$_thenDoesntBreak(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::leave → KILLED

166

1.1
Location : exception
Killed by : com.github.dakusui.osynth.ut.AutoLoggingTest.enableAutoLogging(com.github.dakusui.osynth.ut.AutoLoggingTest)
replaced return value with null for com/github/dakusui/osynth/core/AutoLogger::exception → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3