mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+4
-1
@@ -885,8 +885,9 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
}
|
||||
|
||||
for (UsageInfo usageInfo : usagesSet) {
|
||||
final PsiElement element = usageInfo.getElement();
|
||||
if (usageInfo instanceof OverriderUsageInfo) {
|
||||
final PsiMethod method = (PsiMethod)usageInfo.getElement();
|
||||
final PsiMethod method = (PsiMethod)element;
|
||||
final PsiMethod baseMethod = ((OverriderUsageInfo)usageInfo).getBaseMethod();
|
||||
final int delta = baseMethod.getParameterList().getParametersCount() - method.getParameterList().getParametersCount();
|
||||
if (delta > 0) {
|
||||
@@ -895,6 +896,8 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
conflictDescriptions.putValue(baseMethod, "Implicit last parameter should not be deleted");
|
||||
}
|
||||
}
|
||||
} else if (element instanceof PsiMethodReferenceExpression) {
|
||||
conflictDescriptions.putValue(element, "Changed method is used in method reference");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -266,6 +266,9 @@ class JavaChangeSignatureUsageSearcher {
|
||||
else if (element instanceof XmlElement) {
|
||||
result.add(new MoveRenameUsageInfo(reference, method));
|
||||
}
|
||||
else if (element instanceof PsiMethodReferenceExpression) {
|
||||
result.add(new UsageInfo(reference));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
@@ -1,6 +1,7 @@
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.light.LightMemberReference;
|
||||
import com.intellij.psi.search.PsiSearchScopeUtil;
|
||||
@@ -8,6 +9,7 @@ import com.intellij.psi.search.SearchRequestCollector;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.PairProcessor;
|
||||
import com.intellij.util.Processor;
|
||||
|
||||
@@ -72,6 +74,24 @@ public class ConstructorReferencesSearchHelper {
|
||||
};
|
||||
|
||||
ReferencesSearch.searchOptimized(aClass, searchScope, ignoreAccessScope, collector, true, processor1);
|
||||
if (PsiUtil.getLanguageLevel(aClass).isAtLeast(LanguageLevel.JDK_1_8)) {
|
||||
ReferencesSearch.search(aClass).forEach(new Processor<PsiReference>() {
|
||||
@Override
|
||||
public boolean process(PsiReference reference) {
|
||||
final PsiElement element = reference.getElement();
|
||||
if (element != null) {
|
||||
final PsiElement parent = element.getParent();
|
||||
if (parent instanceof PsiMethodReferenceExpression &&
|
||||
((PsiMethodReferenceExpression)parent).getReferenceNameElement() instanceof PsiKeyword) {
|
||||
if (((PsiMethodReferenceExpression)parent).isReferenceTo(constructor)) {
|
||||
processor.process(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
final boolean constructorCanBeCalledImplicitly = constructor.getParameterList().getParametersCount() == 0;
|
||||
// search usages like "this(..)"
|
||||
|
||||
@@ -470,7 +470,18 @@ public class TypeConversionUtil {
|
||||
|| ltypeRank == BOOL_RANK && rtypeRank == BOOL_RANK;
|
||||
}
|
||||
else {
|
||||
if (isPrimitiveAndNotNull(ltype) || isPrimitiveAndNotNull(rtype)) return false;
|
||||
if (isPrimitiveAndNotNull(ltype)) {
|
||||
if (rtype instanceof PsiClassType && ((PsiClassType)rtype).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_7)) {
|
||||
return areTypesConvertible(ltype, rtype);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (isPrimitiveAndNotNull(rtype)) {
|
||||
if (ltype instanceof PsiClassType && ((PsiClassType)ltype).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_7)) {
|
||||
return areTypesConvertible(rtype, ltype);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
isApplicable = areTypesConvertible(ltype, rtype) || areTypesConvertible(rtype, ltype);
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -77,6 +77,10 @@ public class PsiLambdaExpressionImpl extends ExpressionPsiElement implements Psi
|
||||
@Override
|
||||
public void visitClass(PsiClass aClass) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLambdaExpression(PsiLambdaExpression expression) {
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
Object o = null;
|
||||
if (o == 1) {}
|
||||
if (1 == o) {}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
interface I {
|
||||
Integer _();
|
||||
}
|
||||
|
||||
interface I1 {
|
||||
String _();
|
||||
}
|
||||
|
||||
class Test {
|
||||
I i = () -> {
|
||||
I1 i1 = () -> {return "";};
|
||||
return 1;
|
||||
};
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class ConstructorUsages {
|
||||
ConstructorUsages() {
|
||||
}
|
||||
|
||||
void foo() {
|
||||
BlahBlah<ConstructorUsages> blahBlah = ConstructorUsages::new;
|
||||
}
|
||||
}
|
||||
interface BlahBlah<T> {
|
||||
T foo();
|
||||
}
|
||||
+1
@@ -162,4 +162,5 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
|
||||
public void testMethodReferences() throws Exception { doTest(false, true, false); }
|
||||
public void testUsedMethodsByMethodReferences() throws Exception { doTest(true, true, false); }
|
||||
public void testLambdaExpressions() throws Exception { doTest(false, true, false); }
|
||||
public void testJava7CastConventions() throws Exception { doTest(false, true, false); }
|
||||
}
|
||||
|
||||
+4
@@ -157,6 +157,10 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNestedLambdas() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
|
||||
}
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.lambda;
|
||||
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.search.searches.MethodReferencesSearch;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 10/15/12
|
||||
*/
|
||||
public class MethodReferencesFindUsagesTest extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/methodRef/findUsages/";
|
||||
|
||||
|
||||
|
||||
public void testConstructorUsages() throws Exception {
|
||||
final String testName = getTestName(false);
|
||||
configureByFile(BASE_PATH + testName + ".java");
|
||||
|
||||
final PsiClass aClass = getJavaFacade().findClass(testName);
|
||||
assertNotNull(aClass);
|
||||
final PsiMethod[] constructors = aClass.getConstructors();
|
||||
assertEquals(constructors.length, 1);
|
||||
Collection<PsiReference> references = MethodReferencesSearch.search(constructors[0]).findAll();
|
||||
assertEquals(1, references.size());
|
||||
}
|
||||
}
|
||||
+4
@@ -90,6 +90,10 @@ public class MavenArtifactSearchPanel extends JPanel {
|
||||
add(mySearchField, BorderLayout.NORTH);
|
||||
JScrollPane pane = ScrollPaneFactory.createScrollPane(myResultList);
|
||||
pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); // Don't remove this line.
|
||||
// Without VERTICAL_SCROLLBAR_ALWAYS policy our custom layout
|
||||
// works incorrectly, see http://youtrack.jetbrains.com/issue/IDEA-72986
|
||||
|
||||
add(pane, BorderLayout.CENTER);
|
||||
|
||||
mySearchField.getDocument().addDocumentListener(new DocumentAdapter() {
|
||||
|
||||
Reference in New Issue
Block a user