diff --git a/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java b/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java index 7fc0799963..35ec27c0ea 100644 --- a/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java +++ b/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java @@ -155,12 +155,14 @@ public void visitInnerClass(String name, String outerName, String innerName, int javaClassBuilder.withSimpleName(nullToEmpty(innerName)); // Javadoc for innerName: "May be null for anonymous inner classes." - javaClassBuilder.withAnonymousClass(innerName == null); + boolean isAnonymousClass = innerName == null; + javaClassBuilder.withAnonymousClass(isAnonymousClass); // Javadoc for outerName: "May be null for not member classes." - javaClassBuilder.withMemberClass(outerName != null); + boolean isMemberClass = outerName != null; + javaClassBuilder.withMemberClass(isMemberClass); - if (isNamedNestedClass(outerName)) { + if (isMemberClass) { javaClassBuilder.withModifiers(JavaModifier.getModifiersForClass(access)); declarationHandler.registerEnclosingClass(innerTypeName, createTypeName(outerName)); } @@ -176,10 +178,6 @@ private boolean visitingCurrentClass(String innerTypeName) { return innerTypeName.equals(className); } - private boolean isNamedNestedClass(String outerName) { - return outerName != null; - } - @Override public void visitOuterClass(String owner, String name, String desc) { if (importAborted()) {