You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Volker Jordan <mx...@e24.cx> on 2023/11/10 16:53:10 UTC
OData 2.0 inference variable T has incompatible equality constraints
Hi,
when I try to compile olingo2, there are a few cases where the compiler throws the error
error: method valueOfString in interface EdmSimpleType cannot be applied to given types;
final Object value = type.valueOfString(text, EdmLiteralKind.DEFAULT,
required: String,EdmLiteralKind,EdmFacets,Class<T>
found: String,EdmLiteralKind,readProper[...] null,typeMappin[...]pping
reason: inference variable T has incompatible equality constraints CAP#1,CAP#2
where T is a type-variable:
T extends Object declared in method <T>valueOfString(String,EdmLiteralKind,EdmFacets,Class<T>)
where CAP#1,CAP#2 are fresh type-variables:
CAP#1 extends Object from capture of ?
CAP#2 extends Object from capture of ?
This is occurring in
org.apache.olingo.odata2.client.core.ep.deserializer.XmlEntryDeserializer
and
org.apache.olingo.odata2.client.core.ep.deserializer.XmlPropertyDeserializer
final Object value = type.valueOfString(text, EdmLiteralKind.DEFAULT,
readProperties == null || readProperties.isValidatingFacets() ? propertyInfo.getFacets() : null,
typeMapping == null ? type.getDefaultType() : typeMapping);
If I rewrite the code the old-fashioned Java way, it works.
final Object value;
if (typeMapping == null)
{
value = type.valueOfString(text, EdmLiteralKind.DEFAULT,
readProperties == null || readProperties.isValidatingFacets() ? propertyInfo.getFacets() : null,
type.getDefaultType());
}
else
{
value = type.valueOfString(text, EdmLiteralKind.DEFAULT,
readProperties == null || readProperties.isValidatingFacets() ? propertyInfo.getFacets() : null,
typeMapping);
}
The error occurs with Java 1.8 and above. 1.7 works.
Is this now a JDK bug or an Olingo topic ?
Regards
Volker