Conversation
There was a problem hiding this comment.
So this basically says that RiakIndex will be a generic type without any type constraints?
There was a problem hiding this comment.
Yeah, it says that the type parameter used by RiakIndex will be of some specific (but unknown) type - but for our purposes we (and the compiler) don't need to know. We don't use the type parameter wrapped by RiakIndex anywhere in the Name class, so we could use either.
On the flip side I don't see how you could ever use the raw type by itself (RiakIndex, no type parameter), since RiakIndex is an abstract class.
|
@TJC - you should be interested in these changes 😄 |
|
These changes look good to me ... not that I know 100% what they do 😄 👍 |
|
@TJC - Do you have any Scala code that I could test these changes against, or that show the trouble you were having with the raw types? |
|
Create demo.scala: package foo
import com.basho.riak.client.core.query.RiakObject
import com.basho.riak.client.core.util.BinaryValue
import com.basho.riak.client.core.query.indexes.StringBinIndex
class RiakTest {
val obj = new RiakObject
obj.setValue(BinaryValue.create("hello world"))
obj.setContentType("application/json")
val idxtype = StringBinIndex.named("myindex")
val indexes = obj.getIndexes
indexes.getIndex(idxtype).add("myvalue")
}Try to compile it with: |
|
I can make a version that uses sbt to get the dependencies and so forth, but I figured that the smallest, simplest demo was best. It doesn't actually do anything when compiled, but the compilation failure is the test. |
|
@TJC Thanks! So good news and bad news. Good news: Bad news: I even tried being more explicit and giving But Scala just laughed and said it couldn't match another type parameter. I'll keep the <?> additions I made becuase they are more correct even if Java don't care, and then we'll have to make a note for Scala users to be explicit about the types for getIndex(). 😭 |
Documentation improvements, fixing a few type declarations around indexes.
|
Thanks for trying! |
This fixes issue #585 & #584.
TLDR; This replaces some
RiakIndexraw type declarations with Scala friendlyRiakIndex<?>unbounded wildcard type declarations.