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 258034 - "Change method parameters" applies access/visibility to subclasses
Summary: "Change method parameters" applies access/visibility to subclasses
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.2
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-17 13:41 UTC by bugmenot1
Modified: 2016-08-27 02:18 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 bugmenot1 2016-02-17 13:41:26 UTC
Product Version: NetBeans IDE Dev (Build 201602170002)
Java: 1.8.0_71; Java HotSpot(TM) 64-Bit Server VM 25.71-b15
Runtime: Java(TM) SE Runtime Environment 1.8.0_71-b15

Refactoring (change method parameters) applies the selected visibility to subclasses. If an overriding method in a subclass has wider visibility, it is reduced to the one in the parent class.

Example:

public abstract class AbstractResource {

    protected void foo(final Object o) {
    }
}

public class CustomerResource extends AbstractResource {

    @Override
    public void foo(final Object o) {
        super.foo(o);
    }
}

Select "Change method parameters" on AbstractResource.foo(Object). All I wanted to do is remove the parameter. But then the visibility of CustomerResource.foo() is also set to protected and this won’t work in JAX-RS or any other call requiring the subclass method to be public.
Comment 1 Svata Dedic 2016-08-19 06:30:00 UTC
I've added (default) option to the modifiers combo to NOT change modifiers - jet-main#5dd2532fb4cd
Comment 2 Quality Engineering 2016-08-27 02:18:41 UTC
Integrated into 'main-silver', will be available in build *201608270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5dd2532fb4cd
User: Svata Dedic <sdedic@netbeans.org>
Log: #258034: do not change visibility by default