mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: create dependent constant from usage in interface correctly (IDEA-337008)
GitOrigin-RevId: 3afbc697d94e692278ea74fe73fa3bc8982e50af
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5fb47bfc3e
commit
38649ac539
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.lang.java.actions
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightUtil.positionCursor
|
||||
@@ -50,14 +50,8 @@ internal class JavaFieldRenderer(
|
||||
private val modifiersToRender: Collection<JvmModifier>
|
||||
get() {
|
||||
return if (constantField) {
|
||||
if (targetClass.isInterface) {
|
||||
// interface fields are public static final implicitly, so modifiers don't have to be rendered
|
||||
request.modifiers - constantModifiers - visibilityModifiers
|
||||
}
|
||||
else {
|
||||
// render static final explicitly
|
||||
request.modifiers + constantModifiers
|
||||
}
|
||||
// render static final explicitly
|
||||
request.modifiers + constantModifiers
|
||||
}
|
||||
else {
|
||||
// render as is
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// "Create constant field 'SOME_REGEXP'" "true-preview"
|
||||
interface IntroduceConstant {
|
||||
String SOME_REGEXP = ;
|
||||
String SOME_PATTERN = SOME_REGEXP;
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// "Create constant field 'SOME_REGEXP'" "true-preview"
|
||||
interface IntroduceConstant {
|
||||
String SOME_PATTERN = SOME_RE<caret>GEXP;
|
||||
}
|
||||
+2
-3
@@ -64,9 +64,8 @@ public class CreateFieldFromUsageTest extends LightQuickFixTestCase {
|
||||
doSingleTest();
|
||||
}
|
||||
|
||||
public void testDependantConstant() {
|
||||
doSingleTest();
|
||||
}
|
||||
public void testDependantConstant() { doSingleTest(); }
|
||||
public void testDependantConstant2() { doSingleTest(); }
|
||||
|
||||
public void testArrayBraces() {
|
||||
doSingleTest();
|
||||
|
||||
Reference in New Issue
Block a user