mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
Java: take care to avoid calling a different method when converting static method to instance method (IDEA-275602)
GitOrigin-RevId: 644b0312256a7cd2859f18ba261bfc83addfb672
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a17097bea4
commit
db923128c6
@@ -0,0 +1,16 @@
|
||||
class Test {
|
||||
int i;
|
||||
void run() {}
|
||||
|
||||
static Test <caret>getDelegate(Test test) {
|
||||
return new Test() {
|
||||
int i;
|
||||
|
||||
@Override
|
||||
void run() {
|
||||
System.out.println(test.i);
|
||||
test.run();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
class Test {
|
||||
int i;
|
||||
|
||||
Test getDelegate() {
|
||||
return new Test() {
|
||||
int i;
|
||||
|
||||
@Override
|
||||
void run() {
|
||||
System.out.println(Test.this.i);
|
||||
Test.this.run();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void run() {}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
int i;
|
||||
void run() {}
|
||||
}
|
||||
class Other {
|
||||
static void <caret>handle(Test test) {
|
||||
System.out.println(test.i);
|
||||
test.run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class Test {
|
||||
int i;
|
||||
|
||||
void handle() {
|
||||
System.out.println(i);
|
||||
run();
|
||||
}
|
||||
|
||||
void run() {}
|
||||
}
|
||||
class Other {
|
||||
}
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.refactoring.convertToInstanceMethod;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -25,6 +11,9 @@ public class ConvertToInstance8MethodTest extends ConvertToInstanceMethodTest {
|
||||
return "/refactoring/convertToInstance8Method/";
|
||||
}
|
||||
|
||||
public void testConflictingMembers() { doTest(0); }
|
||||
public void testNoConflictingMembers() { doTest(0); }
|
||||
|
||||
public void testThisInsteadOfNoQualifier() {
|
||||
doTest(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user