allowedTypes refers to a UDTs subtype, not the actual tag type, so that’s why you’re not getting the expected results. I highly recommend using our new Query API, it’s better in a lot of ways. The Query API is much more efficient and supports actual continuations. Here’s what the query looks like.
var query = TagQuery.newBuilder()
.tagObjectType(TagObjectType.UdtInstance)
.tagObjectType(TagObjectType.Folder)
.andProperty(WellKnownTagProps.Name, ComparisonOperator.Equal, "name")
.build();
var filter = TagQueryFilter.newQuery(query);
var results = provider.queryAsync(filter, SecurityContext.systemContext()).join();