Check if an exception instance is present in a generics array
<p>I want to check if an instance of a particular exception is present in a generics array. (I expect all elements of the array are to be some exceptions.)</p>

<p>Here's what I have tried:</p>

<pre><code>class Ideone
{
    public static boolean isPresent(final Throwable t, final Class&lt;?&gt;[] exceptionArray){
        for(Class&lt;?&gt; exc : exceptionArray){
            if(t instanceof exc.getClass() ){
                return true;
            }
        }
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // your code goes here
        Class&lt;?&gt;[] my = {RuntimeException.class};
        isPresent(RuntimeException.class, my);
    }
}
</code></pre>

<p>Here's an <a href="https://ideone.com/wB8Hrp" rel="nofollow">IDEOne link</a> if that helps you to simulate. 
Here, I get the error <code>expected )</code></p>

<p>On IntelliJ Idea, on hovering, I get the error <code>cannot resolve symbol 'getClass'</code>.</p>

<p>Any Ideas?</p>

<p>Thanks.</p>