mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -42,7 +42,8 @@ class Foo {
|
||||
|
||||
public YesNoRAMField getIsStateForceMailField() {
|
||||
return isStateForceMailField;
|
||||
}}
|
||||
}
|
||||
}
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -61,7 +62,8 @@ class Foo {
|
||||
|
||||
public boolean isStateForceMailField() {
|
||||
return isStateForceMailField;
|
||||
}}
|
||||
}
|
||||
}
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
+9
-3
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.refactoring.introduce.constant;
|
||||
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.refactoring.HelpID;
|
||||
@@ -93,9 +94,14 @@ public class GrIntroduceConstantHandler extends GrIntroduceFieldHandlerBase<GrIn
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GrAbstractInplaceIntroducer<GrIntroduceConstantSettings> getIntroducer(@NotNull GrIntroduceContext context,
|
||||
OccurrencesChooser.ReplaceChoice choice) {
|
||||
return new GrInplaceConstantIntroducer(context, choice);
|
||||
protected GrAbstractInplaceIntroducer<GrIntroduceConstantSettings> getIntroducer(@NotNull GrIntroduceContext context, @NotNull OccurrencesChooser.ReplaceChoice choice) {
|
||||
final Ref<GrIntroduceContext> contextRef = Ref.create(context);
|
||||
|
||||
if (context.getStringPart() != null) {
|
||||
extractStringPart(contextRef);
|
||||
}
|
||||
|
||||
return new GrInplaceConstantIntroducer(contextRef.get(), choice);
|
||||
}
|
||||
|
||||
private static class ConstantChecker extends GroovyRecursiveElementVisitor {
|
||||
|
||||
+2
-14
@@ -220,9 +220,6 @@ public class GrIntroduceParameterHandler implements RefactoringActionHandler, Me
|
||||
for (PsiElement element : context.getOccurrences()) {
|
||||
occurrences.add(createRange(document, element));
|
||||
}
|
||||
RangeMarker expressionRangeMarker = createRange(document, context.getExpression());
|
||||
RangeMarker stringPartRangeMarker = createRange(document, context.getStringPart());
|
||||
RangeMarker varRangeMarker = createRange(document, context.getVar());
|
||||
|
||||
GrExpressionWrapper expr = new GrExpressionWrapper(GroovyIntroduceParameterUtil.findExpr(settings));
|
||||
|
||||
@@ -249,8 +246,7 @@ public class GrIntroduceParameterHandler implements RefactoringActionHandler, Me
|
||||
GrVariable parameter = pointer != null ? pointer.getElement() : null;
|
||||
|
||||
if (parameter != null) {
|
||||
GrInplaceIntroducer introducer = getIntroducer(parameter, context, settings, occurrences, varRangeMarker, expressionRangeMarker, stringPartRangeMarker,
|
||||
expr);
|
||||
GrInplaceIntroducer introducer = getIntroducer(parameter, context, settings, occurrences, expr);
|
||||
PsiDocumentManager.getInstance(info.getProject()).doPostponedOperationsAndUnblockDocument(context.getEditor().getDocument());
|
||||
introducer.performInplaceRefactoring(introducer.suggestNames(context));
|
||||
}
|
||||
@@ -263,11 +259,7 @@ public class GrIntroduceParameterHandler implements RefactoringActionHandler, Me
|
||||
GrIntroduceContext context,
|
||||
GrIntroduceParameterSettings settings,
|
||||
List<RangeMarker> occurrences,
|
||||
RangeMarker varRangeMarker,
|
||||
RangeMarker expressionRangeMarker,
|
||||
RangeMarker stringPartRangeMarker,
|
||||
GrExpressionWrapper expr) {
|
||||
//return new GrInplaceVariableIntroducer(parameter, context.getEditor(), context.getProject(), REFACTORING_NAME, occurrences, parameter);
|
||||
return new GrInplaceParameterIntroducer(parameter, context.getEditor(), context.getProject(), REFACTORING_NAME, occurrences, context.getPlace(), settings, expr);
|
||||
}
|
||||
|
||||
@@ -298,11 +290,7 @@ public class GrIntroduceParameterHandler implements RefactoringActionHandler, Me
|
||||
}
|
||||
|
||||
private static boolean isInplace(IntroduceParameterInfo info, Editor editor) {
|
||||
GrExpression expr = GroovyIntroduceParameterUtil.findExpr(info);
|
||||
GrVariable var = GroovyIntroduceParameterUtil.findVar(info);
|
||||
StringPartInfo stringPart = info.getStringPartInfo();
|
||||
|
||||
return (expr != null || var != null || stringPart != null) && GrIntroduceHandlerBase.isInplace(editor, info.getContext());
|
||||
return GroovyIntroduceParameterUtil.findExpr(info) != null && GrIntroduceHandlerBase.isInplace(editor, info.getContext());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,9 @@ public class PyMethodMayBeStaticInspection extends PyInspection {
|
||||
if (!supers.isEmpty()) return;
|
||||
final Collection<PyFunction> overrides = PyOverridingMethodsSearch.search(node, true).findAll();
|
||||
if (!overrides.isEmpty()) return;
|
||||
if (PyUtil.isDecoratedAsAbstract(node) || node.getModifier() != null) return;
|
||||
final PyDecoratorList decoratorList = node.getDecoratorList();
|
||||
if (decoratorList != null) return;
|
||||
if (node.getModifier() != null) return;
|
||||
final Property property = containingClass.findPropertyByCallable(node);
|
||||
if (property != null) return;
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
def bar(f):
|
||||
def wrapper(self, *args, **kwargs):
|
||||
print('running {cls}.{method}'.format(cls=type(self).__name__,
|
||||
method=f.__name__))
|
||||
return f(self, *args, **kwargs)
|
||||
return wrapper
|
||||
|
||||
|
||||
class C(object):
|
||||
@bar
|
||||
def foo(self): # False positive: self is used by @bar
|
||||
return 'foo'
|
||||
|
||||
|
||||
C().foo()
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.inspections;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import com.jetbrains.python.PythonTestUtil;
|
||||
import com.jetbrains.python.fixtures.PyTestCase;
|
||||
|
||||
@@ -23,6 +24,7 @@ import java.util.Arrays;
|
||||
/**
|
||||
* User: ktisha
|
||||
*/
|
||||
@TestDataPath("$CONTENT_ROOT/../testData/inspections/PyMethodMayBeStaticInspection/")
|
||||
public class PyMethodMayBeStaticInspectionTest extends PyTestCase {
|
||||
|
||||
public void testTruePositive() {
|
||||
@@ -65,6 +67,10 @@ public class PyMethodMayBeStaticInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testDecorated() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testOverwrittenMethod() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user