forked from loafle/openapi-generator-original
Fix support for 'class' properties in Java codegen (#4237)
* Fix support for 'class' properties in Java codegen Currently Java codegen works successfully for property named 'class' but fails on '_class', '__class', etc, because of 'Object.getClass()' overloading. This fix is intended to avoid all Object method overloading cases. * Regenerated samples for Java petstore-security-test
This commit is contained in:
@@ -361,7 +361,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
// sanitize name
|
||||
name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
|
||||
|
||||
if ("class".equals(name.toLowerCase())) {
|
||||
if (name.toLowerCase().matches("^_*class$")) {
|
||||
return "propertyClass";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user