I have a variable that has several upper bounded wildcards, like so:
private Map< Class< ? extends MyClass1 >, List< ? extends MyClass2< ? extends MyClass3, ? extends MyClass1> > > _variableName;
Is there any way to enforce that the bound value ? extends MyClass1 be the same for the Type of the Class class and the 2nd param of the MyClass2 class?
Yes:
You could also do this with a generic method. It depends on where you want to make the guarantee (and by extension, where the Map is instantiated), when defining the class or when calling a method that instantiates this Map.
UPDATE:
In response to the (correct) observation that this map will only contain one element, perhaps the questioner had this in mind instead:
Assuming this is the only way to add elements to your private map, then that ensures the types always match.