mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
inplace introduce: ensure that no refs on newly created var from expression would participate in the further processing
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
class Test {
|
||||
private static final String FOO = "foo";
|
||||
public void method(Map<Object, Object> args) {
|
||||
System.out.println(FOO);
|
||||
System.out.println("fo<caret>o");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
class Test {
|
||||
private static final String FOO = "foo";
|
||||
public static final String BAR = "foo";
|
||||
|
||||
public void method(Map<Object, Object> args) {
|
||||
System.out.println(FOO);
|
||||
System.out.println(BAR);
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,16 @@ public class InplaceIntroduceConstantTest extends AbstractInplaceIntroduceTest {
|
||||
});
|
||||
}
|
||||
|
||||
public void testConflictingConstantName() throws Exception {
|
||||
|
||||
doTest(new Pass<AbstractInplaceIntroducer>() {
|
||||
@Override
|
||||
public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
|
||||
type("BAR");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testEscapePosition() throws Exception {
|
||||
doTestEscape();
|
||||
}
|
||||
|
||||
@@ -259,12 +259,13 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
|
||||
@Override
|
||||
protected void addReferenceAtCaret(Collection<PsiReference> refs) {
|
||||
//super.addReferenceAtCaret(refs);
|
||||
final V variable = getLocalVariable();
|
||||
if (variable != null) {
|
||||
for (PsiReference reference : ReferencesSearch.search(variable)) {
|
||||
refs.add(reference);
|
||||
}
|
||||
} else {
|
||||
refs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user