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 270670 - Move enum class to other breaks code
Summary: Move enum class to other breaks code
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: Dev
Hardware: PC Other
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-17 20:50 UTC by Maksim Khramov
Modified: 2017-06-25 01:46 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 Maksim Khramov 2017-05-17 20:50:25 UTC
Product Version: NetBeans IDE Dev (Build 201705050001)
Java: 1.8.0_131; Java HotSpot(TM) 64-Bit Server VM 25.131-b11

Steps to reproduce:
Create two classes: CStatus (will be used as move target) and Status enum class with next code:

Undefined(0xFFFFFFFFL), OK(0L), False(1L);
private final Long value;

public Long getValue() {
    return value;
}

Status(Long value) {
    this.value = value;
}

Invoke move to Type refactoring.
See errors:
1. IDE misses semicolumn afer first line
2. IDE added unexpected super(); call in class constructor
3. IDE cannot completely Undo this refactoring. On call Undo code added to target file cleans but previous file Status is not restores

also constant value for Undefined unexpectedly converted to decimal view
Comment 1 Svata Dedic 2017-06-23 16:56:03 UTC
I filed enhancement issue #270946 to cover the re-generation of the constant and possible others. 

The code causing the defect relates to issue #218495; removing it does not cause regresion and execution even do not stop in the touched code at all: the case is already handled elsewhere, so removing the special case actually activates code in doAccept which prints trailing semicolon properly.


Code breakage fixed by jet-main#268895
Comment 2 Quality Engineering 2017-06-25 01:46:53 UTC
Integrated into 'main-silver', will be available in build *201706250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d1ecf42c54cd
User: Svata Dedic <sdedic@netbeans.org>
Log: #270670: removed special case, field group are processed in doAccept.