mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
safe delete of enum constructor parameter (IDEA-22853)
This commit is contained in:
@@ -558,8 +558,14 @@ public class JavaSafeDeleteProcessor implements SafeDeleteProcessorDelegate {
|
||||
ReferencesSearch.search(method).forEach(new Processor<PsiReference>() {
|
||||
public boolean process(final PsiReference reference) {
|
||||
final PsiElement element = reference.getElement();
|
||||
if (element.getParent() instanceof PsiCall) {
|
||||
final PsiExpressionList argList = ((PsiCall)element.getParent()).getArgumentList();
|
||||
PsiCall call = null;
|
||||
if (element instanceof PsiCall) {
|
||||
call = (PsiCall)element;
|
||||
} else if (element.getParent() instanceof PsiCall) {
|
||||
call = (PsiCall)element.getParent();
|
||||
}
|
||||
if (call != null) {
|
||||
final PsiExpressionList argList = call.getArgumentList();
|
||||
if (argList != null) {
|
||||
final PsiExpression[] args = argList.getExpressions();
|
||||
if (index < args.length) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
public enum UserFlags {
|
||||
Root("Has super administrative powers" ),
|
||||
Blacklisted("Probably a spammer" );
|
||||
|
||||
public final String description;
|
||||
public final int mask;
|
||||
|
||||
UserFlags(String description) {
|
||||
this.description = description;
|
||||
this.mask = 1 << ordinal();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
public enum UserFlags {
|
||||
Root("Has super administrative powers", 0),
|
||||
Blacklisted("Probably a spammer", 1);
|
||||
|
||||
public final String description;
|
||||
public final int mask;
|
||||
|
||||
UserFlags(String description, int <caret>position) {
|
||||
this.description = description;
|
||||
this.mask = 1 << ordinal();
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,11 @@ public class SafeDeleteTest extends MultiFileTestCase {
|
||||
doTest("B");
|
||||
}
|
||||
|
||||
public void testEnumConstructorParameter() throws Exception {
|
||||
myDoCompare = false;
|
||||
doTest("UserFlags");
|
||||
}
|
||||
|
||||
private void doTest(@NonNls final String qClassName) throws Exception {
|
||||
doTest(new PerformAction() {
|
||||
public void performAction(VirtualFile rootDir, VirtualFile rootAfter) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user