diff --git a/build/scripts/download_kotlin.gant b/build/scripts/download_kotlin.gant index 6b7e58c30aec..b383fade563c 100644 --- a/build/scripts/download_kotlin.gant +++ b/build/scripts/download_kotlin.gant @@ -190,7 +190,7 @@ private String readKotlinClassVersionOfCompiledClasses() { } } -private String readKotlinClassFileVersion(InputStream classFileStream) { +private static String readKotlinClassFileVersion(InputStream classFileStream) { def reader = new ClassReader(classFileStream) String kotlinBytecodeVersion = null String kotlinMetaDataVersion = null @@ -209,7 +209,8 @@ private String readKotlinClassFileVersion(InputStream classFileStream) { return new AnnotationVisitor(Opcodes.ASM5) { void visit(String name, Object value) { if (name == "mv") { - kotlinMetaDataVersion = (value as Integer[]).join(".") + //strip patch number of metadata version because changes in patch updates are forward and backward compatible + kotlinMetaDataVersion = (value as Integer[]).toList().dropRight(1).join(".") } else if (name == "bv") { kotlinBytecodeVersion = (value as Integer[]).join(".") diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/DefaultCodeFragmentFactory.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/DefaultCodeFragmentFactory.java index 830ecbb70a63..a69cd899f960 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/DefaultCodeFragmentFactory.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/DefaultCodeFragmentFactory.java @@ -18,6 +18,7 @@ package com.intellij.debugger.engine.evaluation; import com.intellij.codeInsight.completion.CompletionParameters; import com.intellij.codeInsight.completion.CompletionService; import com.intellij.codeInsight.completion.JavaCompletionUtil; +import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil; import com.intellij.debugger.DebuggerManagerEx; import com.intellij.debugger.codeinsight.RuntimeTypeEvaluator; import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilder; @@ -75,6 +76,7 @@ public class DefaultCodeFragmentFactory extends CodeFragmentFactory { fragment.setVisibilityChecker(JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE); //noinspection HardCodedStringLiteral fragment.putUserData(KEY, "DebuggerComboBoxEditor.IS_DEBUGGER_EDITOR"); + fragment.putUserData(HighlightUtil.DISABLE_RETURN_CHECK_IN_CODE_FRAGMENT, true); fragment.putCopyableUserData(JavaCompletionUtil.DYNAMIC_TYPE_EVALUATOR, new PairFunction() { public PsiType fun(PsiExpression expression, CompletionParameters parameters) { if (!RuntimeTypeEvaluator.isSubtypeable(expression)) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java index c061dba79582..0cda6140d70e 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java @@ -87,6 +87,8 @@ public class HighlightUtil extends HighlightUtilBase { @NonNls private static final String SERIAL_PERSISTENT_FIELDS_FIELD_NAME = "serialPersistentFields"; private static final QuickFixFactory QUICK_FIX_FACTORY = QuickFixFactory.getInstance(); + public static final Key DISABLE_RETURN_CHECK_IN_CODE_FRAGMENT = Key.create("DISABLE_RETURN_CHECK_IN_CODE_FRAGMENT"); + private HighlightUtil() { } static { @@ -594,6 +596,9 @@ public class HighlightUtil extends HighlightUtilBase { } parent = parent.getParent(); } + if (parent instanceof PsiCodeFragment && parent.getUserData(DISABLE_RETURN_CHECK_IN_CODE_FRAGMENT) != null) { + return null; + } String description; HighlightInfo errorResult = null; if (method == null && lambda != null) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java index 0ffe3732748b..cdd8e6814326 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/OrderEntryFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -163,7 +163,8 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix { PsiFile fromFile = element.getContainingFile(); List result = new ArrayList(); for (PsiClass psiClass : classes) { - if (dependencyValidationManager.getViolatorDependencyRule(fromFile, psiClass.getContainingFile()) == null) { + PsiFile containingFile = psiClass.getContainingFile(); + if (containingFile != null && dependencyValidationManager.getViolatorDependencyRule(fromFile, containingFile) == null) { result.add(psiClass); } } diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java index 99a9f63a431d..bc5740508172 100644 --- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java +++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaParameterInfo.java @@ -41,4 +41,5 @@ public interface JavaParameterInfo extends ParameterInfo { boolean isVarargType(); + default void setType(@Nullable PsiType type) {} } diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java index ecb68903d1da..9bc2bba3b570 100644 --- a/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java +++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ParameterInfoImpl.java @@ -124,6 +124,7 @@ public class ParameterInfoImpl implements JavaParameterInfo { } } + @Override public void setType(PsiType type) { myType = CanonicalTypes.createTypeWrapper(type); } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiDiamondTypeUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiDiamondTypeUtil.java index c449aa665f99..d9b0c797a3ae 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiDiamondTypeUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiDiamondTypeUtil.java @@ -195,7 +195,9 @@ public class PsiDiamondTypeUtil { final PsiFile fileCopy = (PsiFile)containingFile.copy(); copy = fileCopy.findElementAt(offset); if (method != null && method.getContainingFile() == containingFile) { - method = PsiTreeUtil.getParentOfType(fileCopy.findElementAt(method.getTextOffset()), PsiMethod.class); + final PsiElement startMethodElementInCopy = fileCopy.findElementAt(method.getTextOffset()); + method = PsiTreeUtil.getParentOfType(startMethodElementInCopy, PsiMethod.class); + LOG.assertTrue(method != null, startMethodElementInCopy); } } final PsiCallExpression exprCopy = PsiTreeUtil.getParentOfType(copy, PsiCallExpression.class, false); diff --git a/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java index c16ea7f0c04b..b61cf5bd524a 100644 --- a/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java +++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/TypeMigrationVariableTypeFixProvider.java @@ -8,6 +8,7 @@ import com.intellij.codeInsight.FileModificationService; import com.intellij.codeInsight.daemon.impl.quickfix.VariableTypeFix; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.quickfix.ChangeVariableTypeQuickFixProvider; +import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.command.undo.UndoUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; @@ -74,7 +75,7 @@ public class TypeMigrationVariableTypeFixProvider implements ChangeVariableTypeQ final TypeMigrationRules rules = new TypeMigrationRules(); rules.setBoundScope(GlobalSearchScope.projectScope(project)); TypeMigrationProcessor.runHighlightingTypeMigration(project, editor, rules, variable, targetType, optimizeImports); - JavaCodeStyleManager.getInstance(project).shortenClassReferences(variable); + WriteAction.run(() -> JavaCodeStyleManager.getInstance(project).shortenClassReferences(variable)); UndoUtil.markPsiFileForUndo(variable.getContainingFile()); } catch (IncorrectOperationException e) { diff --git a/lib/pty4j-0.6.jar b/lib/pty4j-0.6.jar index 950ab6129ad4..af105c2ff1ef 100644 Binary files a/lib/pty4j-0.6.jar and b/lib/pty4j-0.6.jar differ diff --git a/lib/src/pty4j-0.6-src.jar b/lib/src/pty4j-0.6-src.jar index b6ef30cdc34b..52e9d1e7ad4c 100644 Binary files a/lib/src/pty4j-0.6-src.jar and b/lib/src/pty4j-0.6-src.jar differ diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorBase.java b/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorBase.java index 3ac277c96d8e..d0e642abae10 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorBase.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ProblemDescriptorBase.java @@ -67,7 +67,7 @@ public class ProblemDescriptorBase extends CommonProblemDescriptorImpl implement LOG.assertTrue(endElementRange != null, endElement); if (startElementRange.getStartOffset() >= endElementRange.getEndOffset()) { if (!(startElement instanceof PsiFile && endElement instanceof PsiFile)) { - LOG.error("Empty PSI elements should not be passed to createDescriptor. Start: " + startElement + ", end: " + endElement); + LOG.error("Empty PSI elements should not be passed to createDescriptor. Start: " + startElement + ", end: " + endElement + ", startContainingFile: " + startContainingFile); } } diff --git a/platform/icons/src/ide/notification/errorEvents.png b/platform/icons/src/ide/notification/errorEvents.png index 8fe04b8971c0..d271acd2e6e4 100644 Binary files a/platform/icons/src/ide/notification/errorEvents.png and b/platform/icons/src/ide/notification/errorEvents.png differ diff --git a/platform/icons/src/ide/notification/errorEvents@2x.png b/platform/icons/src/ide/notification/errorEvents@2x.png index 7450904c5d57..42d5517b0965 100644 Binary files a/platform/icons/src/ide/notification/errorEvents@2x.png and b/platform/icons/src/ide/notification/errorEvents@2x.png differ diff --git a/platform/icons/src/ide/notification/errorEvents@2x_dark.png b/platform/icons/src/ide/notification/errorEvents@2x_dark.png new file mode 100644 index 000000000000..dc0d8b8eb0c6 Binary files /dev/null and b/platform/icons/src/ide/notification/errorEvents@2x_dark.png differ diff --git a/platform/icons/src/ide/notification/errorEvents_dark.png b/platform/icons/src/ide/notification/errorEvents_dark.png new file mode 100644 index 000000000000..bc4661a16847 Binary files /dev/null and b/platform/icons/src/ide/notification/errorEvents_dark.png differ diff --git a/platform/icons/src/ide/notification/infoEvents.png b/platform/icons/src/ide/notification/infoEvents.png index 3ce39c835959..09ffd5ac1a4f 100644 Binary files a/platform/icons/src/ide/notification/infoEvents.png and b/platform/icons/src/ide/notification/infoEvents.png differ diff --git a/platform/icons/src/ide/notification/infoEvents@2x.png b/platform/icons/src/ide/notification/infoEvents@2x.png index c9fb87e2400d..fb467e8e0301 100644 Binary files a/platform/icons/src/ide/notification/infoEvents@2x.png and b/platform/icons/src/ide/notification/infoEvents@2x.png differ diff --git a/platform/icons/src/ide/notification/infoEvents@2x_dark.png b/platform/icons/src/ide/notification/infoEvents@2x_dark.png new file mode 100644 index 000000000000..05a6020f95e7 Binary files /dev/null and b/platform/icons/src/ide/notification/infoEvents@2x_dark.png differ diff --git a/platform/icons/src/ide/notification/infoEvents_dark.png b/platform/icons/src/ide/notification/infoEvents_dark.png new file mode 100644 index 000000000000..1ff6d93461cc Binary files /dev/null and b/platform/icons/src/ide/notification/infoEvents_dark.png differ diff --git a/platform/icons/src/ide/notification/noEvents.png b/platform/icons/src/ide/notification/noEvents.png index 0cbeeed2a9fb..da816bfad5c7 100644 Binary files a/platform/icons/src/ide/notification/noEvents.png and b/platform/icons/src/ide/notification/noEvents.png differ diff --git a/platform/icons/src/ide/notification/noEvents@2x.png b/platform/icons/src/ide/notification/noEvents@2x.png index 9ef60cceccdb..e6aea9da012b 100644 Binary files a/platform/icons/src/ide/notification/noEvents@2x.png and b/platform/icons/src/ide/notification/noEvents@2x.png differ diff --git a/platform/icons/src/ide/notification/noEvents@2x_dark.png b/platform/icons/src/ide/notification/noEvents@2x_dark.png new file mode 100644 index 000000000000..2b8483d65769 Binary files /dev/null and b/platform/icons/src/ide/notification/noEvents@2x_dark.png differ diff --git a/platform/icons/src/ide/notification/noEvents_dark.png b/platform/icons/src/ide/notification/noEvents_dark.png new file mode 100644 index 000000000000..1cd65b8f64be Binary files /dev/null and b/platform/icons/src/ide/notification/noEvents_dark.png differ diff --git a/platform/icons/src/ide/notification/warningEvents.png b/platform/icons/src/ide/notification/warningEvents.png index 7a2696747933..cc57f81d9406 100644 Binary files a/platform/icons/src/ide/notification/warningEvents.png and b/platform/icons/src/ide/notification/warningEvents.png differ diff --git a/platform/icons/src/ide/notification/warningEvents@2x.png b/platform/icons/src/ide/notification/warningEvents@2x.png index acd4f27c739e..4e6d79899a50 100644 Binary files a/platform/icons/src/ide/notification/warningEvents@2x.png and b/platform/icons/src/ide/notification/warningEvents@2x.png differ diff --git a/platform/icons/src/ide/notification/warningEvents@2x_dark.png b/platform/icons/src/ide/notification/warningEvents@2x_dark.png new file mode 100644 index 000000000000..1963cf4b4d95 Binary files /dev/null and b/platform/icons/src/ide/notification/warningEvents@2x_dark.png differ diff --git a/platform/icons/src/ide/notification/warningEvents_dark.png b/platform/icons/src/ide/notification/warningEvents_dark.png new file mode 100644 index 000000000000..3b0a345f219b Binary files /dev/null and b/platform/icons/src/ide/notification/warningEvents_dark.png differ diff --git a/platform/lang-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveDirectoryWithClassesHelper.java b/platform/lang-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveDirectoryWithClassesHelper.java index c354dddf5c15..30acd20da80e 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveDirectoryWithClassesHelper.java +++ b/platform/lang-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveDirectoryWithClassesHelper.java @@ -121,9 +121,9 @@ public abstract class MoveDirectoryWithClassesHelper { } private static class MyUsageInfo extends UsageInfo { - private final PsiFileSystemItem myFile; + private final @NotNull PsiFileSystemItem myFile; - public MyUsageInfo(@NotNull PsiReference reference, PsiFileSystemItem file) { + public MyUsageInfo(@NotNull PsiReference reference, @NotNull PsiFileSystemItem file) { super(reference); myFile = file; } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java b/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java index 021646b39ba6..79e434340247 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/IdeNotificationArea.java @@ -23,16 +23,18 @@ import com.intellij.notification.EventLog; import com.intellij.notification.LogModel; import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; +import com.intellij.notification.impl.ui.NotificationsUtil; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.wm.CustomStatusBarWidget; import com.intellij.openapi.wm.IconLikeCustomStatusBarWidget; import com.intellij.openapi.wm.StatusBar; import com.intellij.openapi.wm.ToolWindow; import com.intellij.ui.ClickListener; +import com.intellij.ui.JBColor; import com.intellij.ui.LayeredIcon; +import com.intellij.ui.SimpleColoredComponent; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -125,15 +127,17 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget } private LayeredIcon createIconWithNotificationCount(ArrayList notifications) { + return createIconWithNotificationCount(this, getMaximumType(notifications), notifications.size()); + } + + @NotNull + public static LayeredIcon createIconWithNotificationCount(JComponent component, NotificationType type, int size) { LayeredIcon icon = new LayeredIcon(2); - NotificationType type = getMaximumType(notifications); - Icon statusIcon = getPendingNotificationsIcon(AllIcons.Ide.Notification.NoEvents, type); - icon.setIcon(statusIcon, 0); - int size = notifications.size(); + icon.setIcon(getPendingNotificationsIcon(AllIcons.Ide.Notification.NoEvents, type), 0); if (size > 0) { //noinspection UseJBColor - Color textColor = type == NotificationType.ERROR ? Color.white : Color.black; - icon.setIcon(new TextIcon(this, size < 10 ? String.valueOf(size) : "9+", textColor), 1); + Color textColor = type == NotificationType.ERROR ? new JBColor(Color.white, new Color(0xF2F2F2)) : new Color(0x333333); + icon.setIcon(new TextIcon(component, size < 10 ? String.valueOf(size) : "9+", textColor), 1); } return icon; } @@ -181,12 +185,14 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget private final JComponent myComponent; private final Color myTextColor; private final int myWidth; + private final Font myFont; public TextIcon(JComponent component, @NotNull String str, @NotNull Color textColor) { myStr = str; myComponent = component; myTextColor = textColor; - myWidth = myComponent.getFontMetrics(calcFont()).stringWidth(myStr); + myFont = new Font(NotificationsUtil.getFontName(), Font.BOLD, 9); + myWidth = myComponent.getFontMetrics(myFont).stringWidth(myStr) + 1; } @Override @@ -217,13 +223,10 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget Font originalFont = g.getFont(); Color originalColor = g.getColor(); - g.setFont(calcFont()); + g.setFont(myFont); x += (getIconWidth() - myWidth) / 2; - y += getIconHeight() / 2 + g.getFontMetrics().getDescent(); - if (!SystemInfo.isLinux && myStr.length() > 1) { - x++; - } + y += SimpleColoredComponent.getTextBaseLine(g.getFontMetrics(), getIconHeight()); g.setColor(myTextColor); g.drawString(myStr, x, y); @@ -232,14 +235,6 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget g.setColor(originalColor); } - private Font calcFont() { - float size = (float)getIconHeight() * 3 / 5; - if (myStr.length() > 1) { - size--; - } - return myComponent.getFont().deriveFont(size); - } - @Override public int getIconWidth() { return AllIcons.Ide.Notification.NoEvents.getIconWidth(); diff --git a/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java b/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java index 5a44d0a1a731..95fae4f3f789 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/actions/NotificationTestAction.java @@ -175,6 +175,9 @@ public class NotificationTestAction extends AnAction implements DumbAware { notification.setActions(StringUtil.split(value, ",")); } } + else if (line.startsWith("Type:")) { + notification.setType(StringUtil.substringAfter(line, ":")); + } else if (line.startsWith("Sticky:")) { notification.setSticky("true".equals(StringUtil.substringAfter(line, ":"))); } @@ -200,6 +203,7 @@ public class NotificationTestAction extends AnAction implements DumbAware { private String mySubtitle; private List myContent; private List myActions; + private NotificationType myType = NotificationType.INFORMATION; private boolean mySticky; private boolean myAddListener; @@ -218,10 +222,10 @@ public class NotificationTestAction extends AnAction implements DumbAware { String content = myContent == null ? "" : StringUtil.join(myContent, "\n"); if (icon == null) { myNotification = - new Notification(displayId, StringUtil.notNullize(myTitle), content, NotificationType.INFORMATION, getListener()); + new Notification(displayId, StringUtil.notNullize(myTitle), content, myType, getListener()); } else { - myNotification = new Notification(displayId, icon, myTitle, mySubtitle, content, NotificationType.INFORMATION, getListener()); + myNotification = new Notification(displayId, icon, myTitle, mySubtitle, content, myType, getListener()); if (myActions != null) { for (String action : myActions) { myNotification.addAction(new MyAnAction(action)); @@ -268,6 +272,18 @@ public class NotificationTestAction extends AnAction implements DumbAware { mySticky = sticky; } + public void setType(@Nullable String type) { + if ("info".equals(type)) { + myType = NotificationType.INFORMATION; + } + else if ("error".equals(type)) { + myType = NotificationType.ERROR; + } + else if ("warn".equals(type)) { + myType = NotificationType.WARNING; + } + } + @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { if (MessageDialogBuilder.yesNo("Notification Listener", event.getDescription() + " Expire?").is()) { diff --git a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsUtil.java b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsUtil.java index 1a3f8698f3ce..ad2a40882e31 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsUtil.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsUtil.java @@ -124,18 +124,18 @@ public class NotificationsUtil { @Nullable public static String getFontStyle() { - String fontName = null; + String fontName = getFontName(); + return StringUtil.isEmpty(fontName) ? null : "font-family:" + fontName + ";"; + } + + @Nullable + public static String getFontName() { UISettings uiSettings = UISettings.getInstance(); if (uiSettings.OVERRIDE_NONIDEA_LAF_FONTS) { - fontName = uiSettings.FONT_FACE; + return uiSettings.FONT_FACE; } - else { - Pair systemFontData = UIUtil.getSystemFontData(); - if (systemFontData != null) { - fontName = systemFontData.first; - } - } - return StringUtil.isEmpty(fontName) ? null : "font-family:" + fontName + ";"; + Pair systemFontData = UIUtil.getSystemFontData(); + return systemFontData == null ? null : systemFontData.first; } @Nullable diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index b355a31e636e..529699f4b361 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -1080,7 +1080,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi * @param fontSize new font size * @param zoomCenter zoom point, relative to viewport */ - private void setFontSize(final int fontSize, @Nullable Point zoomCenter) { + private void setFontSize(int fontSize, @Nullable Point zoomCenter) { int oldFontSize = myScheme.getEditorFontSize(); Rectangle visibleArea = myScrollingModel.getVisibleArea(); @@ -1091,6 +1091,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi int intraLineOffset = zoomCenterAbsolute.y % oldLineHeight; myScheme.setEditorFontSize(fontSize); + fontSize = myScheme.getEditorFontSize(); // resulting font size might be different due to applied min/max limits myPropertyChangeSupport.firePropertyChange(PROP_FONT_SIZE, oldFontSize, fontSize); // Update vertical scroll bar bounds if necessary (we had a problem that use increased editor font size and it was not possible // to scroll to the bottom of the document). diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java index 63287d96a8dc..c579afd0d46c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java @@ -18,6 +18,7 @@ package com.intellij.openapi.wm.impl; import com.intellij.ide.UiActivity; import com.intellij.ide.UiActivityMonitor; import com.intellij.ide.impl.ContentManagerWatcher; +import com.intellij.notification.EventLog; import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.application.ApplicationManager; @@ -393,8 +394,10 @@ public final class ToolWindowImpl implements ToolWindowEx { public final void setIcon(final Icon icon) { ApplicationManager.getApplication().assertIsDispatchThread(); final Icon oldIcon = getIcon(); - if (oldIcon != icon && icon != null && !(icon instanceof LayeredIcon) && (icon.getIconHeight() != JBUI.scale(13) || icon.getIconWidth() != JBUI.scale(13))) { - LOG.warn("ToolWindow icons should be 13x13. Please fix ToolWindow (ID: " + getId() + ") or icon " + icon); + if (!EventLog.LOG_TOOL_WINDOW_ID.equals(getId())) { + if (oldIcon != icon && icon != null && !(icon instanceof LayeredIcon) && (icon.getIconHeight() != JBUI.scale(13) || icon.getIconWidth() != JBUI.scale(13))) { + LOG.warn("ToolWindow icons should be 13x13. Please fix ToolWindow (ID: " + getId() + ") or icon " + icon); + } } //getSelectedContent().setIcon(icon); myIcon = icon; diff --git a/platform/platform-tests/testSrc/com/intellij/execution/PtyCommandLineTest.java b/platform/platform-tests/testSrc/com/intellij/execution/PtyCommandLineTest.java index cfcbbb27f61c..d3cb2bc5ae0c 100644 --- a/platform/platform-tests/testSrc/com/intellij/execution/PtyCommandLineTest.java +++ b/platform/platform-tests/testSrc/com/intellij/execution/PtyCommandLineTest.java @@ -36,29 +36,4 @@ public class PtyCommandLineTest extends GeneralCommandLineTest { return cmd; } - - @Override - public void unicodePath() { - assumeFalse(SystemInfo.isWindows); - } - - @Override - public void unicodeClassPath() { - assumeFalse(SystemInfo.isWindows); - } - - @Override - public void passingArgumentsToJavaApp() { - assumeFalse(SystemInfo.isWindows); - } - - @Override - public void passingArgumentsToJavaAppThroughWinShell() { - assumeFalse(SystemInfo.isWindows); - } - - @Override - public void passingArgumentsToJavaAppThroughCmdScriptAndWinShell() { - assumeFalse(SystemInfo.isWindows); - } } \ No newline at end of file diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/VariablesHost.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/VariablesHost.java index a0f189409166..746016d690cf 100644 --- a/platform/script-debugger/backend/src/org/jetbrains/debugger/VariablesHost.java +++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/VariablesHost.java @@ -34,7 +34,7 @@ public abstract class VariablesHost { @NotNull @Override - public Promise> load(@NotNull VariablesHost host) { + public Promise load(@NotNull VariablesHost host) { return host.valueManager.isObsolete() ? ValueManager.Companion.reject() : host.load(); } }; diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index 456a0ac0d5c0..d7c129700dc5 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -579,6 +579,16 @@ public class StringUtil extends StringUtilRt { @Nullable String additionalChars, boolean escapeSlash, @NotNull @NonNls StringBuilder buffer) { + return escapeStringCharacters(length, str, additionalChars, escapeSlash, true, buffer); + } + + @NotNull + public static StringBuilder escapeStringCharacters(int length, + @NotNull String str, + @Nullable String additionalChars, + boolean escapeSlash, + boolean escapeUnicode, + @NotNull @NonNls StringBuilder buffer) { char prev = 0; for (int idx = 0; idx < length; idx++) { char ch = str.charAt(idx); @@ -610,7 +620,7 @@ public class StringUtil extends StringUtilRt { else if (additionalChars != null && additionalChars.indexOf(ch) > -1 && (escapeSlash || prev != '\\')) { buffer.append("\\").append(ch); } - else if (!isPrintableUnicode(ch)) { + else if (escapeUnicode && !isPrintableUnicode(ch)) { CharSequence hexCode = StringUtilRt.toUpperCase(Integer.toHexString(ch)); buffer.append("\\u"); int paddingCount = 4 - hexCode.length(); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java index f2b582be401e..f07f73083965 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/frame/VcsLogGraphTable.java @@ -55,7 +55,7 @@ import com.intellij.vcs.log.ui.VcsLogColorManager; import com.intellij.vcs.log.ui.VcsLogColorManagerImpl; import com.intellij.vcs.log.ui.VcsLogUiImpl; import com.intellij.vcs.log.ui.render.GraphCommitCell; -import com.intellij.vcs.log.ui.render.GraphCommitCellRender; +import com.intellij.vcs.log.ui.render.GraphCommitCellRenderer; import com.intellij.vcs.log.ui.tables.GraphTableModel; import com.intellij.vcs.log.util.VcsUserUtil; import gnu.trove.TIntHashSet; @@ -92,7 +92,7 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi @NotNull private final VcsLogDataManager myLogDataManager; @NotNull private final MyDummyTableCellEditor myDummyEditor = new MyDummyTableCellEditor(); @NotNull private final TableCellRenderer myDummyRenderer = new DefaultTableCellRenderer(); - @NotNull private final GraphCommitCellRender myGraphCommitCellRenderer; + @NotNull private final GraphCommitCellRenderer myGraphCommitCellRenderer; private boolean myColumnsSizeInitialized = false; @Nullable private Selection mySelection = null; @@ -109,7 +109,7 @@ public class VcsLogGraphTable extends JBTable implements DataProvider, CopyProvi super(new GraphTableModel(initialDataPack, logDataManager, ui)); myUi = ui; myLogDataManager = logDataManager; - myGraphCommitCellRenderer = new GraphCommitCellRender(logDataManager, myGraphCellPainter, this); + myGraphCommitCellRenderer = new GraphCommitCellRenderer(logDataManager, myGraphCellPainter, this); setDefaultRenderer(VirtualFile.class, new RootCellRenderer(myUi)); setDefaultRenderer(GraphCommitCell.class, myGraphCommitCellRenderer); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRender.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRenderer.java similarity index 96% rename from platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRender.java rename to platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRenderer.java index cfe770837ec1..b9c53dd5ce63 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRender.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRenderer.java @@ -24,9 +24,9 @@ import java.util.Collections; import java.util.List; import java.util.Map; -public class GraphCommitCellRender extends ColoredTableCellRenderer { +public class GraphCommitCellRenderer extends ColoredTableCellRenderer { - private static final Logger LOG = Logger.getInstance(GraphCommitCellRender.class); + private static final Logger LOG = Logger.getInstance(GraphCommitCellRenderer.class); @NotNull private final VcsLogDataManager myDataManager; @NotNull private final GraphCellPainter myPainter; @@ -39,9 +39,9 @@ public class GraphCommitCellRender extends ColoredTableCellRenderer { @NotNull private Font myFont; private int myHeight; - public GraphCommitCellRender(@NotNull VcsLogDataManager dataManager, - @NotNull GraphCellPainter painter, - @NotNull VcsLogGraphTable table) { + public GraphCommitCellRenderer(@NotNull VcsLogDataManager dataManager, + @NotNull GraphCellPainter painter, + @NotNull VcsLogGraphTable table) { myDataManager = dataManager; myPainter = painter; myGraphTable = table; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java index f1c6d7a35144..9e70f0f94202 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java @@ -133,11 +133,11 @@ public class XBreakpointUtil { * - if folded, checks if line breakpoints could be toggled inside folded text */ @NotNull - public static Promise toggleLineBreakpoint(@NotNull Project project, - @NotNull XSourcePosition position, - @Nullable Editor editor, - boolean temporary, - boolean moveCarret) { + public static Promise toggleLineBreakpoint(@NotNull Project project, + @NotNull XSourcePosition position, + @Nullable Editor editor, + boolean temporary, + boolean moveCarret) { int lineStart = position.getLine(); VirtualFile file = position.getFile(); // for folded text check each line and find out type with the biggest priority diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java index dcbaf0d6b44a..e889d6c4ad71 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java @@ -52,10 +52,12 @@ import com.intellij.util.ui.update.Update; import com.intellij.xdebugger.XDebuggerManager; import com.intellij.xdebugger.breakpoints.SuspendPolicy; import com.intellij.xdebugger.breakpoints.XBreakpoint; +import com.intellij.xdebugger.breakpoints.XLineBreakpoint; import com.intellij.xdebugger.impl.XSourcePositionImpl; import com.intellij.xdebugger.impl.ui.DebuggerUIUtil; import gnu.trove.TIntHashSet; import org.jetbrains.annotations.NotNull; +import org.jetbrains.concurrency.Promise; import java.awt.event.MouseEvent; import java.util.Collection; @@ -280,8 +282,8 @@ public class XLineBreakpointManager { if (line >= 0 && line < document.getLineCount() && file != null) { ActionManagerEx.getInstanceEx().fireBeforeActionPerformed(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT, e.getMouseEvent()); - XBreakpointUtil - .toggleLineBreakpoint(myProject, XSourcePositionImpl.create(file, line), editor, mouseEvent.isAltDown(), false) + final Promise lineBreakpoint = XBreakpointUtil.toggleLineBreakpoint(myProject, XSourcePositionImpl.create(file, line), editor, mouseEvent.isAltDown(), false); + lineBreakpoint .done(breakpoint -> { if (!mouseEvent.isAltDown() && mouseEvent.isShiftDown() && breakpoint != null) { breakpoint.setSuspendPolicy(SuspendPolicy.NONE); diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodCallUtils.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodCallUtils.java index 35da41e6d8c5..66e29475b579 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodCallUtils.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/psiutils/MethodCallUtils.java @@ -150,7 +150,7 @@ public class MethodCallUtils { } public static boolean isCallDuringObjectConstruction(PsiMethodCallExpression expression) { - final PsiMember member = PsiTreeUtil.getParentOfType(expression, PsiMethod.class, PsiClassInitializer.class, PsiField.class); + final PsiMember member = PsiTreeUtil.getParentOfType(expression, PsiMember.class, true, PsiClass.class, PsiLambdaExpression.class); if (member == null) { return false; } diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/abstract_method_call_in_constructor/AbstractMethodCallInConstructor.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/abstract_method_call_in_constructor/AbstractMethodCallInConstructor.java new file mode 100644 index 000000000000..88ad0be72eda --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/initialization/abstract_method_call_in_constructor/AbstractMethodCallInConstructor.java @@ -0,0 +1,13 @@ +abstract class A { + public A() { + Runnable r = () -> foo(); + Runnable r1 = new Runnable() { + public void run() { + foo(); + } + }; + + } + + abstract void foo(); +} \ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/AbstractMethodCallInConstructorInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/AbstractMethodCallInConstructorInspectionTest.java new file mode 100644 index 000000000000..26c16148c326 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/initialization/AbstractMethodCallInConstructorInspectionTest.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2016 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.siyeh.ig.initialization; + +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; + +public class AbstractMethodCallInConstructorInspectionTest extends LightInspectionTestCase { + + public void testAbstractMethodCallInConstructor() { + doTest(); + } + + @Override + protected InspectionProfileEntry getInspection() { + return new AbstractMethodCallInConstructorInspection(); + } +} diff --git a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java index a329c60cd6b4..d1403b0851a1 100644 --- a/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java +++ b/plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/changeBrowser/CvsContentRevision.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -29,6 +29,7 @@ import com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutorCallback; import com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler; import com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation; import com.intellij.cvsSupport2.cvsoperations.dateOrRevision.RevisionOrDate; +import com.intellij.cvsSupport2.history.CvsRevisionNumber; import com.intellij.openapi.cvsIntegration.CvsResult; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; @@ -65,6 +66,7 @@ public class CvsContentRevision implements ByteBackedContentRevision { myProject = project; } + @Override @Nullable public String getContent() throws VcsException { byte[] content = getContentAsBytes(); @@ -96,14 +98,20 @@ public class CvsContentRevision implements ByteBackedContentRevision { return myContent; } + @Override @NotNull public FilePath getFile() { return myLocalFile; } + @Override @NotNull public VcsRevisionNumber getRevisionNumber() { - return myRevision.getCvsRevisionNumber(); + final CvsRevisionNumber cvsRevisionNumber = myRevision.getCvsRevisionNumber(); + if (cvsRevisionNumber == null) { + return VcsRevisionNumber.NULL; + } + return cvsRevisionNumber; } @Override @NonNls diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrParameterInfo.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrParameterInfo.java index deb6f2f47faf..a9fca573c9e1 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrParameterInfo.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/changeSignature/GrParameterInfo.java @@ -155,6 +155,7 @@ public class GrParameterInfo implements JavaParameterInfo { myName = newName; } + @Override public void setType(@Nullable PsiType type) { myTypeWrapper = type == null ? null : CanonicalTypes.createTypeWrapper(type); } diff --git a/resources-en/src/messages/QuickFixBundle.properties b/resources-en/src/messages/QuickFixBundle.properties index 10115b7fd7b2..091b95496c7e 100644 --- a/resources-en/src/messages/QuickFixBundle.properties +++ b/resources-en/src/messages/QuickFixBundle.properties @@ -223,6 +223,7 @@ orderEntry.fix.add.library.to.classpath=Add library ''{0}'' to classpath orderEntry.fix.family.add.library.to.classpath=Add library to classpath orderEntry.fix.circular.dependency.warning=Adding dependency on module ''{0}'' will introduce circular dependency between modules ''{1}'' and ''{2}''.\nAdd dependency anyway? orderEntry.fix.title.circular.dependency.warning=Circular Dependency Warning +orderEntry.fix.add.junit.jar.to.classpath=Add JUnit to classpath static.import.method.text=Static import method static.import.method.choose.method.to.import=Choose Method to Import