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 251080

Summary: Skip transformation for boxed values which are compared with equality operators in "Inspect and Transform"
Product: java Reporter: kalle1
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description kalle1 2015-03-10 19:45:21 UTC
The code

    Deque<List<Object>> list = new LinkedList<List<Object>>();
    List<Object> lastRemoved = list.getLast();
    while (((Long) list.getFirst().get(0)).longValue() == ((Long) lastRemoved.get(0)).longValue()) {
        return;
    }
    throw new RuntimeException();

would be transformed into 

    Deque<List<Object>> list = new LinkedList<List<Object>>();
    List<Object> lastRemoved = list.getLast();
    while (((Long) list.getFirst().get(0)) == ((Long) lastRemoved.get(0))) {
        return;
    }
    throw new RuntimeException();

which causes the programmer to fix the comparison manually (i.e. add a `@SuppressWarning` in the case the comparison really should take place with `==` and `!=` or change the code.

This is especially annoying in conjunction with https://netbeans.org/bugzilla/show_bug.cgi?id=251078 because "Inspect and Transform" breaks your code and you won't even realize it.
Comment 1 Svata Dedic 2015-08-05 13:55:07 UTC
Fixed as part of issue #243581