diff --git a/.idea/runConfigurations/IDEA.xml b/.idea/runConfigurations/IDEA.xml
index dfeffe932b26..db49c1719e0b 100644
--- a/.idea/runConfigurations/IDEA.xml
+++ b/.idea/runConfigurations/IDEA.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/bin/scripts/unix/idea.sh b/bin/scripts/unix/idea.sh
index 08811358451a..7df94672fb65 100755
--- a/bin/scripts/unix/idea.sh
+++ b/bin/scripts/unix/idea.sh
@@ -147,17 +147,6 @@ BITS=$?
"$RM" -f "$VERSION_LOG"
test ${BITS} -eq 0 && BITS="64" || BITS=""
-#----------------------------------------------------------------------
-# Set platform enviroment variables for IDE
-#----------------------------------------------------------------------
-if [ "$OS_TYPE" = "Linux" ] ; then
- case "$XDG_CURRENT_DESKTOP" in
- *Unity*)
- export JAYATANA_FORCE=true
- ;;
- esac
-fi
-
# ---------------------------------------------------------------------
# Collect JVM options and IDE properties.
# ---------------------------------------------------------------------
diff --git a/build/dependencies/gradle.properties b/build/dependencies/gradle.properties
index 4da6c636deb9..9143839a3240 100644
--- a/build/dependencies/gradle.properties
+++ b/build/dependencies/gradle.properties
@@ -1,4 +1,4 @@
# The file might be automatically updated. Comments and empty lines will be removed.
kotlinPluginBuild=1.1.2-release-IJ2017.2-1
jetSignBuild=42.30
-jdkBuild=u152b915.1
+jdkBuild=u152b927.1
diff --git a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/ChainSearcher.java b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/ChainSearcher.java
index a741b77035eb..d2afd2168294 100644
--- a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/ChainSearcher.java
+++ b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/ChainSearcher.java
@@ -48,7 +48,7 @@ public class ChainSearcher {
if (methods == null) {
methods = currentMethods;
} else {
- methods.addAll(currentMethods);
+ methods = unionSortedSet(currentMethods, methods);
}
}
return new SearchInitializer(methods, context);
@@ -169,4 +169,13 @@ public class ChainSearcher {
result.add(newChain);
}
}
+
+ private static SortedSet unionSortedSet(SortedSet s1, SortedSet s2) {
+ if (s1.isEmpty()) return s2;
+ if (s2.isEmpty()) return s1;
+ TreeSet result = new TreeSet<>();
+ result.addAll(s1);
+ result.addAll(s2);
+ return result;
+ }
}
\ No newline at end of file
diff --git a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java
index 12d24b20b99f..4aafcfc9ac7f 100644
--- a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java
+++ b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java
@@ -57,7 +57,6 @@ public class ChainCompletionNewVariableLookupElement extends LookupElement {
@Override
public void handleInsert(final InsertionContext context) {
final PsiFile file = context.getFile();
- ((PsiJavaFile)file).importClass(myQualifierClass);
final PsiElement caretElement = ObjectUtils.notNull(file.findElementAt(context.getEditor().getCaretModel().getOffset()));
final PsiStatement statement = PsiTreeUtil.getParentOfType(caretElement.getPrevSibling(), PsiStatement.class, false);
@@ -67,8 +66,8 @@ public class ChainCompletionNewVariableLookupElement extends LookupElement {
final PsiStatement newVarDeclarationTemplate = elementFactory.createVariableDeclarationStatement(myNewVarName,
elementFactory.createType(myQualifierClass),
elementFactory.createExpressionFromText(PsiKeyword.NULL, null));
-
- statement.getParent().addBefore(newVarDeclarationTemplate, statement);
+ PsiElement varDeclaration = statement.getParent().addBefore(newVarDeclarationTemplate, statement);
+ JavaCodeStyleManager.getInstance(context.getProject()).shortenClassReferences(varDeclaration);
}
@NotNull
diff --git a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java
index 518d22b9f75d..f1ea73d6fe5d 100644
--- a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java
+++ b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/context/ChainCompletionContext.java
@@ -246,7 +246,7 @@ public class ChainCompletionContext {
if (element instanceof PsiMethod) {
return ((PsiMethod)element).getReturnType();
}
- throw new AssertionError(element);
+ return null;
}
public static boolean isWidelyUsed(@NotNull PsiType type) {
diff --git a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurationProducer.java b/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurationProducer.java
index 65a8b514d396..94458b9a1a65 100644
--- a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurationProducer.java
+++ b/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurationProducer.java
@@ -86,8 +86,8 @@ public class AppletConfigurationProducer extends JavaRuntimeConfigurationProduce
private static boolean isAppletClass(final PsiClass aClass, final PsiManager manager) {
+ if (DumbService.isDumb(manager.getProject())) return false;
if (!PsiClassUtil.isRunnableClass(aClass, true)) return false;
- if (DumbService.isDumb(manager.getProject())) return true;
final Module module = JavaExecutionUtil.findModule(aClass);
final GlobalSearchScope scope = module != null
diff --git a/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java b/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java
index 7065d88883c4..55dc8a4a3b75 100644
--- a/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java
+++ b/java/idea-ui/src/com/intellij/jarRepository/RepositoryAttachDialog.java
@@ -47,14 +47,24 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.aether.ArtifactRepositoryManager;
import org.jetbrains.jps.model.library.JpsMavenRepositoryLibraryDescriptor;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.text.JTextComponent;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -118,6 +128,12 @@ public class RepositoryAttachDialog extends DialogWrapper {
protected void textChanged(DocumentEvent e) {
ApplicationManager.getApplication().invokeLater(() -> {
if (myProgressIcon.isDisposed()) return;
+ ApplicationManager.getApplication().invokeLater(() -> {
+ if (myProgressIcon.isDisposed()) return;
+ handleMavenDependencyInsertion(e, textField);
+ updateComboboxSelection(false);
+ });
+
updateComboboxSelection(false);
});
}
@@ -163,6 +179,30 @@ public class RepositoryAttachDialog extends DialogWrapper {
init();
}
+ private static void handleMavenDependencyInsertion(DocumentEvent e, JTextField textField) {
+ if (e.getType() == DocumentEvent.EventType.INSERT) {
+ String text = textField.getText();
+ if (isMvnDependency(text)) {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ try {
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ try {
+ Document document = builder.parse(new InputSource(new StringReader(text)));
+ String mavenCoordinates = extractMavenCoordinates(document);
+ if (mavenCoordinates != null) {
+ textField.setText(mavenCoordinates);
+ }
+ }
+ catch (SAXException | IOException ignored) {
+ }
+ }
+ catch (ParserConfigurationException ignored) {
+ }
+ }
+ }
+ }
+
public boolean getAttachJavaDoc() {
return myJavaDocCheckBox.isSelected();
}
@@ -348,4 +388,46 @@ public class RepositoryAttachDialog extends DialogWrapper {
private void createUIComponents() {
myProgressIcon = new AsyncProcessIcon("Progress");
}
+
+ private static boolean isMvnDependency(String text) {
+ String trimmed = text.trim();
+ if (trimmed.startsWith("") && trimmed.endsWith("")) {
+ return true;
+ }
+ return false;
+ }
+
+ @Nullable
+ private static String extractMavenCoordinates(Document document) {
+ String groupId = getGroupId(document);
+ String artifactId = getArtifactId(document);
+ if (groupId.isEmpty() && artifactId.isEmpty()) {
+ return null;
+ }
+ String version = getVersion(document);
+ String classifier = getClassifier(document);
+ String gradleClassifier = classifier.isEmpty() ? "" : ":" + classifier;
+ return groupId + ":" + artifactId + ":" + version + gradleClassifier;
+ }
+
+ private static String getVersion(@NotNull Document document) {
+ return firstOrEmpty(document.getElementsByTagName("version"));
+ }
+
+ private static String getArtifactId(@NotNull Document document) {
+ return firstOrEmpty(document.getElementsByTagName("artifactId"));
+ }
+
+ private static String getGroupId(@NotNull Document document) {
+ return firstOrEmpty(document.getElementsByTagName("groupId"));
+ }
+
+ private static String getClassifier(@NotNull Document document) {
+ return firstOrEmpty(document.getElementsByTagName("classifier"));
+ }
+
+ private static String firstOrEmpty(@NotNull NodeList list) {
+ Node first = list.item(0);
+ return first != null ? first.getTextContent() : "";
+ }
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java
index 2b6589177318..00035f38a964 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/bytecodeAnalysis/ClassDataIndexer.java
@@ -71,6 +71,7 @@ public class ClassDataIndexer implements VirtualFileGist.GistCalculator