Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366330

Summary: [refactor][move] Bad visibility warning when moving a static method referencing an enum literal from another package
Product: [Eclipse Project] JDT Reporter: Lukas Eder <lukas.eder>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, lukas.eder, stephan.herrmann
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Attachments:
Description Flags
Simple Eclipse project for reproduction none

Description Lukas Eder CLA 2011-12-11 06:48:48 EST
Build Identifier: 20110615-0604

The refactor > move action on a method indicates visibility problems when moving a static method from one class to another, when that method references an enum literal from another package. The message reads:

"The visibility of field 'xxx' will be changed to public."

That's unnecessary, as enum literals are always public. This is a minor issue, as the warning can be safely ignored. With large refactorings, though, it might be a bit misleading.

Reproducible: Always

Steps to Reproduce:
1. Use the sample Eclipse project that I attached
2. Go to the "pkg1.Source" class
3. Click on the "method()" method
4. Right click, choose "Refactor", choose "Move"
5. Type Target1
6. Choose "Preview >" or "OK", the problem occurs with both buttons
7. The unnecessary warning occurs

Note, this does not happen when in step 5, you choose pkg2.Target2, which is in the same package as the enum type itself.
Comment 1 Lukas Eder CLA 2011-12-11 06:51:22 EST
Created attachment 208224 [details]
Simple Eclipse project for reproduction
Comment 2 Eclipse Genie CLA 2020-05-07 13:37:30 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Lukas Eder CLA 2020-05-08 05:13:42 EDT
I can no longer reproduce this myself...
Comment 4 Stephan Herrmann CLA 2020-05-08 05:46:28 EDT
(In reply to Lukas Eder from comment #3)
> I can no longer reproduce this myself...

thanks for re-testing.