diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
index d516d5b2f74e..8d58ec8be56e 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
@@ -546,9 +546,11 @@ public class BuildManager implements ApplicationComponent{
runCommand(new Runnable() {
@Override
public void run() {
+ LOG.info("Cancelling preloaded process for project " + projectPath);
Pair, OSProcessHandler> pair = takePreloadedProcess(projectPath);
if (pair != null) {
final RequestFuture future = pair.first;
+ LOG.info("Cancelling preloaded process, sessionID=" + future.getRequestID());
myMessageDispatcher.cancelSession(future.getRequestID());
// waiting for preloaded process from project's task queue guarantees no build is started for this project
// until this one gracefully exits and closes all its storages
@@ -559,6 +561,9 @@ public class BuildManager implements ApplicationComponent{
}
});
}
+ else {
+ LOG.info("takePreloadedProcess() returned null");
+ }
}
});
}
@@ -675,7 +680,7 @@ public class BuildManager implements ApplicationComponent{
try {
if (project.isDisposed()) {
if (usingPreloadedProcess) {
- future.cancel(true);
+ future.cancel(false);
}
else {
return;
@@ -709,24 +714,23 @@ public class BuildManager implements ApplicationComponent{
processHandler.startNotify();
}
- final boolean terminated = processHandler.waitFor();
- if (terminated) {
- final int exitValue = processHandler.getProcess().exitValue();
- if (exitValue != 0) {
- final StringBuilder msg = new StringBuilder();
- msg.append("Abnormal build process termination: ");
- if (errorsOnLaunch.length() > 0) {
- msg.append("\n").append(errorsOnLaunch);
- }
- else {
- msg.append("unknown error");
- }
- handler.handleFailure(sessionId, CmdlineProtoUtil.createFailure(msg.toString(), null));
+ while (!processHandler.waitFor()) {
+ LOG.info("processHandler.waitFor() returned false for session " + sessionId + ", continue waiting");
+ }
+
+ final int exitValue = processHandler.getProcess().exitValue();
+ if (exitValue != 0) {
+ final StringBuilder msg = new StringBuilder();
+ msg.append("Abnormal build process termination: ");
+ if (errorsOnLaunch.length() > 0) {
+ msg.append("\n").append(errorsOnLaunch);
}
+ else {
+ msg.append("unknown error");
+ }
+ handler.handleFailure(sessionId, CmdlineProtoUtil.createFailure(msg.toString(), null));
}
- else {
- handler.handleFailure(sessionId, CmdlineProtoUtil.createFailure("Disconnected from build process", null));
- }
+
}
catch (Throwable e) {
execFailure = e;
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java
index 59c19f0ad7fe..8bf11a9302e2 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildMessageDispatcher.java
@@ -75,11 +75,19 @@ class BuildMessageDispatcher extends SimpleChannelInboundHandlerAdapter findExpression(PsiElement element, boolean allowMethodCalls) {
PsiElement expression = null;
PsiElement parent = element.getParent();
- if (parent instanceof PsiLiteralExpression) {
+ if (parent instanceof PsiLiteralExpression || parent instanceof PsiLambdaExpression) {
element = parent;
parent = parent.getParent();
}
@@ -95,7 +95,7 @@ public class JavaEditorTextProviderImpl implements EditorTextProvider {
}
else if (parent instanceof PsiReferenceExpression) {
final PsiElement pparent = parent.getParent();
- if (pparent instanceof PsiCallExpression) {
+ if (parent instanceof PsiMethodReferenceExpression || pparent instanceof PsiCallExpression) {
parent = pparent;
}
else if (pparent instanceof PsiReferenceExpression) {
@@ -116,11 +116,19 @@ public class JavaEditorTextProviderImpl implements EditorTextProvider {
expression = parent;
}
}
- else if (allowMethodCalls) {
- PsiElement e = PsiTreeUtil.getParentOfType(element, PsiVariable.class, PsiExpression.class, PsiMethod.class);
- if (e instanceof PsiNewExpression) {
- if (((PsiNewExpression)e).getAnonymousClass() == null) {
- expression = e;
+ else {
+ PsiElement castExpr = PsiTreeUtil.getParentOfType(element, PsiTypeCastExpression.class);
+ if (castExpr != null) {
+ if (allowMethodCalls || !DebuggerUtils.hasSideEffects(castExpr)) {
+ expression = castExpr;
+ }
+ }
+ else if (allowMethodCalls) {
+ PsiElement e = PsiTreeUtil.getParentOfType(element, PsiVariable.class, PsiExpression.class, PsiMethod.class);
+ if (e instanceof PsiNewExpression) {
+ if (((PsiNewExpression)e).getAnonymousClass() == null) {
+ expression = e;
+ }
}
}
}
diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/evaluation/EvaluateExceptionUtil.java b/java/debugger/openapi/src/com/intellij/debugger/engine/evaluation/EvaluateExceptionUtil.java
index 4d5536c37c4e..bbf200afdeff 100644
--- a/java/debugger/openapi/src/com/intellij/debugger/engine/evaluation/EvaluateExceptionUtil.java
+++ b/java/debugger/openapi/src/com/intellij/debugger/engine/evaluation/EvaluateExceptionUtil.java
@@ -16,6 +16,7 @@
package com.intellij.debugger.engine.evaluation;
import com.intellij.debugger.DebuggerBundle;
+import com.intellij.openapi.util.text.StringUtil;
import com.sun.jdi.*;
/**
@@ -81,7 +82,12 @@ public class EvaluateExceptionUtil {
return th.getMessage();
}
else {
- return th.getClass().getName() + " : " + (th.getMessage() != null ? th.getMessage() : "");
+ StringBuilder res = new StringBuilder(th.getClass().getName());
+ String message = th.getMessage();
+ if (!StringUtil.isEmpty(message)) {
+ res.append(" : ").append(message);
+ }
+ return res.toString();
}
}
}
diff --git a/java/execution/impl/src/com/intellij/execution/JavaRunConfigurationExtensionManager.java b/java/execution/impl/src/com/intellij/execution/JavaRunConfigurationExtensionManager.java
index 556027008efd..9ea8e4058f13 100644
--- a/java/execution/impl/src/com/intellij/execution/JavaRunConfigurationExtensionManager.java
+++ b/java/execution/impl/src/com/intellij/execution/JavaRunConfigurationExtensionManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,7 +17,6 @@ package com.intellij.execution;
import com.intellij.execution.configuration.RunConfigurationExtensionsManager;
import com.intellij.execution.configurations.RunConfigurationBase;
-import com.intellij.execution.configurations.RuntimeConfigurationException;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -26,7 +25,7 @@ import com.intellij.openapi.diagnostic.Logger;
* Date: 10/4/11
*/
public class JavaRunConfigurationExtensionManager extends RunConfigurationExtensionsManager {
- private static final Logger LOG = Logger.getInstance("#" + RunConfigurationExtension.class.getName());
+ private static final Logger LOG = Logger.getInstance(RunConfigurationExtension.class);
public JavaRunConfigurationExtensionManager() {
super(RunConfigurationExtension.EP_NAME);
@@ -36,7 +35,7 @@ public class JavaRunConfigurationExtensionManager extends RunConfigurationExtens
return ServiceManager.getService(JavaRunConfigurationExtensionManager.class);
}
- public static void checkConfigurationIsValid(RunConfigurationBase configuration) throws RuntimeConfigurationException {
+ public static void checkConfigurationIsValid(RunConfigurationBase configuration) {
try {
getInstance().validateConfiguration(configuration, false);
}
diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfiguration.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfiguration.java
index b736d9f0b127..de8bcbb84ae6 100644
--- a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfiguration.java
+++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -56,7 +56,7 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration myEnvs = new LinkedHashMap();
+ private final Map myEnvs = new LinkedHashMap();
public boolean PASS_PARENT_ENVS = true;
public ApplicationConfiguration(final String name, final Project project, ApplicationConfigurationType applicationConfigurationType) {
diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java
index fba68e43f396..e6e6a0037cee 100644
--- a/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java
+++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurationType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -33,10 +33,9 @@ import javax.swing.*;
public class ApplicationConfigurationType implements ConfigurationType {
private final ConfigurationFactory myFactory;
-
- /**reflection*/
public ApplicationConfigurationType() {
myFactory = new ConfigurationFactoryEx(this) {
+ @Override
public RunConfiguration createTemplateConfiguration(Project project) {
return new ApplicationConfiguration("", project, ApplicationConfigurationType.this);
}
@@ -48,18 +47,22 @@ public class ApplicationConfigurationType implements ConfigurationType {
};
}
+ @Override
public String getDisplayName() {
return ExecutionBundle.message("application.configuration.name");
}
+ @Override
public String getConfigurationTypeDescription() {
return ExecutionBundle.message("application.configuration.description");
}
+ @Override
public Icon getIcon() {
return AllIcons.RunConfigurations.Application;
}
+ @Override
public ConfigurationFactory[] getConfigurationFactories() {
return new ConfigurationFactory[]{myFactory};
}
@@ -87,6 +90,7 @@ public class ApplicationConfigurationType implements ConfigurationType {
}
+ @Override
@NotNull
@NonNls
public String getId() {
@@ -97,5 +101,4 @@ public class ApplicationConfigurationType implements ConfigurationType {
public static ApplicationConfigurationType getInstance() {
return ConfigurationTypeUtil.findConfigurationType(ApplicationConfigurationType.class);
}
-
}
diff --git a/java/java-impl/src/com/intellij/ide/util/gotoByName/DefaultSymbolNavigationContributor.java b/java/java-impl/src/com/intellij/ide/util/gotoByName/DefaultSymbolNavigationContributor.java
index a2256a79b850..24ada216c0d9 100644
--- a/java/java-impl/src/com/intellij/ide/util/gotoByName/DefaultSymbolNavigationContributor.java
+++ b/java/java-impl/src/com/intellij/ide/util/gotoByName/DefaultSymbolNavigationContributor.java
@@ -62,9 +62,11 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
PsiShortNamesCache cache = PsiShortNamesCache.getInstance(project);
+ Condition qualifiedMatcher = getQualifiedNameMatcher(pattern);
+
List result = new ArrayList();
for (PsiMethod method : cache.getMethodsByName(name, scope)) {
- if (!method.isConstructor() && isOpenable(method) && !hasSuperMethod(method, scope)) {
+ if (!method.isConstructor() && isOpenable(method) && !hasSuperMethod(method, scope, qualifiedMatcher)) {
result.add(method);
}
}
@@ -87,13 +89,14 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
return member.getContainingFile().getVirtualFile() != null;
}
- private static boolean hasSuperMethod(PsiMethod method, GlobalSearchScope scope) {
+ private static boolean hasSuperMethod(PsiMethod method, GlobalSearchScope scope, Condition qualifiedMatcher) {
PsiClass containingClass = method.getContainingClass();
if (containingClass == null) return false;
for (PsiMethod candidate : containingClass.findMethodsByName(method.getName(), true)) {
if (candidate.getContainingClass() != containingClass &&
PsiSearchScopeUtil.isInScope(scope, candidate) &&
+ qualifiedMatcher.value(candidate) &&
PsiSuperMethodImplUtil.isSuperMethodSmart(method, candidate)) {
return true;
}
@@ -118,20 +121,7 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
PsiShortNamesCache cache = PsiShortNamesCache.getInstance(scope.getProject());
String completePattern = parameters.getCompletePattern();
- final Condition qualifiedMatcher;
- if (completePattern.contains(".")) {
- final MinusculeMatcher matcher = new MinusculeMatcher("*" + StringUtil.replace(completePattern, ".", ".*"), NameUtil.MatchingCaseSensitivity.NONE);
- qualifiedMatcher = new Condition() {
- @Override
- public boolean value(PsiMember member) {
- String qualifiedName = PsiUtil.getMemberQualifiedName(member);
- return qualifiedName != null && matcher.matches(qualifiedName);
- }
- };
- } else {
- //noinspection unchecked
- qualifiedMatcher = Condition.TRUE;
- }
+ final Condition qualifiedMatcher = getQualifiedNameMatcher(completePattern);
//noinspection UnusedDeclaration
final Set collectedMethods = new THashSet();
@@ -163,13 +153,31 @@ public class DefaultSymbolNavigationContributor implements ChooseByNameContribut
Iterator iterator = collectedMethods.iterator();
while(iterator.hasNext()) {
PsiMethod method = iterator.next();
- if (!hasSuperMethod(method, scope) && !processor.process(method)) return;
+ if (!hasSuperMethod(method, scope, qualifiedMatcher) && !processor.process(method)) return;
ProgressManager.checkCanceled();
iterator.remove();
}
}
}
+ private static Condition getQualifiedNameMatcher(String completePattern) {
+ final Condition qualifiedMatcher;
+ if (completePattern.contains(".")) {
+ final MinusculeMatcher matcher = new MinusculeMatcher("*" + StringUtil.replace(completePattern, ".", ".*"), NameUtil.MatchingCaseSensitivity.NONE);
+ qualifiedMatcher = new Condition() {
+ @Override
+ public boolean value(PsiMember member) {
+ String qualifiedName = PsiUtil.getMemberQualifiedName(member);
+ return qualifiedName != null && matcher.matches(qualifiedName);
+ }
+ };
+ } else {
+ //noinspection unchecked
+ qualifiedMatcher = Condition.TRUE;
+ }
+ return qualifiedMatcher;
+ }
+
private static class MyComparator implements Comparator{
public static final MyComparator INSTANCE = new MyComparator();
diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
index b75d6687f8ac..78d3e73e7ea3 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
@@ -384,7 +384,7 @@ public class TypeConversionUtil {
return aClass != null &&
bClass != null &&
aClass.getManager().areElementsEquivalent(aClass, bClass) &&
- areSameArgumentTypes(aClass, resolveResult1.getSubstitutor(), resolveResult2.getSubstitutor());
+ areSameArgumentTypes(aClass, resolveResult1.getSubstitutor(), resolveResult2.getSubstitutor(), 1);
}
private static boolean areSameArgumentTypes(@NotNull PsiClass aClass, @NotNull PsiSubstitutor substitutor1, @NotNull PsiSubstitutor substitutor2) {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/NestedLevelsToCheckTypeArguments.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/NestedLevelsToCheckTypeArguments.java
new file mode 100644
index 000000000000..d82c192ffb68
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/NestedLevelsToCheckTypeArguments.java
@@ -0,0 +1,5 @@
+class ImmutableSet {
+ void foo(final ImmutableSet> of) {
+ Object types = (ImmutableSet>) of;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
index dececea84471..cc02f8e523be 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
@@ -430,6 +430,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
}
+ public void testNestedLevelsToCheckTypeArguments() throws Exception {
+ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
+ }
+
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
assertNotNull(collectionsClass);
diff --git a/java/java-tests/testSrc/com/intellij/navigation/ChooseByNameTest.groovy b/java/java-tests/testSrc/com/intellij/navigation/ChooseByNameTest.groovy
index 0a5b65deb372..cbe18110f49a 100644
--- a/java/java-tests/testSrc/com/intellij/navigation/ChooseByNameTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/navigation/ChooseByNameTest.groovy
@@ -239,6 +239,14 @@ class Intf {
assert !(sdkRun in noLibs)
}
+ public void "test super method not matching query qualifier"() {
+ def base = myFixture.addClass("class Base { void xpaint() {} }").methods[0]
+ def sub = myFixture.addClass("class Sub extends Base { void xpaint() {} }").methods[0]
+
+ assert getPopupElements(new GotoSymbolModel2(project), 'Ba.xpai', false) == [base]
+ assert getPopupElements(new GotoSymbolModel2(project), 'Su.xpai', false) == [sub]
+ }
+
private List

-
-