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 270797 - org.netbeans.modules.java.editor.codegen.GeneratorUtils$DuplicateMemberException: Class member already exists
Summary: org.netbeans.modules.java.editor.codegen.GeneratorUtils$DuplicateMemberExcept...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: Dev
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-03 16:56 UTC by Maksim Khramov
Modified: 2017-08-30 02:23 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 220998


Attachments
stacktrace (5.63 KB, text/plain)
2017-06-03 16:56 UTC, Maksim Khramov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maksim Khramov 2017-06-03 16:56:10 UTC
Build: NetBeans IDE Dev (Build 201705310001)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.131-b11, Java(TM) SE Runtime Environment, 1.8.0_131-b11
OS: Windows 10

User Comments:
GUEST: pico

mkhramov: Create in some class field ex:
private static final String keyName = "";

Invoke Introduce Constant refactoring from some String in code.
In opened dialog enter previously created keyName as constant name.
Press OK.
Exception is thrown

GUEST: not remember

GUEST: Trying to introduce new constant from existing code with the name which already exists in the code.

GUEST: while using refactoring on a variable to introduce constant

fillumina: introducing an already existent class static field using ctrl-alt-C




Stacktrace: 
org.netbeans.modules.java.editor.codegen.GeneratorUtils$DuplicateMemberException: Class member already exists
   at org.netbeans.modules.java.editor.codegen.GeneratorUtils.insertClassMembers(GeneratorUtils.java:198)
   at org.netbeans.modules.java.editor.codegen.GeneratorUtils.insertClassMember(GeneratorUtils.java:205)
   at org.netbeans.modules.java.hints.introduce.IntroduceHint$InsertClassMember.insertClassMember(IntroduceHint.java:950)
   at org.netbeans.modules.java.hints.introduce.IntroduceHint.insertField(IntroduceHint.java:776)
   at org.netbeans.modules.java.hints.introduce.IntroduceFieldFix$Worker.run(IntroduceFieldFix.java:363)
   at org.netbeans.modules.java.hints.introduce.IntroduceFieldFix$Worker.run(IntroduceFieldFix.java:190)
Comment 1 Maksim Khramov 2017-06-03 16:56:13 UTC
Created attachment 164458 [details]
stacktrace
Comment 2 Svata Dedic 2017-08-11 13:32:48 UTC
Should be fixed by jet-main#525bb47d7f44
Comment 3 Quality Engineering 2017-08-30 02:23:16 UTC
Integrated into 'main-silver', will be available in build *201708300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/525bb47d7f44
User: Svata Dedic <sdedic@netbeans.org>
Log: #270797: fixed checking duplicate names. Improved checking for shadowed symbols