This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257967 - ClassCastException:$UnionClassType cannot be cast to$IntersectionClassType
Summary: ClassCastException:$UnionClassType cannot be ca...
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Compiler (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: Dusan Balek
Depends on:
Reported: 2016-02-12 20:32 UTC by klawson88
Modified: 2016-02-12 20:32 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 205481

stacktrace (4.32 KB, text/plain)
2016-02-12 20:32 UTC, klawson88

Note You need to log in before you can comment on or make changes to this bug.
Description klawson88 2016-02-12 20:32:06 UTC
Build: NetBeans IDE 8.0 (Build 201403101706)
VM: Java HotSpot(TM) Client VM, 25.31-b07, Java(TM) SE Runtime Environment, 1.8.0_31-b13
OS: Windows 7

User Comments:
GUEST: A simple Clean and Build of a maven project.

klawson88: Using the "instanceof" operator on an exception caught in a multicatch block made to catch two exceptions which have a "cousin first removed" relationship causes this error, which prevents the IDE from providing assistive features such as autocomplete, and error highlighting.

Problematic code snippet (WriteTimeoutException is a child of QueryTimeoutException, which, along with UnavailableException and TruncateException (not seen here), is a child of QueryExcecutionException (also not seen here)): 

package wiki.nouns.actions;

import com.datastax.driver.core.exceptions.UnavailableException;
import com.datastax.driver.core.exceptions.WriteTimeoutException;
 * @author
public class TestAction 
    public void test(Exception e)
        catch(WriteTimeoutException | UnavailableException rr)
            if(rr instanceof WriteTimeoutException)

juansmolano: It took me a while to figure this out.  Only happens on NEtBeans 7.4 (Mac and Linux)

on a managedBean althought netbeans recomend to use multi catch with pipes (Ex1 | Ex2 | ...)  all help from netbeans (tips, autocomplete, etc) just stops when using this type of multi catch.

my concrete implementation was:

}catch(EmptyActiveServiceListException | ServiceProviderParameterNotFoundException | 
                NotSupportedServiceException | IncorrectPinCodeException | InsufficientBalanceException |
                BusinessUnitAssociatedServiceNotFoundException | EnumTypeNotAllowedException ex){
      messageTools.displayMessage(FacesMessage.SEVERITY_ERROR, ((UserVisibleException) ex).getExMsgKey(), null);

And everything comes to normal when replaced by:

}  catch (Exception ex) {
            messageTools.displayMessage(FacesMessage.SEVERITY_ERROR, ((UserVisibleException) ex).getExMsgKey(), null);

GUEST: Occurs after restart and after cleaning the cache.

juansmolano: Installed NEtBeans 7.4 Full Bundle on Mac OS X without importing setting from NetBeans 7.3 and then Open an Enterprise App compose of 10+ EJBs and 1 WAR

GUEST: Error always happen for this class. Also If I cleared cache.

java.lang.ClassCastException:$UnionClassType cannot be cast to$IntersectionClassType
Comment 1 klawson88 2016-02-12 20:32:09 UTC
Created attachment 158480 [details]