title: Casting generic type object
body: <p>I came across this type of casting on <a href="https://docs.oracle.com/javase/tutorial/essential/io/notification.html" rel="nofollow noreferrer">java oracle tutorial</a></p>
  <pre><code> for (WatchEvent&lt;?&gt; event: key.pollEvents()) {
  ...
  ...
   WatchEvent&lt;Path&gt; ev = (WatchEvent&lt;Path&gt;)event;
  </code></pre>
  <p>My understanding that since the event reference generic type is defined as anything extend Object, so it's self-explained that since Path extends Object indirectly.</p>
  <p>But I have searched on java specification about any rules of casting generic type that explains the above case and all related cases but I didn't find anything.</p>
  <p>First, is my explanation is right?
  Second, is there any reference or DOC about this and similar cases?</p>