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 228714 - [Invert Boolean] Method call is not negated
Summary: [Invert Boolean] Method call is not negated
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 212524 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-18 14:39 UTC by Jiri Prox
Modified: 2013-08-30 11:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2013-04-18 14:39:59 UTC
Method call is not negated when calling Invert Boolean. 

Steps to reproduce:
1) have a class 

public class Test {

    class SuperClass {

        public boolean superMethod() {
            return false;
        }
    }

    class SubClass extends SuperClass {

        public boolean subMethod() {
            if(superMethod()) {
                
            }
            return superMethod();
        }

    }
}

(the classes has to be inner, otherwise it works fine!)

2) call Invert Boolean on 'superMethod()'

-> 
public class Test {

    class SuperClass {

        public boolean superMethod() {
            return true;
        }
    }

    class SubClass extends SuperClass {

        public boolean subMethod() {
            if(superMethod()) {    // <- not changed
                
            }
            return superMethod(); // <- not changed
        }

    }
}

Product Version: NetBeans IDE Dev (Build 201304162301)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b82
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 1 Ralph Ruijs 2013-05-20 15:04:54 UTC
   $enclosing.<$T$>superMethod() :: $enclosing instanceof test.Test.SuperClass  => !$enclosing.<$T$>c()
;;
   !$enclosing.<$T$>superMethod() :: $enclosing instanceof test.Test.SuperClass => $enclosing.<$T$>c()
;;


The above pattern is used to change the classes, but is not working in the case Jirka described. I think the reference to the inner-class is correct, but please reassign back if this should be changed.
Comment 2 Jan Lahoda 2013-05-31 10:18:01 UTC
*** Bug 212524 has been marked as a duplicate of this bug. ***
Comment 3 Quality Engineering 2013-06-02 01:09:35 UTC
Integrated into 'main-golden', will be available in build *201306012301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/a6795725aa85
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #228714: disable access checks while constructing the scope for a Jackpot script
Comment 4 Jan Lahoda 2013-06-02 07:42:28 UTC
The access checks are now disabled while compiling the rule.
Comment 5 Jiri Prox 2013-08-30 11:56:50 UTC
v.