Merge remote-tracking branch 'origin/master'
authorLiana.Bakradze <liana.bakradze@jetbrains.com>
Thu, 6 Oct 2016 15:24:19 +0000 (18:24 +0300)
committerLiana.Bakradze <liana.bakradze@jetbrains.com>
Thu, 6 Oct 2016 15:24:19 +0000 (18:24 +0300)
63 files changed:
.idea/libraries/Gradle.xml
build/groovy/org/jetbrains/intellij/build/CommunityLibraryLicenses.groovy
java/java-analysis-impl/src/com/intellij/codeInspection/sameParameterValue/SameParameterValueInspectionBase.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSessionContainer.java
java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/PsiGraphInferenceHelper.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/graphInference/ChainedInference.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/highlighting/ReturnTypeCompatibility.java
java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/InferTypeParametersFromFunctionalInterfaceInputs.java [new file with mode: 0644]
java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java
platform/core-api/src/com/intellij/openapi/editor/colors/TextAttributesKey.java
platform/core-api/src/com/intellij/openapi/editor/markup/TextAttributes.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java
platform/editor-ui-ex/src/com/intellij/openapi/editor/colors/impl/TextAttributesReader.java
platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
platform/lang-impl/src/com/intellij/application/options/colors/TextAttributesDescription.java
platform/lang-impl/src/com/intellij/codeInspection/ex/SeverityEditorDialog.java
platform/platform-impl/src/com/intellij/openapi/editor/colors/impl/EditorColorsManagerImpl.java
platform/platform-impl/src/com/intellij/ui/ComboBoxCompositeEditor.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImplTest.java
platform/platform-tests/testSrc/com/intellij/openapi/editor/colors/impl/TextAttributesReaderTest.java
plugins/gradle/lib/gradle-2.14.1-src.zip [moved from plugins/gradle/lib/gradle-2.13-src.zip with 71% similarity]
plugins/gradle/lib/gradle-base-services-2.14.1.jar [moved from plugins/gradle/lib/gradle-base-services-2.13.jar with 52% similarity]
plugins/gradle/lib/gradle-base-services-groovy-2.14.1.jar [moved from plugins/gradle/lib/gradle-base-services-groovy-2.13.jar with 81% similarity]
plugins/gradle/lib/gradle-cli-2.14.1.jar [moved from plugins/gradle/lib/gradle-cli-2.13.jar with 86% similarity]
plugins/gradle/lib/gradle-core-2.14.1.jar [moved from plugins/gradle/lib/gradle-core-2.13.jar with 58% similarity]
plugins/gradle/lib/gradle-logging-2.14.1.jar [new file with mode: 0644]
plugins/gradle/lib/gradle-messaging-2.13.jar [deleted file]
plugins/gradle/lib/gradle-messaging-2.14.1.jar [new file with mode: 0644]
plugins/gradle/lib/gradle-model-core-2.14.1.jar [moved from plugins/gradle/lib/gradle-model-core-2.13.jar with 59% similarity]
plugins/gradle/lib/gradle-model-groovy-2.14.1.jar [moved from plugins/gradle/lib/gradle-model-groovy-2.13.jar with 79% similarity]
plugins/gradle/lib/gradle-native-2.14.1.jar [moved from plugins/gradle/lib/gradle-native-2.13.jar with 74% similarity]
plugins/gradle/lib/gradle-process-services-2.14.1.jar [new file with mode: 0644]
plugins/gradle/lib/gradle-resources-2.14.1.jar [moved from plugins/gradle/lib/gradle-resources-2.13.jar with 66% similarity]
plugins/gradle/lib/gradle-tooling-api-2.14.1.jar [moved from plugins/gradle/lib/gradle-tooling-api-2.13.jar with 50% similarity]
plugins/gradle/lib/gradle-wrapper-2.14.1.jar [moved from plugins/gradle/lib/gradle-wrapper-2.13.jar with 82% similarity]
plugins/gradle/resources/fileTemplates/internal/Gradle Build Script with wrapper.gradle.ft
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/DistributionFactoryExt.java
plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.13.jar with 63% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-ide-2.13.jar [deleted file]
plugins/gradle/tooling-extension-api/lib/gradle-ide-2.14.1.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-api/lib/gradle-language-java-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-language-java-2.13.jar with 77% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.13.jar with 63% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-language-scala-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-language-scala-2.13.jar with 62% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-platform-base-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-platform-base-2.13.jar with 66% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-platform-jvm-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-platform-jvm-2.13.jar with 61% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.13.jar [deleted file]
plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.14.1.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-api/lib/gradle-scala-2.13.jar [deleted file]
plugins/gradle/tooling-extension-api/lib/gradle-scala-2.14.1.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-api/lib/gradle-testing-base-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-testing-base-2.13.jar with 65% similarity]
plugins/gradle/tooling-extension-api/lib/gradle-testing-jvm-2.14.1.jar [moved from plugins/gradle/tooling-extension-api/lib/gradle-testing-jvm-2.13.jar with 63% similarity]
plugins/gradle/tooling-extension-impl/gradle-tooling-extension-impl.iml
plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.13.jar [deleted file]
plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.14.1.jar [new file with mode: 0644]
plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.14.1.jar [moved from plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.13.jar with 80% similarity]
plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/StubIdeaModule.java [deleted file]
plugins/gradle/tooling-extension-impl/testSources/org/jetbrains/plugins/gradle/tooling/builder/AbstractModelBuilderTest.java
plugins/javaFX/common-javaFX-plugin/src/org/jetbrains/plugins/javaFX/packaging/AbstractJavaFxPackager.java
python/src/com/jetbrains/python/codeInsight/controlflow/PyTypeAssertionEvaluator.java
python/testSrc/com/jetbrains/python/PyTypeTest.java

index 5edf4faa43f1cf26cc182c2ea29c8201b441c51d..35d2714326368e12efd70fa5b7634ea6bef58ae8 100644 (file)
@@ -1,31 +1,35 @@
 <component name="libraryTable">
   <library name="Gradle">
     <CLASSES>
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-tooling-api-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-core-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-messaging-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-model-core-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-model-groovy-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-wrapper-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-base-services-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-base-services-groovy-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-native-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-resources-2.13.jar!/" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-cli-2.13.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-tooling-api-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-core-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-messaging-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-model-core-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-model-groovy-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-wrapper-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-base-services-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-base-services-groovy-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-process-services-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-native-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-resources-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-cli-2.14.1.jar!/" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-logging-2.14.1.jar!/" />
     </CLASSES>
     <JAVADOC />
     <SOURCES>
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/tooling-api/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/core/src/main/groovy" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/model-core/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/model-groovy/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/messaging/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/wrapper/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/base-services/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/base-services-groovy/src/main/groovy" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/native/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/resources/src/main/java" />
-      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/cli/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/tooling-api/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/core/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/model-core/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/model-groovy/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/messaging/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/wrapper/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/base-services/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/base-services-groovy/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/process-services/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/native/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/resources/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/cli/src/main/java" />
+      <root url="jar://$PROJECT_DIR$/plugins/gradle/lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/logging/src/main/java" />
     </SOURCES>
   </library>
 </component>
\ No newline at end of file
index c3f3e7d6b00b86460b0ae0a2a64673e01fa2af49..f160c9cdab996b46b496dd3db4afcb770ab2c3ec 100644 (file)
@@ -125,9 +125,9 @@ class CommunityLibraryLicenses {
     new LibraryLicense(name: "Gherkin", libraryName: "Gherkin", version: "2.12.2", license: "MIT",
                        licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0.txt", url: "https://github.com/cucumber/gherkin"),
     new LibraryLicense(name: "Google Feedback", libraryName: "GoogleFeedback.jar", version: "", license: "TBD"),
-    new LibraryLicense(name: "gradle-tooling-api-2.13.jar", version: "2.13", license: "Apache 2.0", url: "http://gradle.org/",
+    new LibraryLicense(name: "gradle-tooling-api-2.14.1.jar", version: "2.14.1", license: "Apache 2.0", url: "http://gradle.org/",
                        licenseUrl: "http://gradle.org/license"),
-    new LibraryLicense(name: "Gradle", version: "2.13", license: "Apache 2.0", url: "http://gradle.org/",
+    new LibraryLicense(name: "Gradle", version: "2.14.1", license: "Apache 2.0", url: "http://gradle.org/",
                        licenseUrl: "http://gradle.org/license"),
     new LibraryLicense(name: "GradleGuava", version: "14.0.1", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/",
                        licenseUrl: "http://apache.org/licenses/LICENSE-2.0"),
index f5a46f1734a0a243f2c3cf1ccf6e9c2d967f721b..7a0ade4c627a6f10e3994b4fd1d1fc1c651cb76b 100644 (file)
@@ -24,6 +24,7 @@ import com.intellij.codeInspection.reference.*;
 import com.intellij.openapi.progress.EmptyProgressIndicator;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 import com.intellij.psi.*;
+import com.intellij.util.ObjectUtils;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
@@ -246,7 +247,7 @@ public class SameParameterValueInspectionBase extends GlobalJavaBatchInspectionT
                                             PsiParameter parameter,
                                             String value) {
     final String name = parameter.getName();
-    return manager.createProblemDescriptor(parameter,
+    return manager.createProblemDescriptor(ObjectUtils.notNull(parameter.getNameIdentifier(), parameter),
                                            InspectionsBundle.message("inspection.same.parameter.problem.descriptor",
                                                                      "<code>" + name + "</code>",
                                                                      "<code>" + value + "</code>"),
index 55843bf91337f98ec40ccdb7be5a597ef2bcacaf..702d88c7a3453e7cc6026ff9fb9904de30280955 100644 (file)
@@ -169,9 +169,9 @@ public class InferenceSession {
     return elementFactory.createType(parameter);
   }
 
-  public void initExpressionConstraints(PsiParameter[] parameters, PsiExpression[] args, PsiElement parent, PsiMethod method) {
+  public void initExpressionConstraints(PsiParameter[] parameters, PsiExpression[] args, PsiElement parent) {
     final MethodCandidateInfo.CurrentCandidateProperties currentProperties = getCurrentProperties(parent);
-    initExpressionConstraints(parameters, args, parent, method, currentProperties != null && currentProperties.isVarargs());
+    initExpressionConstraints(parameters, args, parent, null, currentProperties != null && currentProperties.isVarargs());
   }
 
   public void initExpressionConstraints(PsiParameter[] parameters,
@@ -382,7 +382,6 @@ public class InferenceSession {
           final Ref<String> errorMessage = new Ref<String>();
           final PsiType targetType = getTargetTypeFromParent(parent, errorMessage, false);
           if (targetType == null && errorMessage.get() != null) {
-            registerIncompatibleErrorMessage(errorMessage.get());
             return;
           }
 
@@ -393,6 +392,7 @@ public class InferenceSession {
       }
 
       if (!repeatInferencePhases()) {
+        resolveBounds(getInputInferenceVariablesFromTopLevelFunctionalExpressions(args, properties), initialSubstitutor);
         return;
       }
 
@@ -405,34 +405,37 @@ public class InferenceSession {
         }
 
         if (!additionalConstraints.isEmpty() && !proceedWithAdditionalConstraints(additionalConstraints, ignoredConstraints)) {
+          resolveBounds(getInputInferenceVariablesFromTopLevelFunctionalExpressions(args, properties), initialSubstitutor);
           return;
         }
       }
     }
 
-    final PsiSubstitutor substitutor = resolveBounds(myInferenceVariables, initialSubstitutor);
-    if (substitutor != null) {
-      if (myContext != null) {
-        myContext.putUserData(ERASED, myErased);
-      }
-      final Map<PsiTypeParameter, PsiType> map = substitutor.getSubstitutionMap();
-      for (PsiTypeParameter parameter : map.keySet()) {
-        final PsiType mapping = map.get(parameter);
-        PsiTypeParameter param;
-        if (parameter instanceof InferenceVariable) {
-          ((InferenceVariable)parameter).setInstantiation(mapping);
-          if (((InferenceVariable)parameter).getCallContext() != myContext) {
-            //don't include in result substitutor foreign inference variables
-            continue;
+    resolveBounds(myInferenceVariables, initialSubstitutor);
+  }
+
+  private Collection<InferenceVariable> getInputInferenceVariablesFromTopLevelFunctionalExpressions(PsiExpression[] args, MethodCandidateInfo.CurrentCandidateProperties properties) {
+    if (args == null) return Collections.emptyList();
+    final PsiMethod method = properties.getMethod();
+    final PsiParameter[] parameters = method.getParameterList().getParameters();
+    final HashSet<InferenceVariable> dependencies = new HashSet<InferenceVariable>();
+    for (int i = 0; i < args.length; i++) {
+      PsiExpression arg = args[i];
+      if (arg instanceof PsiLambdaExpression && !((PsiLambdaExpression)arg).hasFormalParameterTypes() ||
+          arg instanceof PsiMethodReferenceExpression && !((PsiMethodReferenceExpression)arg).isExact()) {
+        final PsiSubstitutor nestedSubstitutor = myInferenceSessionContainer.findNestedSubstitutor(arg, myInferenceSubstitution);
+        final PsiType parameterType = nestedSubstitutor.substitute(getParameterType(parameters, i, mySiteSubstitutor, properties.isVarargs()));
+        final PsiClassType.ClassResolveResult result = PsiUtil.resolveGenericsClassInType(parameterType);
+        final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(result);
+        if (interfaceMethod != null) {
+          final PsiSubstitutor substitutor = LambdaUtil.getSubstitutor(interfaceMethod, result);
+          for (PsiParameter parameter : interfaceMethod.getParameterList().getParameters()) {
+            collectDependencies(substitutor.substitute(parameter.getType()), dependencies);
           }
-          param = ((InferenceVariable)parameter).getParameter();
         }
-        else {
-          param = parameter;
-        }
-        mySiteSubstitutor = mySiteSubstitutor.put(param, mapping);
       }
     }
+    return dependencies;
   }
 
   private boolean isOverloadCheck() {
@@ -1106,8 +1109,8 @@ public class InferenceSession {
     return false;
   }
 
-  private PsiSubstitutor resolveBounds(final Collection<InferenceVariable> inferenceVariables,
-                                       PsiSubstitutor substitutor) {
+  private void resolveBounds(final Collection<InferenceVariable> inferenceVariables,
+                             @NotNull PsiSubstitutor substitutor) {
     final Collection<InferenceVariable> allVars = new ArrayList<InferenceVariable>(inferenceVariables);
     while (!allVars.isEmpty()) {
       final List<InferenceVariable> vars = InferenceVariablesOrder.resolveOrder(allVars, this);
@@ -1132,15 +1135,36 @@ public class InferenceSession {
       }
 
       if (!initFreshVariables(substitutor, unresolved)) {
-        return null;
+        return;
       }
 
       myIncorporationPhase.forgetCaptures(vars);
       if (!repeatInferencePhases()) {
-        return null;
+        return;
       }
     }
-    return substitutor;
+
+    if (myContext != null) {
+      myContext.putUserData(ERASED, myErased);
+    }
+
+    final Map<PsiTypeParameter, PsiType> map = substitutor.getSubstitutionMap();
+    for (PsiTypeParameter parameter : map.keySet()) {
+      final PsiType mapping = map.get(parameter);
+      PsiTypeParameter param;
+      if (parameter instanceof InferenceVariable) {
+        ((InferenceVariable)parameter).setInstantiation(mapping);
+        if (((InferenceVariable)parameter).getCallContext() != myContext) {
+          //don't include in result substitutor foreign inference variables
+          continue;
+        }
+        param = ((InferenceVariable)parameter).getParameter();
+      }
+      else {
+        param = parameter;
+      }
+      mySiteSubstitutor = mySiteSubstitutor.put(param, mapping);
+    }
   }
 
   private boolean initFreshVariables(PsiSubstitutor substitutor, List<InferenceVariable> vars) {
index 801b0791796d1ab500af5ea7aa68d235cf15998a..fcf4496e1e17595a08fedab49cc1da09d139d7e2 100644 (file)
@@ -138,7 +138,7 @@ public class InferenceSessionContainer {
     }
 
     final InferenceSession inferenceSession = new InferenceSession(typeParameters, partialSubstitutor, parent.getManager(), parent, policy);
-    inferenceSession.initExpressionConstraints(parameters, arguments, parent, null);
+    inferenceSession.initExpressionConstraints(parameters, arguments, parent);
     return inferenceSession.infer(parameters, arguments, parent);
   }
   
index eab17977301b21bd589fd6063b21a9f350fb3544..a97a3e5cf47491bb321e506b4c410f4fb7973a80 100644 (file)
@@ -51,7 +51,7 @@ public class PsiGraphInferenceHelper implements PsiInferenceHelper {
     }
     else {
       final InferenceSession inferenceSession = new InferenceSession(new PsiTypeParameter[]{typeParameter}, partialSubstitutor, myManager, null);
-      inferenceSession.initExpressionConstraints(parameters, arguments, null, null);
+      inferenceSession.initExpressionConstraints(parameters, arguments, null);
       substitutor = inferenceSession.infer();
     }
     return substitutor.substitute(typeParameter);
index 4525426bf58e51b13f0a632ea589262bb23f62d9..49c813e2a87827657aae6b85823c71d892e86c57 100644 (file)
@@ -3,8 +3,8 @@ import java.util.*;
 class Main {
 
     void foo(List<Integer> list) {
-        bar(list, i -> <error descr="Bad return type in lambda expression: int cannot be converted to S_OUT">i.intValue()</error>, i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
-        bar1(list, i -> <error descr="Bad return type in lambda expression: int cannot be converted to S_OUT">i.intValue()</error>, i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
+        bar(list, i -> i.intValue(), i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
+        bar1(list, i -> i.intValue(), i -> i.<error descr="Cannot resolve method 'unknown()'">unknown</error>());
     }
 
     <U, S_IN, S_OUT, R> R bar(List<S_IN> list,
index 0c75ae1d7d6e0f610bf1a21dd54d3bc9f7e94cf9..6ee3add7c1fe33ca3bc047c60df35d73ffa13636 100644 (file)
@@ -57,7 +57,7 @@ class ReturnTypeCompatibility {
     }
 
     public static void main(String[] args) {
-        <error descr="Ambiguous method call: both 'ReturnTypeCompatibility.call(I1<Number>)' and 'ReturnTypeCompatibility.call(I2<P>)' match">call</error>(i-> {return i;});
+        <error descr="Ambiguous method call: both 'ReturnTypeCompatibility.call(I1<Number>)' and 'ReturnTypeCompatibility.call(I2<String>)' match">call</error>(i-> {return i;});
     }
 }
 
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/InferTypeParametersFromFunctionalInterfaceInputs.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/InferTypeParametersFromFunctionalInterfaceInputs.java
new file mode 100644 (file)
index 0000000..7df4595
--- /dev/null
@@ -0,0 +1,21 @@
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+class A {
+  {
+    run(A.class, this, (o) -> {
+      o.meth();
+    <error descr="Missing return statement">}</error>);
+
+
+    Map<Integer, Integer> map = Stream.iterate(5, <error descr="no instance(s) of type variable(s) T exist so that Stream<T> conforms to Map<Integer, Integer>">t -> t + 5</error>);
+  }
+
+
+  void meth() {}
+
+  <T> T run(Class<T> c, T t, Function<T, T> f) {
+    return f.apply(t);
+  }
+}
index a0b9d5249f20bb0e4e4ee9ec0b750e6227f0a8a8..570ba856ae382c8171dff9906dbc7742e490ca16 100644 (file)
@@ -187,7 +187,7 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
   }
 
   public void testAcceptInferredVariablesBeforeAdditionalConstraintsLeadToFail() throws Exception {
-    doTest(false);
+    doTest();
   }
 
   public void testEnsureNoCaptureIsPerformedOverTargetTypeOfCastExpressionWhichMarksFunctionalExpression() throws Exception {
@@ -335,13 +335,13 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
     doTest();
   }
 
-  private void doTest() {
-    doTest(false);
+  public void testInferTypeParametersFromFunctionalInterfaceInputs() throws Exception {
+    doTest();
   }
 
-  private void doTest(boolean warnings) {
+  private void doTest() {
     IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
-    doTest(BASE_PATH + "/" + getTestName(false) + ".java", warnings, false);
+    doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
   }
 
   /*
index a27033869b1982505aeb40b7a9e60baeac78e2cf..ee7237406924152a1a124746dbc526bea573c657 100644 (file)
@@ -21,15 +21,14 @@ import com.intellij.openapi.editor.markup.TextAttributes;
 import com.intellij.openapi.util.JDOMExternalizerUtil;
 import com.intellij.openapi.util.NullableLazyValue;
 import com.intellij.openapi.util.VolatileNullableLazyValue;
-import com.intellij.util.ConcurrencyUtil;
 import com.intellij.util.containers.ContainerUtil;
+import gnu.trove.THashSet;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.jetbrains.annotations.TestOnly;
 
-import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 
@@ -38,7 +37,7 @@ import java.util.concurrent.ConcurrentMap;
  * A type of item with a distinct highlighting in an editor or in other views.
  */
 public final class TextAttributesKey implements Comparable<TextAttributesKey> {
-  private static final Logger LOG = Logger.getInstance("#" + TextAttributesKey.class.getName());
+  private static final Logger LOG = Logger.getInstance(TextAttributesKey.class);
   
   private static final TextAttributes NULL_ATTRIBUTES = new TextAttributes();
   private static final ConcurrentMap<String, TextAttributesKey> ourRegistry = ContainerUtil.newConcurrentMap();
@@ -69,7 +68,14 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey> {
 
   @NotNull
   public static TextAttributesKey find(@NotNull @NonNls String externalName) {
-    return ConcurrencyUtil.cacheOrGet(ourRegistry, externalName, new TextAttributesKey(externalName));
+    TextAttributesKey v = ourRegistry.get(externalName);
+    if (v != null) {
+      return v;
+    }
+
+    v = new TextAttributesKey(externalName);
+    TextAttributesKey prev = ourRegistry.putIfAbsent(externalName, v);
+    return prev == null ? v : prev;
   }
 
   public String toString() {
@@ -182,14 +188,15 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey> {
     return key;
   }
 
+  @Nullable
   public TextAttributesKey getFallbackAttributeKey() {
     return myFallbackAttributeKey;
   }
 
-  public void setFallbackAttributeKey(TextAttributesKey fallbackAttributeKey) {
+  public void setFallbackAttributeKey(@Nullable TextAttributesKey fallbackAttributeKey) {
     myFallbackAttributeKey = fallbackAttributeKey;
     if (fallbackAttributeKey != null) {
-      checkDependencies(fallbackAttributeKey, new HashSet<TextAttributesKey>());
+      checkDependencies(fallbackAttributeKey, new THashSet<TextAttributesKey>());
     }
   }
   
@@ -204,33 +211,30 @@ public final class TextAttributesKey implements Comparable<TextAttributesKey> {
     TextAttributes getDefaultAttributes(TextAttributesKey key);
   }
 
-  private void checkDependencies(@Nullable TextAttributesKey key, Set<TextAttributesKey> referencedKeys) {
-    if (key != null) {
-      if (!referencedKeys.contains(key)) {
-        referencedKeys.add(key);
-        TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
-        if (fallbackKey != null) {
-          checkDependencies(fallbackKey, referencedKeys);
-        }
-      }
-      else {
-        StringBuilder sb = new StringBuilder();
-        sb.append("Cyclic TextAttributesKey dependency found: ");
-        printDependencyLoop(sb, key);
-        myFallbackAttributeKey = null;
-        LOG.error(sb.toString());
+  private void checkDependencies(@NotNull TextAttributesKey key, @NotNull Set<TextAttributesKey> referencedKeys) {
+    if (referencedKeys.add(key)) {
+      TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
+      if (fallbackKey != null) {
+        checkDependencies(fallbackKey, referencedKeys);
       }
     }
+    else {
+      StringBuilder sb = new StringBuilder();
+      sb.append("Cyclic TextAttributesKey dependency found: ");
+      printDependencyLoop(sb, key);
+      myFallbackAttributeKey = null;
+      LOG.error(sb.toString());
+    }
   }
 
-  private void printDependencyLoop(@NotNull StringBuilder stringBuilder,
-                                   @NotNull TextAttributesKey currNode) {
+  private void printDependencyLoop(@NotNull StringBuilder stringBuilder, @NotNull TextAttributesKey currNode) {
     stringBuilder.append(currNode.getExternalName()).append("->");
     TextAttributesKey fallbackKey = currNode.getFallbackAttributeKey();
     if (fallbackKey == this) {
       stringBuilder.append(getExternalName());
-      return;
     }
-    printDependencyLoop(stringBuilder, fallbackKey);
+    else if (fallbackKey != null) {
+      printDependencyLoop(stringBuilder, fallbackKey);
+    }
   }
 }
index e17502174ca8943a7781504be6f9926300c9522e..83537ad7dc2acce3aa8a1bc153cb640772dc17bb 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.openapi.editor.markup;
 
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.util.InvalidDataException;
 import org.intellij.lang.annotations.JdkConstants;
 import org.jdom.Element;
 import org.jetbrains.annotations.Contract;
@@ -32,8 +31,7 @@ public class TextAttributes implements Cloneable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.markup.TextAttributes");
 
   public static final TextAttributes ERASE_MARKER = new TextAttributes();
-
-  private boolean myEnforceEmpty;
+  public static final TextAttributes USE_INHERITED_MARKER = new TextAttributes();
 
   @SuppressWarnings("NullableProblems")
   @NotNull
@@ -71,9 +69,8 @@ public class TextAttributes implements Cloneable {
     this(null, null, null, EffectType.BOXED, Font.PLAIN);
   }
 
-  private TextAttributes(@NotNull AttributesFlyweight attributesFlyweight, boolean enforced) {
+  private TextAttributes(@NotNull AttributesFlyweight attributesFlyweight) {
     myAttrs = attributesFlyweight;
-    myEnforceEmpty = enforced;
   }
 
   public TextAttributes(@NotNull Element element) {
@@ -97,14 +94,6 @@ public class TextAttributes implements Cloneable {
     return getForegroundColor() == null && getBackgroundColor() == null && getEffectColor() == null && getFontType() == Font.PLAIN;
   }
 
-  public boolean isFallbackEnabled() {
-    return isEmpty() && !myEnforceEmpty;
-  }
-
-  public boolean containsValue() {
-    return !isEmpty() || myEnforceEmpty;
-  }
-
   public void reset() {
     setForegroundColor(null);
     setBackgroundColor(null);
@@ -179,7 +168,7 @@ public class TextAttributes implements Cloneable {
 
   @Override
   public TextAttributes clone() {
-    return new TextAttributes(myAttrs, myEnforceEmpty);
+    return new TextAttributes(myAttrs);
   }
 
   public boolean equals(Object obj) {
@@ -194,17 +183,8 @@ public class TextAttributes implements Cloneable {
     return myAttrs.hashCode();
   }
 
-  public void readExternal(Element element) {
-    try {
-      myAttrs = AttributesFlyweight.create(element);
-    }
-    catch (InvalidDataException e) {
-      throw new RuntimeException(e);
-    }
-
-    if (isEmpty()) {
-      myEnforceEmpty = true;
-    }
+  public void readExternal(@NotNull Element element) {
+    myAttrs = AttributesFlyweight.create(element);
   }
 
   public void writeExternal(Element element) {
@@ -216,17 +196,4 @@ public class TextAttributes implements Cloneable {
     return "[" + getForegroundColor() + "," + getBackgroundColor() + "," + getFontType() + "," + getEffectType() + "," +
            getEffectColor() + "," + getErrorStripeColor() + "]";
   }
-
-  /**
-   * Enforces empty attributes instead of treating empty values as undefined.
-   *
-   * @param enforceEmpty True if empty values should be used as is (fallback is disabled).
-   */
-  public void setEnforceEmpty(boolean enforceEmpty) {
-    myEnforceEmpty = enforceEmpty;
-  }
-
-  public boolean isEnforceEmpty() {
-    return myEnforceEmpty;
-  }
 }
index 4505c1311ffe0d9d62c784a42f97c19f635d1ff9..9bffdf146b2b7fa2046becf05fbe7b43f34d5ad5 100644 (file)
@@ -48,6 +48,7 @@ import java.util.List;
 
 import static com.intellij.openapi.editor.colors.CodeInsightColors.*;
 import static com.intellij.openapi.editor.colors.EditorColors.*;
+import static com.intellij.openapi.editor.markup.TextAttributes.USE_INHERITED_MARKER;
 import static com.intellij.openapi.util.Couple.of;
 import static com.intellij.ui.ColorUtil.fromHex;
 
@@ -79,7 +80,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
   private int myVersion = CURR_VERSION;
 
   protected Map<ColorKey, Color>                   myColorsMap     = ContainerUtilRt.newHashMap();
-  protected Map<TextAttributesKey, TextAttributes> myAttributesMap = ContainerUtilRt.newHashMap();
+  protected Map<TextAttributesKey, TextAttributes> myAttributesMap = new THashMap<>();
 
   @NonNls private static final String EDITOR_FONT       = "font";
   @NonNls private static final String CONSOLE_FONT      = "console-font";
@@ -180,7 +181,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
       newScheme.setFont(type, font);
     }
 
-    newScheme.myAttributesMap = new HashMap<>(myAttributesMap);
+    newScheme.myAttributesMap = new THashMap<>(myAttributesMap);
     newScheme.myColorsMap = new HashMap<>(myColorsMap);
     newScheme.myVersion = myVersion;
   }
@@ -403,14 +404,16 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
 
   public void readAttributes(@NotNull Element childNode) {
     for (Element e : childNode.getChildren(OPTION_ELEMENT)) {
-      TextAttributesKey key = TextAttributesKey.find(e.getAttributeValue(NAME_ATTR));
       Element valueElement = e.getChild(VALUE_ELEMENT);
-      TextAttributes attr = myValueReader.read(TextAttributes.class, valueElement);
-      String baseKeyName = e.getAttributeValue(BASE_ATTRIBUTES_ATTR);
-      if (baseKeyName != null) {
-        // For now inheritance overriding is not supported, just make sure that empty attributes mean inheritance.
-        attr.setEnforceEmpty(false);
+      TextAttributesKey key = TextAttributesKey.find(e.getAttributeValue(NAME_ATTR));
+      if (valueElement == null) {
+        if (e.getAttributeValue(BASE_ATTRIBUTES_ATTR) != null) {
+          myAttributesMap.put(key, USE_INHERITED_MARKER);
+        }
+        continue;
       }
+
+      TextAttributes attr = myValueReader.read(TextAttributes.class, valueElement);
       myAttributesMap.put(key, attr);
       migrateErrorStripeColorFrom14(key, attr);
     }
@@ -623,25 +626,55 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
   private void writeAttributes(@NotNull Element attrElements) throws WriteExternalException {
     List<TextAttributesKey> list = new ArrayList<>(myAttributesMap.keySet());
     list.sort(null);
-    for (TextAttributesKey key: list) {
-      TextAttributes defaultAttr = myParentScheme != null ? myParentScheme.getAttributes(key) : new TextAttributes();
+    for (TextAttributesKey key : list) {
+      TextAttributes attributes = myAttributesMap.get(key);
       TextAttributesKey baseKey = key.getFallbackAttributeKey();
-      TextAttributes defaultFallbackAttr =
-        baseKey != null && myParentScheme instanceof AbstractColorsScheme ?
-        ((AbstractColorsScheme)myParentScheme).getFallbackAttributes(baseKey) : null;
-      TextAttributes value = myAttributesMap.get(key);                
-      if (baseKey != null && value.isFallbackEnabled()) {
-        if (isParentOverwritingInheritance(key)) {
-          attrElements.addContent(new Element(OPTION_ELEMENT).setAttribute(NAME_ATTR, key.getExternalName()).setAttribute(BASE_ATTRIBUTES_ATTR, baseKey.getExternalName()));
+      if (attributes == USE_INHERITED_MARKER) {
+        if (baseKey != null) {
+          attrElements.addContent(new Element(OPTION_ELEMENT)
+                                    .setAttribute(NAME_ATTR, key.getExternalName())
+                                    .setAttribute(BASE_ATTRIBUTES_ATTR, baseKey.getExternalName()));
         }
+        continue;
       }
-      else {
-        if (value.containsValue() && !value.equals(defaultAttr) || defaultAttr == defaultFallbackAttr) {
-          Element valueElement = new Element(VALUE_ELEMENT);
-          value.writeExternal(valueElement);
-          attrElements.addContent(new Element(OPTION_ELEMENT).setAttribute(NAME_ATTR, key.getExternalName()).addContent(valueElement));
+
+      if (myParentScheme != null) {
+        // fallback attributes must be not used, otherwise derived scheme as copy will not have such ke
+        TextAttributes parentAttributes = myParentScheme instanceof AbstractColorsScheme
+                                          ? ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key)
+                                          : myParentScheme.getAttributes(key);
+        if (parentAttributes != null && attributes.equals(parentAttributes)) {
+          continue;
         }
       }
+
+      Element valueElement = new Element(VALUE_ELEMENT);
+      attributes.writeExternal(valueElement);
+      attrElements.addContent(new Element(OPTION_ELEMENT).setAttribute(NAME_ATTR, key.getExternalName()).addContent(valueElement));
+    }
+  }
+
+  public void optimizeAttributeMap() {
+    EditorColorsScheme parentScheme = myParentScheme;
+    if (parentScheme == null) {
+      return;
+    }
+
+    for (TextAttributesKey key : new ArrayList<>(myAttributesMap.keySet())) {
+      TextAttributes attributes = myAttributesMap.get(key);
+      if (attributes == USE_INHERITED_MARKER) {
+        if (key.getFallbackAttributeKey() == null) {
+          myAttributesMap.remove(key);
+        }
+        continue;
+      }
+
+      TextAttributes parentAttributes = parentScheme instanceof DefaultColorsScheme
+                                        ? ((DefaultColorsScheme)parentScheme).getAttributes(key, false)
+                                        : parentScheme.getAttributes(key);
+      if (Comparing.equal(parentAttributes, attributes)) {
+        myAttributesMap.remove(key);
+      }
     }
   }
   
@@ -661,15 +694,6 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
     return metaInfoElement;
   }
 
-  private boolean isParentOverwritingInheritance(@NotNull TextAttributesKey key) {
-    TextAttributes parentAttrs =
-      myParentScheme instanceof AbstractColorsScheme ? ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key) : null;
-    if (parentAttrs != null) {
-      return !parentAttrs.isFallbackEnabled();
-    }
-    return false;
-  }
-
   protected Color getOwnColor(ColorKey key) {
     return myColorsMap.get(key);
   }
@@ -698,7 +722,6 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
       }
     }
     return true;
-
   }
 
   @NotNull
@@ -756,15 +779,13 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
     myConsoleLineSpacing = lineSpacing;
   }
 
-  protected TextAttributes getFallbackAttributes(TextAttributesKey fallbackKey) {
-    if (fallbackKey == null) return null;
+  protected TextAttributes getFallbackAttributes(@NotNull TextAttributesKey fallbackKey) {
     TextAttributes fallbackAttributes = getDirectlyDefinedAttributes(fallbackKey);
-    if (fallbackAttributes != null) {
-      if (!fallbackAttributes.isFallbackEnabled() || fallbackKey.getFallbackAttributeKey() == null) {
-        return fallbackAttributes;
-      }
+    TextAttributesKey fallbackKeyFallbackKey = fallbackKey.getFallbackAttributeKey();
+    if (fallbackAttributes != null && (fallbackAttributes != USE_INHERITED_MARKER || fallbackKeyFallbackKey == null)) {
+      return fallbackAttributes;
     }
-    return getFallbackAttributes(fallbackKey.getFallbackAttributeKey());
+    return fallbackKeyFallbackKey == null ? null : getFallbackAttributes(fallbackKeyFallbackKey);
   }
 
   /**
@@ -782,10 +803,6 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, Serial
     return myParentScheme instanceof AbstractColorsScheme ? ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key) : null;
   }
 
-  protected static boolean containsValue(@Nullable TextAttributes attributes) {
-    return attributes != null && attributes.containsValue();
-  }
-
   public boolean isSaveNeeded() {
     return myIsSaveNeeded;
   }
index c3254814cf81383d5b72755367b653e13238ef20..b55ea1def50a7f78dc7257098adbcb4c24024ceb 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package com.intellij.openapi.editor.colors.impl;
 
 import com.intellij.openapi.editor.colors.ColorKey;
@@ -37,14 +36,23 @@ public class DefaultColorsScheme extends AbstractColorsScheme implements ReadOnl
   @Override
   @Nullable
   public TextAttributes getAttributes(TextAttributesKey key) {
-    if (key == null) return null;
+    return key == null ? null : getAttributes(key, true);
+  }
+
+  @Nullable
+  public TextAttributes getAttributes(@NotNull TextAttributesKey key, boolean isUseDefault) {
     TextAttributes attrs = myAttributesMap.get(key);
     if (attrs == null) {
       if (key.getFallbackAttributeKey() != null) {
         attrs = getFallbackAttributes(key.getFallbackAttributeKey());
-        if (attrs != null && !attrs.isFallbackEnabled()) return attrs;
+        if (attrs != null && attrs != TextAttributes.USE_INHERITED_MARKER) {
+          return attrs;
+        }
+      }
+
+      if (isUseDefault) {
+        attrs = getKeyDefaults(key);
       }
-      attrs = getKeyDefaults(key);
     }
     return attrs;
   }
index 9cbbf30fbc540c5834f6ef715236f8c7e55a4b4c..f214856982c6dbf52afe6f529bc526ad41502f99 100644 (file)
@@ -26,6 +26,8 @@ import org.jetbrains.annotations.Nullable;
 
 import java.awt.*;
 
+import static com.intellij.openapi.editor.markup.TextAttributes.USE_INHERITED_MARKER;
+
 public class EditorColorsSchemeImpl extends AbstractColorsScheme implements ExternalizableScheme {
   public EditorColorsSchemeImpl(EditorColorsScheme parentScheme) {
     super(parentScheme);
@@ -33,7 +35,7 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte
 
   @Override
   public void setAttributes(@NotNull TextAttributesKey key, TextAttributes attributes) {
-    if (!attributes.equals(getAttributes(key))) {
+    if (attributes == USE_INHERITED_MARKER || !attributes.equals(getAttributes(key))) {
       myAttributesMap.put(key, attributes);
     }
   }
@@ -47,30 +49,24 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme implements Exte
 
   @Override
   public TextAttributes getAttributes(@Nullable TextAttributesKey key) {
-    TextAttributes attributes = key == null ? null : getOwnAttributes(key);
-    return attributes == null ? myParentScheme.getAttributes(key) : attributes;
-  }
-
-  @Nullable
-  private TextAttributes getOwnAttributes(@NotNull TextAttributesKey key) {
-    TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
-    TextAttributes attributes = getDirectlyDefinedAttributes(key);
-    if (fallbackKey == null) {
-      if (containsValue(attributes)) {
-        return attributes;
-      }
-    }
-    else {
-      if (containsValue(attributes) && !attributes.isFallbackEnabled()) {
+    if (key != null) {
+      TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
+      TextAttributes attributes = getDirectlyDefinedAttributes(key);
+      if (fallbackKey == null) {
         return attributes;
       }
+      else {
+        if (attributes != null && attributes != USE_INHERITED_MARKER) {
+          return attributes;
+        }
 
-      attributes = getFallbackAttributes(fallbackKey);
-      if (containsValue(attributes)) {
-        return attributes;
+        attributes = getFallbackAttributes(fallbackKey);
+        if (attributes != null) {
+          return attributes;
+        }
       }
     }
-    return null;
+    return myParentScheme.getAttributes(key);
   }
 
   @Nullable
index 39f2830ed2dc2160698f4ee48b25938157c91a37..d4fba4aae9525b9fb80ad3fc33798d5cbfb57b60 100644 (file)
@@ -53,25 +53,22 @@ class TextAttributesReader extends ValueElementReader {
    */
   @Override
   public <T> T read(Class<T> type, Element element) {
-    if (TextAttributes.class.equals(type)) {
-      TextAttributes attributes = new TextAttributes();
-      if (element != null) {
-        attributes.setAttributes(
-          readChild(Color.class, element, FOREGROUND),
-          readChild(Color.class, element, BACKGROUND),
-          readChild(Color.class, element, EFFECT_COLOR),
-          readChild(Color.class, element, ERROR_STRIPE),
-          Effect.read(this, element),
-          FontStyle.read(this, element));
-        // needed for compatibility with TextAttributes(Element)
-        if (attributes.isEmpty()) {
-          attributes.setEnforceEmpty(true);
-        }
-      }
-      //noinspection unchecked
-      return (T)attributes;
+    if (!TextAttributes.class.equals(type)) {
+      return super.read(type, element);
+    }
+
+    TextAttributes attributes = new TextAttributes();
+    if (element != null) {
+      attributes.setAttributes(
+        readChild(Color.class, element, FOREGROUND),
+        readChild(Color.class, element, BACKGROUND),
+        readChild(Color.class, element, EFFECT_COLOR),
+        readChild(Color.class, element, ERROR_STRIPE),
+        Effect.read(this, element),
+        FontStyle.read(this, element));
     }
-    return super.read(type, element);
+    //noinspection unchecked
+    return (T)attributes;
   }
 
   /**
index e3fc615152124655cdd6f99a26ccd6c5d8dbc597..2cee88f55c6f29f283592c9c6772b6926def02ae 100644 (file)
@@ -839,7 +839,7 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
       if (scheme == null) {
         scheme = getScheme();
       }
-      scheme.setAttributes(key, isInherited() ? new TextAttributes() : getTextAttributes());
+      scheme.setAttributes(key, isInherited() ? USE_INHERITED_MARKER : getTextAttributes());
     }
 
     @Override
@@ -866,11 +866,6 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
     public Pair<ColorSettingsPage,AttributesDescriptor> getBaseAttributeDescriptor() {
       return myBaseAttributeDescriptor;
     }
-
-    @Override
-    public void setInherited(boolean isInherited) {
-      super.setInherited(isInherited);
-    }
   }
 
   private static class GetSetColor {
@@ -1174,7 +1169,7 @@ public class ColorAndFontOptions extends SearchableConfigurable.Parent.Abstract
         if (myParentScheme instanceof AbstractColorsScheme) {
           TextAttributes ownAttrs = ((AbstractColorsScheme)myParentScheme).getDirectlyDefinedAttributes(key);
           if (ownAttrs != null) {
-            return ownAttrs.isFallbackEnabled();
+            return ownAttrs == TextAttributes.USE_INHERITED_MARKER;
           }
         }
         TextAttributes attributes = getAttributes(key);
index 85ca6d564168c4c188c80f7b36bf61a947bcca08..70e4ddc91e7173fa3ec33da0e46d1e0943bef4ed 100644 (file)
@@ -101,10 +101,4 @@ public abstract class TextAttributesDescription extends ColorAndFontDescription
   protected TextAttributes getTextAttributes() {
     return myAttributes;
   }
-
-  @Override
-  public void setInherited(boolean isInherited) {
-    super.setInherited(isInherited);
-    myAttributes.setEnforceEmpty(!isInherited);
-  }
 }
index 5b4a6f324138439cca1592ef7e72a7975d85d4d8..666abce56f061e5b966b65f3eac154658a894be6 100644 (file)
@@ -295,10 +295,9 @@ public class SeverityEditorDialog extends DialogWrapper {
     if (info == null) {
       return;
     }
-    final MyTextAttributesDescription description =
-      new MyTextAttributesDescription(info.getType().toString(), null, new TextAttributes(), info.getType().getAttributesKey());
+    MyTextAttributesDescription description = new MyTextAttributesDescription(info.getType().toString(), null, new TextAttributes(), info.getType().getAttributesKey());
     myOptionsPanel.apply(description, null);
-    @NonNls Element textAttributes = new Element("temp");
+    Element textAttributes = new Element("temp");
     try {
       description.getTextAttributes().writeExternal(textAttributes);
       info.getAttributes().readExternal(textAttributes);
index 50e3306a3124d6a7994d234ab6e4c3a1b5eafef3..3286f71529c2f464812fd7d3ac78d2364af70f9c 100644 (file)
@@ -91,8 +91,8 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers
         // we don't need to update digest for bundled scheme because
         // 1) it can be computed on demand later (because bundled scheme is not mutable)
         // 2) in the future user copy of bundled scheme will use bundled scheme as parent (not as full copy)
-        if (!isBundled) {
-          //dataHolder.updateDigest(scheme);
+        if (isBundled) {
+          scheme.optimizeAttributeMap();
         }
         return scheme;
       }
@@ -180,7 +180,7 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers
   private void initEditableBundledSchemesCopies() {
     for (EditorColorsScheme scheme : mySchemeManager.getAllSchemes()) {
       if (scheme instanceof BundledScheme) {
-        createEditableCopy((BundledScheme)scheme, ((BundledScheme)scheme).getEditableCopyName());
+        createEditableCopy((BundledScheme)scheme, SchemeManager.EDITABLE_COPY_PREFIX + scheme.getName());
       }
     }
   }
@@ -221,10 +221,6 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers
     public boolean isVisible() {
       return false;
     }
-    
-    public String getEditableCopyName() {
-      return SchemeManager.EDITABLE_COPY_PREFIX + getName();
-    }
   }
 
   static class State {
@@ -333,7 +329,7 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Pers
       editableCopyName = ((DefaultColorsScheme)scheme).getEditableCopyName();
     }
     else if (scheme instanceof BundledScheme) {
-      editableCopyName = ((BundledScheme)scheme).getEditableCopyName();
+      editableCopyName = SchemeManager.EDITABLE_COPY_PREFIX + scheme.getName();
     }
     if (editableCopyName != null) {
       EditorColorsScheme editableCopy = getScheme(editableCopyName);
index 510e6bd8a5bb1f14471a6f4cb22d191e36342045..9f9177763f5aa8dd1450abc97a222b00a99aba25 100644 (file)
@@ -37,8 +37,9 @@ import static java.awt.GridBagConstraints.CENTER;
 
 public class ComboBoxCompositeEditor<I, F extends JComponent> extends JPanel implements ComboBoxEditor {
 
-  public static <ItemType, FocusableComponentType extends JComponent> ComboBoxCompositeEditor<ItemType, FocusableComponentType> withComponents (final JComponent ... components) {
-    return new ComboBoxCompositeEditor<>(components);
+  public static <ItemType, EditableComponentType extends JComponent> ComboBoxCompositeEditor<ItemType, EditableComponentType> withComponents (final EditableComponentType editableComponent, final JComponent ... components)
+  {
+    return new ComboBoxCompositeEditor<>(editableComponent, components);
   }
 
   private BiConsumer<I, F>  myOnSetItemHandler = null;
@@ -152,15 +153,12 @@ public class ComboBoxCompositeEditor<I, F extends JComponent> extends JPanel imp
     }
   };
 
-  private final EditorComponent<F, I>[] myComponents;
-  private int focusableComponentIndex;
+  private final EditorComponent<F,I> myComponent;
 
-  public ComboBoxCompositeEditor(final JComponent ... components) {
+  public ComboBoxCompositeEditor(final F editableComponent, final JComponent ... components) {
     assert components.length > 0;
-    //setLayout(new GridLayout(1, 0));
     setLayout(new GridBagLayout());
     setFocusable(false);
-    myComponents = new EditorComponent[components.length];
 
     GridBagConstraints c = new GridBagConstraints();
 
@@ -170,55 +168,57 @@ public class ComboBoxCompositeEditor<I, F extends JComponent> extends JPanel imp
     c.anchor = CENTER;
     c.ipadx = 0;
     c.ipady = 0;
+    c.gridx = 0;
+
+    add(editableComponent, c);
+    c.weightx = 0;
 
     for (int i = 0; i < components.length; i ++) {
-      c.gridx = i;
+      c.gridx = i + 1;
+      components[i].setBackground(getBackground());
       add(components[i], c);
-      c.weightx = 0;
     }
 
-    final ComboBoxCompositeEditorStrategy strategy = getStrategy((F)components[focusableComponentIndex]);
+    final ComboBoxCompositeEditorStrategy strategy = getStrategy(editableComponent);
 
-    myComponents[focusableComponentIndex] = new ComboBoxCompositeEditor.EditorComponent<F, I>() {
+    myComponent = new ComboBoxCompositeEditor.EditorComponent<F, I>() {
 
       I myItem;
 
       public void setItem(I anObject) {
         myItem = anObject;
-        strategy.setItem((F)components[focusableComponentIndex], anObject);
+        strategy.setItem(editableComponent, anObject);
       }
 
       public I getItem() {
-        return strategy.getItem((F)components[focusableComponentIndex], myItem);
+        return strategy.getItem(editableComponent, myItem);
       }
 
       @Override
       public void selectAll() {
-        strategy.selectAll((F)components[focusableComponentIndex]);
+        strategy.selectAll(editableComponent);
       }
 
       @Override
       public void addActionListener(ActionListener l) {
-        strategy.addActionListener((F)components[focusableComponentIndex], l);
+        strategy.addActionListener(editableComponent, l);
       }
 
       @Override
       public void removeActionListener(ActionListener l) {
-        strategy.removeActionListener((F)components[focusableComponentIndex], l);
+        strategy.removeActionListener(editableComponent, l);
       }
 
       @Override
       public JComponent getDelegate() {
-        return components[focusableComponentIndex];
+        return editableComponent;
       }
     };
 
     invalidate();
 
-    focusableComponentIndex = 0;
-    final JComponent component = myComponents[focusableComponentIndex].getDelegate();
-    component.setBorder(null);
-    component.addFocusListener(new FocusListener() {
+    editableComponent.setBorder(null);
+    editableComponent.addFocusListener(new FocusListener() {
 
       Component parent = null;
 
@@ -242,27 +242,27 @@ public class ComboBoxCompositeEditor<I, F extends JComponent> extends JPanel imp
 
   @Override
   public void setItem(Object anObject) {
-    myComponents[focusableComponentIndex].setItem((I)anObject);
+    myComponent.setItem((I)anObject);
   }
 
   @Override
   public Object getItem() {
-    return myComponents[focusableComponentIndex].getItem();
+    return myComponent.getItem();
   }
 
   @Override
   public void selectAll() {
-    myComponents[focusableComponentIndex].selectAll();
+    myComponent.selectAll();
   }
 
   @Override
   public void addActionListener(ActionListener l) {
-    myComponents[focusableComponentIndex].addActionListener(l);
+    myComponent.addActionListener(l);
   }
 
   @Override
   public void removeActionListener(ActionListener l) {
-    myComponents[focusableComponentIndex].removeActionListener(l);
+    myComponent.removeActionListener(l);
   }
 
   @Override
index 420b128a4b392e8ec41ad4cd11789419369ddaac..c88b70878a052bddd5a55346c8b90492bb5c5756 100644 (file)
@@ -31,6 +31,7 @@ import java.util.Arrays;
 import java.util.Collections;
 
 import static com.intellij.openapi.editor.colors.FontPreferencesTest.*;
+import static com.intellij.openapi.editor.markup.TextAttributes.USE_INHERITED_MARKER;
 import static com.intellij.testFramework.Assertions.assertThat;
 import static java.util.Collections.singletonList;
 
@@ -194,7 +195,7 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase {
   }
 
   public void testSaveInheritance() throws Exception {
-    Pair<EditorColorsScheme,TextAttributes> result = doTestWriteRead(DefaultLanguageHighlighterColors.STATIC_METHOD, new TextAttributes());
+    Pair<EditorColorsScheme, TextAttributes> result = doTestWriteRead(DefaultLanguageHighlighterColors.STATIC_METHOD, USE_INHERITED_MARKER);
     TextAttributes fallbackAttrs = result.first.getAttributes(DefaultLanguageHighlighterColors.STATIC_METHOD.getFallbackAttributeKey());
     assertSame(result.second, fallbackAttrs);
   }
@@ -208,16 +209,11 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase {
   }
 
   public void testSaveInheritanceForEmptyAttrs() throws Exception {
-    TextAttributes abstractMethodAttrs = new TextAttributes();
-    assertTrue(abstractMethodAttrs.isFallbackEnabled());
-    Pair<EditorColorsScheme, TextAttributes> result =
-      doTestWriteRead(DefaultLanguageHighlighterColors.INSTANCE_FIELD, abstractMethodAttrs);
-    TextAttributes fallbackAttrs = result.first.getAttributes(
-      DefaultLanguageHighlighterColors.INSTANCE_FIELD.getFallbackAttributeKey()
-    );
+    Pair<EditorColorsScheme, TextAttributes> result = doTestWriteRead(DefaultLanguageHighlighterColors.INSTANCE_FIELD, USE_INHERITED_MARKER);
+    TextAttributes fallbackAttrs = result.first.getAttributes(DefaultLanguageHighlighterColors.INSTANCE_FIELD.getFallbackAttributeKey());
     TextAttributes directlyDefined =
       ((AbstractColorsScheme)result.first).getDirectlyDefinedAttributes(DefaultLanguageHighlighterColors.INSTANCE_FIELD);
-    assertTrue(directlyDefined != null && directlyDefined.isFallbackEnabled());
+    assertTrue(directlyDefined != null && directlyDefined == USE_INHERITED_MARKER);
     assertSame(fallbackAttrs, result.second);
   }
 
@@ -283,12 +279,9 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase {
     EditorColorsScheme editorColorsScheme = new EditorColorsSchemeImpl(parentScheme);
     editorColorsScheme.setName("test");
     TextAttributes defaultAttributes = new TextAttributes(null, null, Color.BLACK, EffectType.LINE_UNDERSCORE, Font.PLAIN);
-    TextAttributes attributes = new TextAttributes(null, null, null, EffectType.BOXED, Font.PLAIN);
-    attributes.setEnforceEmpty(false);
-    assertTrue(attributes.isFallbackEnabled());
     TextAttributesKey testKey = TextAttributesKey.createTextAttributesKey("TEST_KEY", DefaultLanguageHighlighterColors.PARAMETER);
     parentScheme.setAttributes(testKey, defaultAttributes);
-    editorColorsScheme.setAttributes(testKey, attributes);
+    editorColorsScheme.setAttributes(testKey, USE_INHERITED_MARKER);
     try {
       Element root = new Element("scheme");
       ((AbstractColorsScheme)editorColorsScheme).writeExternal(root);
@@ -299,7 +292,7 @@ public class EditorColorsSchemeImplTest extends EditorColorSchemeTestCase {
         }
       }
       TextAttributes targetAttributes = ((AbstractColorsScheme)targetScheme).getDirectlyDefinedAttributes(testKey);
-      assertTrue(targetAttributes != null && targetAttributes.isFallbackEnabled());
+      assertTrue(targetAttributes != null && targetAttributes == USE_INHERITED_MARKER);
     }
     finally {
       TextAttributesKey.removeTextAttributesKey(testKey.getExternalName());
index 7e12efb1702d6c8166dd6dca5b0dad35725a2cbe..a5866deabb4adb33f7fd2d5272119739463fb4fb 100644 (file)
@@ -172,7 +172,6 @@ public final class TextAttributesReaderTest extends LightPlatformTestCase {
     assertEquals(expected, actual);
     // EditorColorsSchemeImplTest.testWriteInheritedFromDefault
     // EditorColorsSchemeImplTest.testWriteInheritedFromDarcula
-    assertEquals(expected.isEnforceEmpty(), actual.isEnforceEmpty());
   }
 
   @NotNull
similarity index 71%
rename from plugins/gradle/lib/gradle-2.13-src.zip
rename to plugins/gradle/lib/gradle-2.14.1-src.zip
index f80d84301b027f1b6bc747a9e3d52d9d7c3fcdde..6e492dd2ce036b7207a369b8264af2f04116e674 100644 (file)
Binary files a/plugins/gradle/lib/gradle-2.13-src.zip and b/plugins/gradle/lib/gradle-2.14.1-src.zip differ
similarity index 52%
rename from plugins/gradle/lib/gradle-base-services-2.13.jar
rename to plugins/gradle/lib/gradle-base-services-2.14.1.jar
index 4630ecae996250c25becb657e98153f747b7ebeb..a7da31a33a5a7c30a94d0732cd6b270a09d9bae5 100644 (file)
Binary files a/plugins/gradle/lib/gradle-base-services-2.13.jar and b/plugins/gradle/lib/gradle-base-services-2.14.1.jar differ
similarity index 81%
rename from plugins/gradle/lib/gradle-base-services-groovy-2.13.jar
rename to plugins/gradle/lib/gradle-base-services-groovy-2.14.1.jar
index 6309eb3c623825f64805c6bcf2ee78b97911b496..555584c393e1eb7345d17c1ac7e91989fe47a730 100644 (file)
Binary files a/plugins/gradle/lib/gradle-base-services-groovy-2.13.jar and b/plugins/gradle/lib/gradle-base-services-groovy-2.14.1.jar differ
similarity index 86%
rename from plugins/gradle/lib/gradle-cli-2.13.jar
rename to plugins/gradle/lib/gradle-cli-2.14.1.jar
index 792270433a99c62d6a5bec8b260af7d4d89ca755..f758d17c0cdb6f8b3196edf1c88443a50dc902c9 100644 (file)
Binary files a/plugins/gradle/lib/gradle-cli-2.13.jar and b/plugins/gradle/lib/gradle-cli-2.14.1.jar differ
similarity index 58%
rename from plugins/gradle/lib/gradle-core-2.13.jar
rename to plugins/gradle/lib/gradle-core-2.14.1.jar
index e5e712c2bffb49572aabfb8585eb3014e0ea2d69..152abf46c8edfbfc2df4947a4e8fc5652d33130e 100644 (file)
Binary files a/plugins/gradle/lib/gradle-core-2.13.jar and b/plugins/gradle/lib/gradle-core-2.14.1.jar differ
diff --git a/plugins/gradle/lib/gradle-logging-2.14.1.jar b/plugins/gradle/lib/gradle-logging-2.14.1.jar
new file mode 100644 (file)
index 0000000..d248a04
Binary files /dev/null and b/plugins/gradle/lib/gradle-logging-2.14.1.jar differ
diff --git a/plugins/gradle/lib/gradle-messaging-2.13.jar b/plugins/gradle/lib/gradle-messaging-2.13.jar
deleted file mode 100644 (file)
index cd06de6..0000000
Binary files a/plugins/gradle/lib/gradle-messaging-2.13.jar and /dev/null differ
diff --git a/plugins/gradle/lib/gradle-messaging-2.14.1.jar b/plugins/gradle/lib/gradle-messaging-2.14.1.jar
new file mode 100644 (file)
index 0000000..4139708
Binary files /dev/null and b/plugins/gradle/lib/gradle-messaging-2.14.1.jar differ
similarity index 59%
rename from plugins/gradle/lib/gradle-model-core-2.13.jar
rename to plugins/gradle/lib/gradle-model-core-2.14.1.jar
index d9c21f9cada8a6d8e639ddc40e3a04bcbea9197e..a5ce28ea2742d51caf31d48aa4118598d01146c2 100644 (file)
Binary files a/plugins/gradle/lib/gradle-model-core-2.13.jar and b/plugins/gradle/lib/gradle-model-core-2.14.1.jar differ
similarity index 79%
rename from plugins/gradle/lib/gradle-model-groovy-2.13.jar
rename to plugins/gradle/lib/gradle-model-groovy-2.14.1.jar
index e079278570875502d928f7c09cc1fb52adee346e..48a31bfc77c7675718655cfb353ce949ac50c57e 100644 (file)
Binary files a/plugins/gradle/lib/gradle-model-groovy-2.13.jar and b/plugins/gradle/lib/gradle-model-groovy-2.14.1.jar differ
similarity index 74%
rename from plugins/gradle/lib/gradle-native-2.13.jar
rename to plugins/gradle/lib/gradle-native-2.14.1.jar
index b13f5c5e94274befa5ff012d00813e96509f766a..825b53228aade7134d9815ed5503c045bbe6e4b5 100644 (file)
Binary files a/plugins/gradle/lib/gradle-native-2.13.jar and b/plugins/gradle/lib/gradle-native-2.14.1.jar differ
diff --git a/plugins/gradle/lib/gradle-process-services-2.14.1.jar b/plugins/gradle/lib/gradle-process-services-2.14.1.jar
new file mode 100644 (file)
index 0000000..b8f8957
Binary files /dev/null and b/plugins/gradle/lib/gradle-process-services-2.14.1.jar differ
similarity index 66%
rename from plugins/gradle/lib/gradle-resources-2.13.jar
rename to plugins/gradle/lib/gradle-resources-2.14.1.jar
index e79f69c23936d8fd1f925a9afa876d44344cc4f1..6cfb52700baa5afb211df1fb5ee6887b78a04ee3 100644 (file)
Binary files a/plugins/gradle/lib/gradle-resources-2.13.jar and b/plugins/gradle/lib/gradle-resources-2.14.1.jar differ
similarity index 50%
rename from plugins/gradle/lib/gradle-tooling-api-2.13.jar
rename to plugins/gradle/lib/gradle-tooling-api-2.14.1.jar
index 47ae9aa4e17d80acf367987755648f413b87041a..e9cb2f2d09d76ad08972884fceb7415f96123945 100644 (file)
Binary files a/plugins/gradle/lib/gradle-tooling-api-2.13.jar and b/plugins/gradle/lib/gradle-tooling-api-2.14.1.jar differ
similarity index 82%
rename from plugins/gradle/lib/gradle-wrapper-2.13.jar
rename to plugins/gradle/lib/gradle-wrapper-2.14.1.jar
index fdae99e29c0a545e443d5dd0e3c96ff4d9c82db1..e0949a01095c2daea94f9763f122a583299c2afc 100644 (file)
Binary files a/plugins/gradle/lib/gradle-wrapper-2.13.jar and b/plugins/gradle/lib/gradle-wrapper-2.14.1.jar differ
index 8c8d1e61599f635df2bee2558a200bd68338c77a..a3f5075c0a4a4ce4feb20bc984c164e4cdcf3eff 100644 (file)
@@ -9,7 +9,7 @@ task wrapper(type: Wrapper) {
 #if (${GRADLE_VERSION} && ${GRADLE_VERSION} != "")
   gradleVersion = '${GRADLE_VERSION}'
 #else
-  gradleVersion = '2.3'
+  gradleVersion = '2.14.1'
 #end
   distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
 }
index 885515a8ca614623a963a0aaaf3ea7f42ec37641..26cab5564dd5ce85cb14b55f6b65cd2ae3ca093d 100644 (file)
@@ -20,8 +20,8 @@ import org.gradle.internal.Factory;
 import org.gradle.internal.UncheckedException;
 import org.gradle.internal.classpath.ClassPath;
 import org.gradle.internal.classpath.DefaultClassPath;
-import org.gradle.logging.ProgressLogger;
-import org.gradle.logging.ProgressLoggerFactory;
+import org.gradle.internal.logging.progress.ProgressLogger;
+import org.gradle.internal.logging.progress.ProgressLoggerFactory;
 import org.gradle.tooling.BuildCancelledException;
 import org.gradle.tooling.GradleConnectionException;
 import org.gradle.tooling.internal.consumer.Distribution;
similarity index 63%
rename from plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.14.1.jar
index 4f8838624a952a77efd81bf33b349f1b8ff1e1e7..140f5ea7a7afc1fc326a7e619afe10da5aec1534 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-build-init-2.14.1.jar differ
diff --git a/plugins/gradle/tooling-extension-api/lib/gradle-ide-2.13.jar b/plugins/gradle/tooling-extension-api/lib/gradle-ide-2.13.jar
deleted file mode 100644 (file)
index 2ff9950..0000000
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-ide-2.13.jar and /dev/null differ
diff --git a/plugins/gradle/tooling-extension-api/lib/gradle-ide-2.14.1.jar b/plugins/gradle/tooling-extension-api/lib/gradle-ide-2.14.1.jar
new file mode 100644 (file)
index 0000000..c375f75
Binary files /dev/null and b/plugins/gradle/tooling-extension-api/lib/gradle-ide-2.14.1.jar differ
similarity index 77%
rename from plugins/gradle/tooling-extension-api/lib/gradle-language-java-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-language-java-2.14.1.jar
index 55cd5f0d1f17c227d7bcc5a1cdcb04cab6711266..7c55cde6470bf5ede1268a0c8e748ed95b660aef 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-language-java-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-language-java-2.14.1.jar differ
similarity index 63%
rename from plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.14.1.jar
index 8abe3499486caebeb3962eed88251974281b9bdb..ffca68013cc5243d68fc66d3dbd49cb1de0bb55c 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-language-jvm-2.14.1.jar differ
similarity index 62%
rename from plugins/gradle/tooling-extension-api/lib/gradle-language-scala-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-language-scala-2.14.1.jar
index 529c56b15a8b48d8a55d27ad905d6647b4bbd05e..d9a4f602575ac053b61cceeb77cda91a175e5a2b 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-language-scala-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-language-scala-2.14.1.jar differ
similarity index 66%
rename from plugins/gradle/tooling-extension-api/lib/gradle-platform-base-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-platform-base-2.14.1.jar
index 36a6ee681885a70333d17b98ae0918e24e25c98d..753c518aa7d2360f2ef50f1b75b9557b6841a074 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-platform-base-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-platform-base-2.14.1.jar differ
similarity index 61%
rename from plugins/gradle/tooling-extension-api/lib/gradle-platform-jvm-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-platform-jvm-2.14.1.jar
index b775514c7529b00d38079ecfa060bd2612bf7c80..b81d426cb6b551e7504b7e4252a1c5d5368f939a 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-platform-jvm-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-platform-jvm-2.14.1.jar differ
diff --git a/plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.13.jar b/plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.13.jar
deleted file mode 100644 (file)
index 80048c5..0000000
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.13.jar and /dev/null differ
diff --git a/plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.14.1.jar b/plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.14.1.jar
new file mode 100644 (file)
index 0000000..295f5f4
Binary files /dev/null and b/plugins/gradle/tooling-extension-api/lib/gradle-plugins-2.14.1.jar differ
diff --git a/plugins/gradle/tooling-extension-api/lib/gradle-scala-2.13.jar b/plugins/gradle/tooling-extension-api/lib/gradle-scala-2.13.jar
deleted file mode 100644 (file)
index 2d6c6b2..0000000
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-scala-2.13.jar and /dev/null differ
diff --git a/plugins/gradle/tooling-extension-api/lib/gradle-scala-2.14.1.jar b/plugins/gradle/tooling-extension-api/lib/gradle-scala-2.14.1.jar
new file mode 100644 (file)
index 0000000..f4a3348
Binary files /dev/null and b/plugins/gradle/tooling-extension-api/lib/gradle-scala-2.14.1.jar differ
similarity index 65%
rename from plugins/gradle/tooling-extension-api/lib/gradle-testing-base-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-testing-base-2.14.1.jar
index 26344638289449ccca01ad905d1fca6029942b53..0a2e1ded6fde2cf5b62295a63e60a44ed1acc250 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-testing-base-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-testing-base-2.14.1.jar differ
similarity index 63%
rename from plugins/gradle/tooling-extension-api/lib/gradle-testing-jvm-2.13.jar
rename to plugins/gradle/tooling-extension-api/lib/gradle-testing-jvm-2.14.1.jar
index 98f0c5985e346b506b6999be96aaf691db3fb561..8f893402dc00712dd7c33c1129e04cbb90184f58 100644 (file)
Binary files a/plugins/gradle/tooling-extension-api/lib/gradle-testing-jvm-2.13.jar and b/plugins/gradle/tooling-extension-api/lib/gradle-testing-jvm-2.14.1.jar differ
index 6fa4f7c53e8dc8b470b8e7a7e6a484c5897b4de0..b9d59105ec978ca905f79b48c60c086a268f9210 100644 (file)
     <orderEntry type="module-library" scope="PROVIDED">
       <library name="GradleToolingExtension">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-build-init-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-ide-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-language-java-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-language-jvm-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-platform-base-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-platform-jvm-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-plugins-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-testing-base-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-testing-jvm-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-scala-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-language-scala-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/lib/gradle-reporting-2.13.jar!/" />
-          <root url="jar://$MODULE_DIR$/lib/gradle-ear-2.13.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-build-init-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-ide-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-language-java-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-language-jvm-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-platform-base-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-platform-jvm-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-plugins-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-testing-base-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-testing-jvm-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-scala-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/../tooling-extension-api/lib/gradle-language-scala-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/lib/gradle-reporting-2.14.1.jar!/" />
+          <root url="jar://$MODULE_DIR$/lib/gradle-ear-2.14.1.jar!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="jar://$MODULE_DIR$/../lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/tooling-api/src/main/java" />
-          <root url="jar://$MODULE_DIR$/../lib/gradle-2.13-src.zip!/gradle-2.13/subprojects/ear/src/main/groovy" />
+          <root url="jar://$MODULE_DIR$/../lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/tooling-api/src/main/java" />
+          <root url="jar://$MODULE_DIR$/../lib/gradle-2.14.1-src.zip!/gradle-2.14.1/subprojects/ear/src/main/groovy" />
         </SOURCES>
       </library>
     </orderEntry>
diff --git a/plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.13.jar b/plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.13.jar
deleted file mode 100644 (file)
index 8b329f8..0000000
Binary files a/plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.13.jar and /dev/null differ
diff --git a/plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.14.1.jar b/plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.14.1.jar
new file mode 100644 (file)
index 0000000..7c8ba45
Binary files /dev/null and b/plugins/gradle/tooling-extension-impl/lib/gradle-ear-2.14.1.jar differ
similarity index 80%
rename from plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.13.jar
rename to plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.14.1.jar
index 21ede409d4365a5afdb0f89ae17186b79a74f6b8..cb30e5b26550d67700d3a0a4b9a6a78cd12d5842 100644 (file)
Binary files a/plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.13.jar and b/plugins/gradle/tooling-extension-impl/lib/gradle-reporting-2.14.1.jar differ
diff --git a/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/StubIdeaModule.java b/plugins/gradle/tooling-extension-impl/src/org/jetbrains/plugins/gradle/tooling/internal/StubIdeaModule.java
deleted file mode 100644 (file)
index 64cffb6..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.
- * 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 org.jetbrains.plugins.gradle.tooling.internal;
-
-import org.gradle.tooling.model.DomainObjectSet;
-import org.gradle.tooling.model.GradleProject;
-import org.gradle.tooling.model.HierarchicalElement;
-import org.gradle.tooling.model.UnsupportedMethodException;
-import org.gradle.tooling.model.idea.*;
-
-import java.io.Serializable;
-
-/**
- * @author Vladislav.Soroka
- * @since 11/25/13
- */
-public class StubIdeaModule implements IdeaModule, Serializable {
-
-  private final String name;
-
-  public StubIdeaModule(String name) {
-    this.name = name;
-  }
-
-  @Override
-  public IdeaJavaLanguageSettings getJavaLanguageSettings() throws UnsupportedMethodException {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public DomainObjectSet<? extends IdeaContentRoot> getContentRoots() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public GradleProject getGradleProject() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public IdeaProject getParent() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public DomainObjectSet<? extends HierarchicalElement> getChildren() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public IdeaProject getProject() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public IdeaCompilerOutput getCompilerOutput() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public DomainObjectSet<? extends IdeaDependency> getDependencies() {
-    throw new UnsupportedOperationException();
-  }
-
-  @Override
-  public String getName() {
-    return name;
-  }
-
-  @Override
-  public String getDescription() {
-    throw new UnsupportedOperationException();
-  }
-}
index a96fa48f15af76851aba9b19f7b5af5c878d8d2b..251bc4fabfb0f083261d05bf8c91104f336959a8 100644 (file)
@@ -69,7 +69,7 @@ public abstract class AbstractModelBuilderTest {
 
   public static final Object[][] SUPPORTED_GRADLE_VERSIONS = {
     {"1.9"}, /*{"1.10"}, {"1.11"},*/ {"1.12"},
-    {"2.0"}, /*{"2.1"}, {"2.2"} , {"2.3"}, {"2.4"}, */{"2.5"}, /*{"2.6"}, {"2.7"}, {"2.8"},*/ {"2.9"}, /*{"2.10"}, {"2.11"}, {"2.12"},*/ {"2.13"}
+    {"2.0"}, /*{"2.1"}, {"2.2"} , {"2.3"}, {"2.4"}, */{"2.5"}, /*{"2.6"}, {"2.7"}, {"2.8"},*/ {"2.9"}, /*{"2.10"}, {"2.11"}, {"2.12"}, {"2.13"}, */{"2.14.1"}
   };
   public static final String BASE_GRADLE_VERSION = String.valueOf(SUPPORTED_GRADLE_VERSIONS[SUPPORTED_GRADLE_VERSIONS.length - 1][0]);
 
index f836f73a93f66c45b6541b90ef86c57f3d1c53c5..ed57edd0f066d3fef1e5edc21b89fc871a766403 100644 (file)
@@ -39,6 +39,7 @@ import java.util.List;
 public abstract class AbstractJavaFxPackager {
   private static final Logger LOG = Logger.getInstance("#" + AbstractJavaFxPackager.class.getName());
   private static final String JB_JFX_JKS = "jb-jfx.jks";
+  private static final String NATIVE_BUNDLES = "bundles";
 
   //artifact description
   protected String getArtifactRootName() {
@@ -137,7 +138,7 @@ public abstract class AbstractJavaFxPackager {
   private void copyLibraries(String zipPath, File tempUnzippedArtifactOutput) throws IOException {
     final File[] outFiles = new File(getArtifactOutputPath()).listFiles();
     if (outFiles != null) {
-      final String[] generatedItems = new String[] {JB_JFX_JKS, zipPath + ".jar", zipPath + ".jnlp", zipPath + ".html"};
+      final String[] generatedItems = new String[]{JB_JFX_JKS, zipPath + ".jar", zipPath + ".jnlp", zipPath + ".html", NATIVE_BUNDLES};
       for (File file : outFiles) {
         final String fileName = file.getName();
         if (ArrayUtilRt.find(generatedItems, fileName) < 0) {
index 1198388f6c5f3dba5f3e2bcc67c24e5ddd03f622..88ebebea1d39f73c4afc80a4f13f81f4738cba71 100644 (file)
@@ -136,19 +136,18 @@ public class PyTypeAssertionEvaluator extends PyRecursiveElementVisitor {
   }
 
   @Nullable
-  private static PyType createAssertionType(PyType initial, List<PyType> types, boolean positive, TypeEvalContext context) {
-    final List<PyType> members = new ArrayList<>();
-    for (PyType t : types) {
-      members.add(transformTypeFromAssertion(t));
-    }
-    final PyType union = PyUnionType.union(members);
+  private static PyType createAssertionType(@Nullable PyType initial,
+                                            @Nullable PyType suggested,
+                                            boolean positive,
+                                            @NotNull TypeEvalContext context) {
+    final PyType transformedType = transformTypeFromAssertion(suggested);
     if (positive) {
-      return union;
+      return transformedType;
     }
     else if (initial instanceof PyUnionType) {
-      return ((PyUnionType)initial).exclude(union, context);
+      return ((PyUnionType)initial).exclude(transformedType, context);
     }
-    else if (PyTypeChecker.match(union, initial, context)) {
+    else if (PyTypeChecker.match(transformedType, initial, context)) {
       return null;
     }
     return initial;
@@ -177,9 +176,17 @@ public class PyTypeAssertionEvaluator extends PyRecursiveElementVisitor {
     final InstructionTypeCallback typeCallback = new InstructionTypeCallback() {
       @Override
       public PyType getType(TypeEvalContext context, @Nullable PsiElement anchor) {
-        final List<PyType> types = new ArrayList<>();
-        types.add(suggestedType.apply(context));
-        return createAssertionType(context.getType(target), types, positive, context);
+        final PyType initial = context.getType(target);
+        final PyType suggested = suggestedType.apply(context);
+
+        if (!PyUnionType.class.isInstance(initial) &&
+            !PyTypeChecker.isUnknown(initial) &&
+            PyTypeChecker.match(suggested, initial, context)) {
+          return initial;
+        }
+        else {
+          return createAssertionType(initial, suggested, positive, context);
+        }
       }
     };
 
index a8d51774e6cfdc7ff3e71ef4693888171a1aa6dc..6a15d819d136daa323a2e38a3fe015429c732a32 100644 (file)
@@ -1221,6 +1221,20 @@ public class PyTypeTest extends PyTestCase {
            "        expr = x\n");
   }
 
+  // PY-20818
+  public void testIsInstanceForSuperclass() {
+    doTest("B",
+           "class A:\n" +
+           "    pass\n" +
+           "class B(A):\n" +
+           "    def foo(self):\n" +
+           "        pass\n" +
+           "def test():\n" +
+           "    b = B()\n" +
+           "    assert(isinstance(b, A))\n" +
+           "    expr = b\n");
+  }
+
   private static List<TypeEvalContext> getTypeEvalContexts(@NotNull PyExpression element) {
     return ImmutableList.of(TypeEvalContext.codeAnalysis(element.getProject(), element.getContainingFile()).withTracing(),
                             TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).withTracing());