@@ -58,7 +58,6 @@ class PluginUtils {
5858 * @return result of the check.
5959 */
6060 static boolean isAnnotatedWith (TypeDescription type , Class <?> annotationType ) {
61-
6261 return type .getDeclaredAnnotations () //
6362 .asTypeList () //
6463 .stream () //
@@ -100,9 +99,7 @@ static Builder<?> mapAnnotationOrInterfaces(Builder<?> builder, TypeDescription
10099 Map <Class <?>, Class <? extends Annotation >> mappings , Log log ) {
101100
102101 for (Entry <Class <?>, Class <? extends Annotation >> entry : mappings .entrySet ()) {
103-
104102 Class <?> source = entry .getKey ();
105-
106103 if (source .isAnnotation () ? isAnnotatedWith (type , source ) : type .isAssignableTo (source )) {
107104 builder = addAnnotationIfMissing (entry .getValue (), builder , type , log );
108105 }
@@ -235,9 +232,7 @@ public T get() {
235232 * @return output for the log.
236233 */
237234 static String toLog (FieldDescription field ) {
238-
239235 TypeDefinition type = field .getDeclaringType ();
240-
241236 return abbreviate (type ).concat ("." ).concat (field .getName ());
242237 }
243238
@@ -248,10 +243,9 @@ static String toLog(FieldDescription field) {
248243 * @param consumer must not be {@literal null}.
249244 */
250245 static void ifTypePresent (String fullyQualifiedTypeName , Consumer <Class <?>> consumer ) {
251-
252246 try {
253247 consumer .accept (PluginUtils .class .getClassLoader ().loadClass (fullyQualifiedTypeName ));
254- } catch (ClassNotFoundException o_O ) {}
248+ } catch (ClassNotFoundException e ) {}
255249 }
256250
257251 /**
@@ -262,11 +256,10 @@ static void ifTypePresent(String fullyQualifiedTypeName, Consumer<Class<?>> cons
262256 */
263257 @ SuppressWarnings ("unchecked" )
264258 static void ifAnnotationTypePresent (String fullyQualifiedTypeName , Consumer <Class <? extends Annotation >> consumer ) {
265-
266259 try {
267260 consumer
268261 .accept ((Class <? extends Annotation >) PluginUtils .class .getClassLoader ().loadClass (fullyQualifiedTypeName ));
269- } catch (ClassNotFoundException o_O ) {}
262+ } catch (ClassNotFoundException e ) {}
270263 }
271264
272265 /**
@@ -286,7 +279,6 @@ static boolean isCglibProxyType(TypeDefinition definition) {
286279 * @return since 0.26
287280 */
288281 static MethodDefinition <?> markGenerated (MethodDefinition <?> method ) {
289-
290282 return getGeneratedTypeAnnotation (ElementType .METHOD )
291283 .<MethodDefinition <?>> map (method ::annotateMethod )
292284 .orElse (method );
@@ -301,7 +293,6 @@ static MethodDefinition<?> markGenerated(MethodDefinition<?> method) {
301293 * @since 0.26
302294 */
303295 static Builder <?> markGenerated (Builder <?> builder , Log log ) {
304-
305296 return getGeneratedTypeAnnotation (ElementType .TYPE )
306297 .map (it -> {
307298
@@ -316,34 +307,27 @@ static Builder<?> markGenerated(Builder<?> builder, Log log) {
316307
317308 private static Builder <?> addAnnotationIfMissing (Class <? extends Annotation > annotation , Builder <?> builder ,
318309 TypeDescription type , Log log ) {
319-
320310 if (isAnnotatedWith (type , annotation )) {
321311 log .info ("Not adding @{}, already present." , PluginUtils .abbreviate (annotation ));
322312 return builder ;
323313 }
324314
325315 log .info ("Adding @{}." , PluginUtils .abbreviate (annotation ));
326-
327316 return builder .annotateType (getAnnotation (annotation ));
328317 }
329318
330319 private static String getPackageName (String fullyQualifiedTypeName ) {
331-
332320 int lastDotIndex = fullyQualifiedTypeName .lastIndexOf ('.' );
333-
334321 return lastDotIndex == -1 ? fullyQualifiedTypeName : fullyQualifiedTypeName .substring (0 , lastDotIndex );
335322 }
336323
337324 private static String getShortName (String fullyQualifiedTypeName ) {
338-
339325 int lastDotIndex = fullyQualifiedTypeName .lastIndexOf ('.' );
340-
341326 return lastDotIndex == -1 ? fullyQualifiedTypeName
342327 : fullyQualifiedTypeName .substring (lastDotIndex , fullyQualifiedTypeName .length ());
343328 }
344329
345330 private static Optional <AnnotationDescription > getGeneratedTypeAnnotation (ElementType type ) {
346-
347331 return Types .AT_GENERATED .stream ()
348332 .filter (it -> hasTarget (it , type ))
349333 .findFirst ()
@@ -354,9 +338,8 @@ private static Optional<AnnotationDescription> getGeneratedTypeAnnotation(Elemen
354338 }
355339
356340 private static boolean hasTarget (Class <? extends Annotation > type , ElementType target ) {
357-
358341 Target annotation = type .getAnnotation (Target .class );
359-
360342 return annotation != null && Arrays .asList (annotation .value ()).contains (target );
361343 }
344+
362345}
0 commit comments