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 256360 - 'Implement all abstract methods' can produce unexpected results
Summary: 'Implement all abstract methods' can produce unexpected results
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Windows 10
: P4 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-04 13:06 UTC by peterhull90
Modified: 2016-01-28 15:37 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 peterhull90 2015-11-04 13:06:14 UTC
Product Version = NetBeans IDE 8.1 RC2 (Build 201510122201)
Operating System = Windows 10 version 10.0 running on amd64
Java; VM; Vendor = 1.8.0_66
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.66-b17

Reproducibility: Happens every time

If the user puts a superinterface  before the superclass in a normal class declaration, Netbeans offers a hint to implement abstract methods which produces an incorrect file. I know this is a java syntax error but I think NB should not offer the hint at this point.

STEPS:

  * Create the following code: (minimal test case)

    package javaapplication35;

    public class NewClass implements Runnable extends Exception  {
    }
  
  * Click on light bulb hint button and choose 'Implement all abstract methods'
 
ACTUAL:

  * File becomes

    package javaapplication35;
    
    public class NewClass implements Runnablepackage javaapplication35;
    
    public class NewClass implements Runnable 
    
        @Override
        public void run() {
            throw new UnsupportedOperationException("Not supported yet."); //TODO Implement run in NewClass.
        }
    extends java.lang.Exception  {
    }

 * This is much worse for a real file with header comments etc.

EXPECTED:

  NB shows an error and does not alter the file.

 If the user writes the declaration correctly as 'public class NewClass  extends Exception implements Runnable' then it works fine.