forked from loafle/openapi-generator-original
[cleanup] erefactor/EclipseJdt - Remove unnecessary casts (#8698)
EclipseJdt cleanup 'RemoveUnnecessaryCast' applied by erefactor. For EclipseJdt see https://www.eclipse.org/eclipse/news/4.18/jdt.php For erefactor see https://github.com/cal101/erefactor
This commit is contained in:
+1
-1
@@ -6397,7 +6397,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
|
||||
CodegenModel cm = new CodegenModel();
|
||||
|
||||
cm.discriminator = createDiscriminator("", (Schema) cs, openAPI);
|
||||
cm.discriminator = createDiscriminator("", cs, openAPI);
|
||||
if (!this.getLegacyDiscriminatorBehavior()) {
|
||||
cm.addDiscriminatorMappedModelsImports();
|
||||
}
|
||||
|
||||
+3
-3
@@ -118,7 +118,7 @@ public class InlineModelResolver {
|
||||
|
||||
Schema model = ModelUtils.getSchemaFromRequestBody(requestBody);
|
||||
if (model instanceof ObjectSchema) {
|
||||
Schema obj = (Schema) model;
|
||||
Schema obj = model;
|
||||
if (obj.getType() == null || "object".equals(obj.getType())) {
|
||||
if (obj.getProperties() != null && obj.getProperties().size() > 0) {
|
||||
flattenProperties(openAPI, obj.getProperties(), pathname);
|
||||
@@ -213,7 +213,7 @@ public class InlineModelResolver {
|
||||
|
||||
Schema model = parameter.getSchema();
|
||||
if (model instanceof ObjectSchema) {
|
||||
Schema obj = (Schema) model;
|
||||
Schema obj = model;
|
||||
if (obj.getType() == null || "object".equals(obj.getType())) {
|
||||
if (obj.getProperties() != null && obj.getProperties().size() > 0) {
|
||||
flattenProperties(openAPI, obj.getProperties(), pathname);
|
||||
@@ -431,7 +431,7 @@ public class InlineModelResolver {
|
||||
flattenComposedChildren(openAPI, modelName + "_anyOf", m.getAnyOf());
|
||||
flattenComposedChildren(openAPI, modelName + "_oneOf", m.getOneOf());
|
||||
} else if (model instanceof Schema) {
|
||||
Schema m = (Schema) model;
|
||||
Schema m = model;
|
||||
Map<String, Schema> properties = m.getProperties();
|
||||
flattenProperties(openAPI, properties, modelName);
|
||||
fixStringModel(m);
|
||||
|
||||
+1
-1
@@ -355,7 +355,7 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
String length(Object os) {
|
||||
int l = 1;
|
||||
for (CodegenParameter o : ((ExtendedCodegenOperation) os).allParams) {
|
||||
CodegenParameter q = (CodegenParameter) o;
|
||||
CodegenParameter q = o;
|
||||
if (q.required)
|
||||
l++;
|
||||
}
|
||||
|
||||
+2
-2
@@ -708,8 +708,8 @@ public class JavaCXFExtServerCodegen extends JavaCXFServerCodegen implements CXF
|
||||
// NOTE: use double to hold float values, to avoid numeric overflow.
|
||||
double min = var == null || var.minimum == null ? -Float.MAX_VALUE : Float.parseFloat(var.minimum);
|
||||
double max = var == null || var.maximum == null ? Float.MAX_VALUE : Float.parseFloat(var.maximum);
|
||||
double exclusiveMin = (double) (var != null && var.exclusiveMinimum ? 1 : 0);
|
||||
double inclusiveMax = (double) (var == null || !var.exclusiveMaximum ? 1 : 0);
|
||||
double exclusiveMin = var != null && var.exclusiveMinimum ? 1 : 0;
|
||||
double inclusiveMax = var == null || !var.exclusiveMaximum ? 1 : 0;
|
||||
float randomFloat = (float) (min + exclusiveMin
|
||||
+ ((max + inclusiveMax - min - exclusiveMin) * Math.random()));
|
||||
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class K6ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
Parameter p = (Parameter) obj;
|
||||
return key.equals(p.key) && value.equals((String) p.value);
|
||||
return key.equals(p.key) && value.equals(p.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1152,7 +1152,7 @@ public class KtormSchemaCodegen extends AbstractKotlinCodegen {
|
||||
this.identifierNamingConvention = naming;
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn("\"" + (String) naming + "\" is invalid \"identifierNamingConvention\" argument. Current \"" + (String) this.identifierNamingConvention + "\" used instead.");
|
||||
LOGGER.warn("\"" + naming + "\" is invalid \"identifierNamingConvention\" argument. Current \"" + this.identifierNamingConvention + "\" used instead.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1196,7 +1196,7 @@ public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig
|
||||
this.identifierNamingConvention = naming;
|
||||
break;
|
||||
default:
|
||||
LOGGER.warn("\"" + (String) naming + "\" is invalid \"identifierNamingConvention\" argument. Current \"" + (String) this.identifierNamingConvention + "\" used instead.");
|
||||
LOGGER.warn("\"" + naming + "\" is invalid \"identifierNamingConvention\" argument. Current \"" + this.identifierNamingConvention + "\" used instead.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class PhpSlim4ServerCodegen extends PhpSlimServerCodegen {
|
||||
break;
|
||||
default:
|
||||
this.psr7Implementation = "slim-psr7";
|
||||
LOGGER.warn("\"" + (String) psr7Implementation + "\" is invalid \"psr7Implementation\" argument. Default \"slim-psr7\" used instead.");
|
||||
LOGGER.warn("\"" + psr7Implementation + "\" is invalid \"psr7Implementation\" argument. Default \"slim-psr7\" used instead.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -628,7 +628,7 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
// Datetime time stamps in Swift are expressed as Seconds with Microsecond precision.
|
||||
// In Java, we need to be creative to get the Timestamp in Microseconds as a long.
|
||||
Instant instant = ((OffsetDateTime) p.getDefault()).toInstant();
|
||||
long epochMicro = TimeUnit.SECONDS.toMicros(instant.getEpochSecond()) + ((long) instant.get(ChronoField.MICRO_OF_SECOND));
|
||||
long epochMicro = TimeUnit.SECONDS.toMicros(instant.getEpochSecond()) + (instant.get(ChronoField.MICRO_OF_SECOND));
|
||||
return "Date(timeIntervalSince1970: " + String.valueOf(epochMicro) + ".0 / 1_000_000)";
|
||||
} else if (ModelUtils.isStringSchema(p)) {
|
||||
return "\"" + escapeText((String) p.getDefault()) + "\"";
|
||||
|
||||
+3
-3
@@ -90,7 +90,7 @@ public class MysqlSchemaCodegenTest {
|
||||
Assert.assertFalse((Boolean) strProp.get("isFloat"));
|
||||
Assert.assertFalse((Boolean) strProp.get("isInteger"));
|
||||
Assert.assertFalse((Boolean) strProp.get("isNumeric"));
|
||||
Assert.assertSame((String) strProp.get("argumentValue"), strArgument);
|
||||
Assert.assertSame(strProp.get("argumentValue"), strArgument);
|
||||
|
||||
Integer intArgument = 10;
|
||||
HashMap<String, Object> intProp = codegen.toCodegenMysqlDataTypeArgument(intArgument);
|
||||
@@ -98,7 +98,7 @@ public class MysqlSchemaCodegenTest {
|
||||
Assert.assertFalse((Boolean) intProp.get("isFloat"));
|
||||
Assert.assertTrue((Boolean) intProp.get("isInteger"));
|
||||
Assert.assertTrue((Boolean) intProp.get("isNumeric"));
|
||||
Assert.assertSame((Integer) intProp.get("argumentValue"), intArgument);
|
||||
Assert.assertSame(intProp.get("argumentValue"), intArgument);
|
||||
|
||||
Double floatArgument = 3.14;
|
||||
HashMap<String, Object> floatProp = codegen.toCodegenMysqlDataTypeArgument(floatArgument);
|
||||
@@ -106,7 +106,7 @@ public class MysqlSchemaCodegenTest {
|
||||
Assert.assertTrue((Boolean) floatProp.get("isFloat"));
|
||||
Assert.assertFalse((Boolean) floatProp.get("isInteger"));
|
||||
Assert.assertTrue((Boolean) floatProp.get("isNumeric"));
|
||||
Assert.assertSame((Double) floatProp.get("argumentValue"), floatArgument);
|
||||
Assert.assertSame(floatProp.get("argumentValue"), floatArgument);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user