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 253838 - [81cat] Java hint: CreateSubclass available where it shouldn't be
Summary: [81cat] Java hint: CreateSubclass available where it shouldn't be
Status: NEW
Alias: None
Product: qa
Classification: Unclassified
Component: Test Specifications (show other bugs)
Version: 8.1
Hardware: PC Windows 8 x64
: P3 normal (vote)
Assignee: issues@qa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-27 07:57 UTC by cezariusz
Modified: 2015-08-05 01:20 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 cezariusz 2015-07-27 07:57:41 UTC
Link: http://services.netbeans.org/synergy/client/app/#/case/4989/suite/1691

Product Version: NetBeans IDE Dev (Build 201507240001)
Java: 1.8.0_51; Java HotSpot(TM) 64-Bit Server VM 25.51-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_51-b16
System: Windows 8 version 6.2 running on amd64; UTF-8; pl_PL (nb)

public class CreateSubclass // HINT: Create subclass
{

    private class PrivateClass // "Create subclass" hint should NOT appear here, as the class has private access and "Create subclass" only creates top-level subclasses.
    {
    }
}

The comment clearly states that the hint shouldn't appear here, but it does, and invoking it leads to creating a class with an error:

public class PrivateClassImpl extends CreateSubclass.PrivateClass {

}

The error is "CreateSubclass.PrivateClass has private access in CreateSubclass".
Comment 1 cezariusz 2015-07-27 08:08:44 UTC
Same here:

    public class ClassWithPrivateConstruction // "Create subclass" hint should NOT appear here, as the class has private access and "Create subclass" only creates top-level subclasses.
    {

        private ClassWithPrivateConstruction() {
        }
    }
Comment 2 Svata Dedic 2015-07-30 10:40:54 UTC
I think the suggestion SHOULD appear even in this case, to incremental aid refactoring. It's a inline suggestion (rather an intention), which does not appear in code inspection and the user chooses when to execute the action at will. We should not demand a specific workflow: that the user first turns the class to protected or public (possibly changing constructors) and only THEN the IDE can assist in generating the boilerplate code.


Please update the test spec. If unhappy with the decision, raise a discussion on mailing list.
Comment 3 Quality Engineering 2015-08-05 01:20:42 UTC
Integrated into 'main-silver', will be available in build *201508050002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4891cee42d1a
User: Svata Dedic <sdedic@netbeans.org>
Log: #253838: create subclass suppressed on non-static types