That is correct. The setConfig knows that the value should be of type Integer since the INT_KEY indicates that.

So the compiler already sees that passing a String as argument is no good. 

Of course I can do something like this:

    MyOtherEntity entity2 = new MyOtherEntity(parent:app)
    ConfigKey key = MyOtherEntity.INT_KEY;
    entity2.setConfig(key, "thisisnotanint");

Because type information is lost on key.... the compiler has no way to infer the type of the second argument so he will accept a string happily.