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 251898 - org.netbeans.spi.java.hints.support.FixFactory.changeModifiersFix/removeModifiersFix removes generics
Summary: org.netbeans.spi.java.hints.support.FixFactory.changeModifiersFix/removeModif...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-16 20:04 UTC by markiewb
Modified: 2016-07-19 01:43 UTC (History)
0 users

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 markiewb 2015-04-16 20:04:24 UTC
See the simple testcase

    @Test
    public void testPreserveGenerics_PublicMethod() throws Exception {
        HintTest.create().setCaretMarker('|')
                .sourceLevel("1.6")
                .input("package test;\n"
                        + "public class Test {\n"
                        + "    public <T extends java.lang.Number> java.util.Set<T> fi|nd(){return null;};\n"
                        + "}\n")
                .run(MakePackageProtected.class)
                .findWarning("2:59-2:59:hint:" + Bundle.ERR_MakePackageProtected())
                .applyFix()
                .assertOutput("package test;\n"
                        + "public class Test {\n"
                        + "    <T extends java.lang.Number> java.util.Set<T> find(){return null;};\n"
                        + "}\n");
    }

MakePackageProtected hint simply invokes org.netbeans.spi.java.hints.support.FixFactory.changeModifiersFix/removeModifiersFix

ACTUAL:
Generics are not preserved, test fails
java.util.Set<T> find(){return null;};

EXPECTED:
Generics are preserved, test succeeds
<T extends java.lang.Number> java.util.Set<T> find(){return null;};

Reproduction: 
* Checkout https://github.com/markiewb/nb-additional-hints.git Branch feature/issue61-changemodifiersremovesgenerics
* test: https://github.com/markiewb/nb-additional-hints/commit/b6891a9f740027c4c17ea8251a2b0e0116b04e52
* hint: https://raw.githubusercontent.com/markiewb/nb-additional-hints/feature/issue61-changemodifiersremovesgenerics/src/main/java/de/markiewb/netbeans/plugins/hints/modifiers/MakePackageProtected.java
Comment 1 Svata Dedic 2015-05-07 09:17:09 UTC
Seems to work for me in dev version
Comment 2 markiewb 2016-07-05 23:02:48 UTC
(In reply to Svata Dedic from comment #1)
> Seems to work for me in dev version

@Svata: Reopen. It does not work for me.
Comment 3 Svata Dedic 2016-07-18 09:29:02 UTC
Fixed in jet-main#07c1edea0ada, test added into java.source.base.
Comment 4 Quality Engineering 2016-07-19 01:43:06 UTC
Integrated into 'main-silver', will be available in build *201607190002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/07c1edea0ada
User: Svata Dedic <sdedic@netbeans.org>
Log: #251898: removing modifiers will preserve type parameters