}
else {
parser = new MetadataParser(IMetadataResolver.EMPTY);
}
final TypeReference declaringType = parser.parseTypeDescriptor("java/lang/" + jvmType.name());
final FieldReference field = parser.parseField(declaringType, fieldName, jvmType.getDescriptorPrefix());
if (currentType != null &&
node.getParent() instanceof VariableInitializer &&
node.getParent().getParent() instanceof FieldDeclaration &&
StringUtilities.equals(currentType.getInternalName(), declaringType.getInternalName())) {
final FieldDeclaration declaration = (FieldDeclaration) node.getParent().getParent();
final FieldDefinition actualField = declaration.getUserData(Keys.FIELD_DEFINITION);
if (actualField == null || StringUtilities.equals(actualField.getName(), fieldName)) {
switch (fieldName) {
case "POSITIVE_INFINITY": {
node.replaceWith(
new BinaryOperatorExpression(
new PrimitiveExpression(node.getOffset(), jvmType == JvmType.Double ? 1d : 1f),
BinaryOperatorType.DIVIDE,
new PrimitiveExpression(node.getOffset(), jvmType == JvmType.Double ? 0d : 0f)
)
);
return;
}
case "NEGATIVE_INFINITY": {
node.replaceWith(
new BinaryOperatorExpression(
new PrimitiveExpression(node.getOffset(), jvmType == JvmType.Double ? -1d : -1f),
BinaryOperatorType.DIVIDE,
new PrimitiveExpression(node.getOffset(), jvmType == JvmType.Double ? 0d : 0f)
)
);
return;
}
case "NaN": {
node.replaceWith(
new BinaryOperatorExpression(
new PrimitiveExpression(node.getOffset(), jvmType == JvmType.Double ? 0d : 0f),
BinaryOperatorType.DIVIDE,
new PrimitiveExpression(node.getOffset(), jvmType == JvmType.Double ? 0d : 0f)
)
);
return;
}
default: {
return;
}
}
}
}
final AstType astType;
final AstBuilder astBuilder = context.getUserData(Keys.AST_BUILDER);
if (astBuilder != null) {
astType = astBuilder.convertType(declaringType);
}
else {
astType = new SimpleType(declaringType.getName());
astType.putUserData(Keys.TYPE_REFERENCE, declaringType);
}
final MemberReferenceExpression memberReference = new MemberReferenceExpression( node.getOffset(),
new TypeReferenceExpression(node.getOffset(), astType),