[BUG] testLoggersAreNotPublicFinalAndNotStatic is failed when init new generator with new.sh
Created by: 0bach0
Description
I tried to generate new server generator by using new.sh
, but generated file in src/main/java/org/openapitools/codegen/languages/TypescriptNestjsServerCodegen.java
trigger this error
testLoggersAreNotPublicFinalAndNotStatic
java.lang.AssertionError: Architecture Violation [Priority: MEDIUM] - Rule 'fields that have raw type org.slf4j.Logger should not be public and should not be static and should be final, because Code generators are most often used once per program lifetime, so making them all static will cause higher memory consumption. See PR #8799' was violated (1 times):
Field <org.openapitools.codegen.languages.TypescriptNestjsServerCodegen.LOGGER> has modifier STATIC in (TypescriptNestjsServerCodegen.java:0)
at com.tngtech.archunit.lang.ArchRule$Assertions.assertNoViolation(ArchRule.java:107)
at com.tngtech.archunit.lang.ArchRule$Assertions.check(ArchRule.java:95)
at com.tngtech.archunit.lang.ArchRule$Factory$SimpleArchRule.check(ArchRule.java:215)
at org.openapitools.codegen.ArchUnitRulesTest.testLoggersAreNotPublicFinalAndNotStatic(ArchUnitRulesTest.java:19)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at java.util.ArrayList.forEach(ArrayList.java:1259)
... Removed 28 stack frames
openapi-generator version
v6.2.1
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
./new.sh -n typescript-nestjs -s -t
mvn clean install
Related issues/PRs
Suggest a fix/enhancement
Fix in new.sh
file
// BEFORE
static final Logger LOGGER = LoggerFactory.getLogger(${lang_classname}.class);
// AFTER
private final Logger LOGGER = LoggerFactory.getLogger(${lang_classname}.class);