diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.form b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.form
index ca990638b60b..8af7bb90b418 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.form
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.form
@@ -174,27 +174,21 @@
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
+
@@ -213,19 +207,46 @@
+
+
+
+
+
+
+
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -239,7 +260,7 @@
-
+
@@ -284,7 +305,7 @@
-
+
@@ -329,7 +350,7 @@
-
+
@@ -375,61 +396,9 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
index 9216cc0701e1..74ef39612149 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointPropertiesPanel.java
@@ -42,6 +42,7 @@ import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.ui.FieldPanel;
import com.intellij.ui.MultiLineTooltipUI;
+import com.intellij.ui.components.JBCheckBox;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -71,7 +72,6 @@ public abstract class BreakpointPropertiesPanel {
private JCheckBox myLogExpressionCheckBox;
private JCheckBox myLogMessageCheckBox;
protected JCheckBox myPassCountCheckbox;
- private JCheckBox myConditionCheckbox;
private JCheckBox myInstanceFiltersCheckBox;
private JCheckBox myClassFiltersCheckBox;
@@ -84,21 +84,19 @@ public abstract class BreakpointPropertiesPanel {
private PsiClass myBreakpointPsiClass;
private JRadioButton mySuspendThreadRadio;
- private JRadioButton mySuspendNoneRadio;
private JRadioButton mySuspendAllRadio;
- private JRadioButton myDisableAgainRadio;
- private JRadioButton myLeaveEnabledRadioButton;
- private JLabel myEnableOrDisableLabel;
+ private JBCheckBox mySuspendJBCheckBox;
private JButton myMakeDefaultButton;
+ private JRadioButton myDisableAgainRadio;
+ private JRadioButton myLeaveEnabledRadioButton;
+
+ private JLabel myEnableOrDisableLabel;
private JPanel myDependsOnPanel;
private JPanel myInstanceFiltersPanel;
private JPanel myClassFiltersPanel;
private JPanel myPassCountPanel;
private JPanel myConditionsPanel;
- private JPanel myConditionPanel;
- private JPanel myCompactConditionsPanel;
- private JPanel myConditionPlaceholder;
private JPanel myActionsPanel;
ButtonGroup mySuspendPolicyGroup;
@@ -146,14 +144,8 @@ public abstract class BreakpointPropertiesPanel {
myMoreOptionsVisible = b;
myDependsOnPanel.setVisible(b);
myConditionsPanel.setVisible(b);
- if (!b) {
- myConditionPlaceholder.remove(myConditionPanel);
- myCompactConditionsPanel.add(myConditionPanel, BorderLayout.CENTER);
- }
- else {
+ if (b) {
myActionsPanel.setVisible(true);
- myCompactConditionsPanel.remove(myConditionPanel);
- myConditionPlaceholder.add(myConditionPanel, BorderLayout.CENTER);
}
}
@@ -195,8 +187,7 @@ public abstract class BreakpointPropertiesPanel {
mySuspendPolicyGroup = new ButtonGroup();
mySuspendPolicyGroup.add(mySuspendAllRadio);
mySuspendPolicyGroup.add(mySuspendThreadRadio);
- mySuspendPolicyGroup.add(mySuspendNoneRadio);
-
+
updateSuspendPolicyRbFont();
final ItemListener suspendPolicyChangeListener = new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
@@ -207,8 +198,16 @@ public abstract class BreakpointPropertiesPanel {
}
}
};
+
+ mySuspendJBCheckBox.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent event) {
+ mySuspendAllRadio.setEnabled(mySuspendJBCheckBox.isSelected());
+ mySuspendThreadRadio.setEnabled(mySuspendJBCheckBox.isSelected());
+ }
+ });
+
mySuspendAllRadio.addItemListener(suspendPolicyChangeListener);
- mySuspendNoneRadio.addItemListener(suspendPolicyChangeListener);
mySuspendThreadRadio.addItemListener(suspendPolicyChangeListener);
myMakeDefaultButton.addActionListener(new ActionListener() {
@@ -220,9 +219,6 @@ public abstract class BreakpointPropertiesPanel {
if (DebuggerSettings.SUSPEND_THREAD.equals(suspendPolicy)) {
mySuspendThreadRadio.requestFocus();
}
- else if (DebuggerSettings.SUSPEND_NONE.equals(suspendPolicy)) {
- mySuspendNoneRadio.requestFocus();
- }
else {
mySuspendAllRadio.requestFocus();
}
@@ -312,23 +308,21 @@ public abstract class BreakpointPropertiesPanel {
}
};
myPassCountCheckbox.addActionListener(listener);
- myConditionCheckbox.addActionListener(listener);
myInstanceFiltersCheckBox.addActionListener(listener);
myClassFiltersCheckBox.addActionListener(listener);
DebuggerUIUtil.focusEditorOnCheck(myPassCountCheckbox, myPassCountField);
- DebuggerUIUtil.focusEditorOnCheck(myConditionCheckbox, myConditionCombo);
DebuggerUIUtil.focusEditorOnCheck(myLogExpressionCheckBox, myLogExpressionCombo);
DebuggerUIUtil.focusEditorOnCheck(myInstanceFiltersCheckBox, myInstanceFiltersField.getTextField());
DebuggerUIUtil.focusEditorOnCheck(myClassFiltersCheckBox, myClassFiltersField.getTextField());
}
private String getSelectedSuspendPolicy() {
+ if (!mySuspendJBCheckBox.isSelected()) {
+ return DebuggerSettings.SUSPEND_NONE;
+ }
if (mySuspendThreadRadio.isSelected()) {
return DebuggerSettings.SUSPEND_THREAD;
}
- if (mySuspendNoneRadio.isSelected()) {
- return DebuggerSettings.SUSPEND_NONE;
- }
return DebuggerSettings.SUSPEND_ALL;
}
@@ -340,7 +334,6 @@ public abstract class BreakpointPropertiesPanel {
mySuspendAllRadio.setFont(DebuggerSettings.SUSPEND_ALL.equals(defPolicy)? boldFont : font);
mySuspendThreadRadio.setFont(DebuggerSettings.SUSPEND_THREAD.equals(defPolicy)? boldFont : font);
- mySuspendNoneRadio.setFont(DebuggerSettings.SUSPEND_NONE.equals(defPolicy)? boldFont : font);
}
protected ClassFilter createClassConditionFilter() {
@@ -379,10 +372,19 @@ public abstract class BreakpointPropertiesPanel {
PsiElement context = breakpoint.getEvaluationElement();
myPassCountCheckbox.setSelected(breakpoint.COUNT_FILTER_ENABLED);
- myConditionCheckbox.setSelected(breakpoint.CONDITION_ENABLED);
+ if (!breakpoint.CONDITION_ENABLED) {
+ myConditionCombo.setText(emptyText());
+ }
+ else {
+ myConditionCombo.setContext(context);
+ myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : emptyText());
+ }
+
+ mySuspendJBCheckBox.setSelected(!breakpoint.SUSPEND_POLICY.equals(DebuggerSettings.SUSPEND_NONE));
+ mySuspendThreadRadio.setEnabled(mySuspendJBCheckBox.isSelected());
+ mySuspendAllRadio.setEnabled(mySuspendJBCheckBox.isSelected());
if(DebuggerSettings.SUSPEND_NONE.equals(breakpoint.SUSPEND_POLICY)) {
- mySuspendPolicyGroup.setSelected(mySuspendNoneRadio.getModel(), true);
actionsPanelVisible = true;
}
else if(DebuggerSettings.SUSPEND_THREAD.equals(breakpoint.SUSPEND_POLICY)){
@@ -391,16 +393,19 @@ public abstract class BreakpointPropertiesPanel {
else {
mySuspendPolicyGroup.setSelected(mySuspendAllRadio.getModel(), true);
}
- mySuspendNoneRadio.addActionListener(new ActionListener() {
+
+ mySuspendJBCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
if (!myActionsPanel.isVisible()) {
- if (mySuspendNoneRadio.isSelected()) {
+ if (!mySuspendJBCheckBox.isSelected()) {
if (myDelegate != null) {
myDelegate.showActionsPanel();
}
}
}
+ mySuspendThreadRadio.setEnabled(mySuspendJBCheckBox.isSelected());
+ mySuspendAllRadio.setEnabled(mySuspendJBCheckBox.isSelected());
}
});
myLogMessageCheckBox.setSelected(breakpoint.LOG_ENABLED);
@@ -409,16 +414,13 @@ public abstract class BreakpointPropertiesPanel {
actionsPanelVisible = true;
}
- myConditionCombo.setContext(context);
- myConditionCombo.setText(breakpoint.getCondition() != null ? breakpoint.getCondition() : new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""));
-
myLogExpressionCombo.setContext(context);
if (breakpoint.getLogMessage() != null) {
myLogExpressionCombo.setText(breakpoint.getLogMessage());
}
else {
- myLogExpressionCombo.setText(new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, ""));
+ myLogExpressionCombo.setText(emptyText());
}
myLogExpressionCombo.setEnabled(breakpoint.LOG_EXPRESSION_ENABLED);
@@ -453,6 +455,10 @@ public abstract class BreakpointPropertiesPanel {
setMoreOptionsVisible(moreOptionsVisible);
}
+ private TextWithImportsImpl emptyText() {
+ return new TextWithImportsImpl(CodeFragmentKind.EXPRESSION, "");
+ }
+
/**
* Save values in the UI components to the breakpoint object
*/
@@ -470,7 +476,7 @@ public abstract class BreakpointPropertiesPanel {
}
breakpoint.COUNT_FILTER_ENABLED = breakpoint.COUNT_FILTER > 0 && myPassCountCheckbox.isSelected();
breakpoint.setCondition(myConditionCombo.getText());
- breakpoint.CONDITION_ENABLED = !breakpoint.getCondition().isEmpty() && myConditionCheckbox.isSelected();
+ breakpoint.CONDITION_ENABLED = !breakpoint.getCondition().isEmpty();
breakpoint.setLogMessage(myLogExpressionCombo.getText());
breakpoint.LOG_EXPRESSION_ENABLED = !breakpoint.getLogMessage().isEmpty() && myLogExpressionCheckBox.isSelected();
breakpoint.LOG_ENABLED = myLogMessageCheckBox.isSelected();
@@ -616,7 +622,7 @@ public abstract class BreakpointPropertiesPanel {
}
protected void updateCheckboxes() {
- JCheckBox [] checkBoxes = { myConditionCheckbox, myInstanceFiltersCheckBox, myClassFiltersCheckBox };
+ JCheckBox [] checkBoxes = {myInstanceFiltersCheckBox, myClassFiltersCheckBox };
JCheckBox selected = null;
for (JCheckBox checkBoxe : checkBoxes) {
if (checkBoxe.isSelected()) {
@@ -624,8 +630,7 @@ public abstract class BreakpointPropertiesPanel {
break;
}
}
-
- if(selected != null){
+ if(selected != null || !myConditionCombo.getText().isEmpty()){
myPassCountCheckbox.setEnabled(false);
} else {
myPassCountCheckbox.setEnabled(true);
@@ -637,8 +642,8 @@ public abstract class BreakpointPropertiesPanel {
myPassCountField.setEditable(myPassCountCheckbox.isSelected());
myPassCountField.setEnabled (myPassCountCheckbox.isSelected());
- myConditionCombo.setEnabled(myConditionCheckbox.isSelected());
- myConditionMagnifierButton.setEnabled(myConditionCheckbox.isSelected());
+ myConditionCombo.setEnabled(true);
+ myConditionMagnifierButton.setEnabled(true);
myInstanceFiltersField.setEnabled(myInstanceFiltersCheckBox.isSelected());
myInstanceFiltersField.getTextField().setEditable(myInstanceFiltersCheckBox.isSelected());
myClassFiltersField.setEnabled(myClassFiltersCheckBox.isSelected());
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index 25402c9020f7..9186a5ba227c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -507,7 +507,8 @@ public class GenericsHighlightUtil {
}
else if (superMethod.isConstructor()) return null;
- if (checkMethod.hasModifierProperty(PsiModifier.STATIC) && !checkEqualsSuper) {
+ final boolean atLeast17 = JavaVersionService.getInstance().isAtLeast(checkMethod, JavaSdkVersion.JDK_1_7);
+ if (checkMethod.hasModifierProperty(PsiModifier.STATIC) && !checkEqualsSuper && !atLeast17) {
return null;
}
@@ -515,7 +516,6 @@ public class GenericsHighlightUtil {
final PsiType retErasure2 = TypeConversionUtil.erasure(superMethod.getReturnType());
boolean differentReturnTypeErasure = !Comparing.equal(retErasure1, retErasure2);
- final boolean atLeast17 = JavaVersionService.getInstance().isAtLeast(checkMethod, JavaSdkVersion.JDK_1_7);
if (checkEqualsSuper && atLeast17) {
if (retErasure1 != null && retErasure2 != null) {
differentReturnTypeErasure = !TypeConversionUtil.isAssignable(retErasure1, retErasure2);
@@ -555,7 +555,10 @@ public class GenericsHighlightUtil {
private static HighlightInfo getSameErasureMessage(final boolean sameClass, final PsiMethod method, final PsiMethod superMethod,
TextRange textRange) {
- @NonNls final String key = sameClass ? "generics.methods.have.same.erasure" : "generics.methods.have.same.erasure.override";
+ @NonNls final String key = sameClass ? "generics.methods.have.same.erasure" :
+ method.hasModifierProperty(PsiModifier.STATIC) ?
+ "generics.methods.have.same.erasure.hide" :
+ "generics.methods.have.same.erasure.override";
String description = JavaErrorMessages.message(key, HighlightMethodUtil.createClashMethodMessage(method, superMethod, !sameClass));
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, textRange, description);
}
diff --git a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
index b4e31fbe7318..a3aaf703c3d0 100644
--- a/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
+++ b/java/java-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java
@@ -133,8 +133,7 @@ public class RefJavaManagerImpl extends RefJavaManager {
refPackage.accept(visitor);
}
}
- final THashMap refTable = myRefManager.getRefTable();
- for (RefElement refElement : refTable.values()) {
+ for (RefElement refElement : myRefManager.getSortedElements()) {
if (refElement instanceof RefClass) {
RefClass refClass = (RefClass)refElement;
RefMethod refDefaultConstructor = refClass.getDefaultConstructor();
diff --git a/java/java-impl/src/com/intellij/openapi/vcs/contentAnnotation/VcsContentAnnotationExceptionFilter.java b/java/java-impl/src/com/intellij/openapi/vcs/contentAnnotation/VcsContentAnnotationExceptionFilter.java
index d5e3705b9b3d..9a49434b2ce2 100644
--- a/java/java-impl/src/com/intellij/openapi/vcs/contentAnnotation/VcsContentAnnotationExceptionFilter.java
+++ b/java/java-impl/src/com/intellij/openapi/vcs/contentAnnotation/VcsContentAnnotationExceptionFilter.java
@@ -137,25 +137,27 @@ public class VcsContentAnnotationExceptionFilter implements Filter, FilterMixin
int endIdx = idx == -1 ? worker.getInfo().getThird().getEndOffset() : idx;
consumer.consume(new MyAdditionalHighlight(startOffset + lineStartOffset + startFileOffset + 1, startOffset + lineStartOffset + endIdx));
- // also check method
- final List ranges = findMethodRange(worker, document, previousLineResult);
- if (ranges != null) {
- boolean methodChanged = false;
- for (TextRange range : ranges) {
- if (localChangesCorrector.isRangeChangedLocally(vf, document, range)) {
- methodChanged = true;
- break;
+ if (worker.getPsiClass() != null) {
+ // also check method
+ final List ranges = findMethodRange(worker, document, previousLineResult);
+ if (ranges != null) {
+ boolean methodChanged = false;
+ for (TextRange range : ranges) {
+ if (localChangesCorrector.isRangeChangedLocally(vf, document, range)) {
+ methodChanged = true;
+ break;
+ }
+ final TextRange correctedRange = localChangesCorrector.getCorrectedRange(vf, document, range);
+ if (vcsContentAnnotation.intervalRecentlyChanged(vf, correctedRange, recentChangeRevision)) {
+ methodChanged = true;
+ break;
+ }
}
- final TextRange correctedRange = localChangesCorrector.getCorrectedRange(vf, document, range);
- if (vcsContentAnnotation.intervalRecentlyChanged(vf, correctedRange, recentChangeRevision)) {
- methodChanged = true;
- break;
+ if (methodChanged) {
+ consumer.consume(new MyAdditionalHighlight(startOffset + lineStartOffset + worker.getInfo().getSecond().getStartOffset(),
+ startOffset + lineStartOffset + worker.getInfo().getSecond().getEndOffset()));
}
}
- if (methodChanged) {
- consumer.consume(new MyAdditionalHighlight(startOffset + lineStartOffset + worker.getInfo().getSecond().getStartOffset(),
- startOffset + lineStartOffset + worker.getInfo().getSecond().getEndOffset()));
- }
}
}
}
diff --git a/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java b/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java
index 9a97bdade7c0..bcae03df6b5a 100644
--- a/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java
+++ b/java/java-impl/src/com/intellij/unscramble/UnscrambleDialog.java
@@ -16,6 +16,7 @@
package com.intellij.unscramble;
import com.intellij.execution.ui.ConsoleView;
+import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.ide.util.PropertiesComponent;
@@ -29,8 +30,11 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Comparing;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.registry.Registry;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.configurable.VcsContentAnnotationConfigurable;
import com.intellij.openapi.vfs.VirtualFile;
@@ -38,6 +42,7 @@ import com.intellij.ui.GuiUtils;
import com.intellij.ui.TextFieldWithHistory;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Consumer;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.CharArrayUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
@@ -46,6 +51,9 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -57,6 +65,15 @@ public class UnscrambleDialog extends DialogWrapper {
@NonNls private static final String PROPERTY_LOG_FILE_HISTORY_URLS = "UNSCRAMBLE_LOG_FILE_URL";
@NonNls private static final String PROPERTY_LOG_FILE_LAST_URL = "UNSCRAMBLE_LOG_FILE_LAST_URL";
@NonNls private static final String PROPERTY_UNSCRAMBLER_NAME_USED = "UNSCRAMBLER_NAME_USED";
+ private static final Condition DEADLOCK_CONDITION = new Condition() {
+ @Override
+ public boolean value(ThreadState state) {
+ return state.isDeadlocked();
+ }
+ };
+ private static final Icon THREAD_DUMP_ICON = IconLoader.getIcon("/debugger/threadStates/threaddump.png");
+ private static final Icon DEADLOCK_ICON = IconLoader.getIcon("/debugger/killProcess.png");
+ private static final Icon EXCEPTION_ICON = IconLoader.getIcon("/debugger/threadStates/exception.png");
private final Project myProject;
private JPanel myEditorPanel;
@@ -358,25 +375,43 @@ public class UnscrambleDialog extends DialogWrapper {
private boolean performUnscramble() {
UnscrambleSupport selectedUnscrambler = getSelectedUnscrambler();
- return showUnscrambledText(selectedUnscrambler, myLogFile.getText(), myProject, myStacktraceEditorPanel.getText());
+ return showUnscrambledText(selectedUnscrambler, myLogFile.getText(), myProject, myStacktraceEditorPanel.getText()) != null;
}
- static boolean showUnscrambledText(UnscrambleSupport unscrambleSupport, String logName, Project project, String textToUnscramble) {
+ @Nullable
+ static RunContentDescriptor showUnscrambledText(@Nullable UnscrambleSupport unscrambleSupport,
+ String logName,
+ Project project,
+ String textToUnscramble) {
String unscrambledTrace = unscrambleSupport == null ? textToUnscramble : unscrambleSupport.unscramble(project,textToUnscramble, logName);
- if (unscrambledTrace == null) return false;
+ if (unscrambledTrace == null) return null;
List threadStates = ThreadDumpParser.parse(unscrambledTrace);
- final ConsoleView consoleView = addConsole(project, threadStates);
- consoleView.allowHeavyFilters();
- AnalyzeStacktraceUtil.printStacktrace(consoleView, unscrambledTrace);
- return true;
+ return addConsole(project, threadStates, unscrambledTrace);
}
- public static ConsoleView addConsole(final Project project, final List threadDump) {
+ private static RunContentDescriptor addConsole(final Project project, final List threadDump, String unscrambledTrace) {
+ Icon icon = null;
+ String message = IdeBundle.message("unscramble.unscrambled.stacktrace.tab");
+ if (!threadDump.isEmpty()) {
+ message = IdeBundle.message("unscramble.unscrambled.threaddump.tab");
+ icon = THREAD_DUMP_ICON;
+ }
+ else {
+ String name = getExceptionName(unscrambledTrace);
+ if (name != null) {
+ message = name;
+ icon = EXCEPTION_ICON;
+ }
+ }
+ if (ContainerUtil.find(threadDump, DEADLOCK_CONDITION) != null) {
+ message = IdeBundle.message("unscramble.unscrambled.deadlock.tab");
+ icon = DEADLOCK_ICON;
+ }
return AnalyzeStacktraceUtil.addConsole(project, threadDump.size() > 1 ? new AnalyzeStacktraceUtil.ConsoleFactory() {
public JComponent createConsoleComponent(ConsoleView consoleView, DefaultActionGroup toolbarActions) {
return new ThreadDumpPanel(project, consoleView, toolbarActions, threadDump);
}
- } : null, IdeBundle.message("unscramble.unscrambled.stacktrace.tab"));
+ } : null, message, unscrambledTrace, icon);
}
protected String getDimensionServiceKey(){
@@ -386,4 +421,53 @@ public class UnscrambleDialog extends DialogWrapper {
public JComponent getPreferredFocusedComponent() {
return myStacktraceEditorPanel.getEditorComponent();
}
+
+ @Nullable
+ private static String getExceptionName(String unscrambledTrace) {
+ @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
+ BufferedReader reader = new BufferedReader(new StringReader(unscrambledTrace));
+ for (int i = 0; i < 3; i++) {
+ try {
+ String line = reader.readLine();
+ if (line == null) return null;
+ line = line.trim();
+ String name = getExceptionAbbreviation(line);
+ if (name != null) return name;
+ }
+ catch (IOException e) {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ @Nullable
+ private static String getExceptionAbbreviation(String line) {
+ int lastDelimiter = 0;
+ for (int j = 0; j < line.length(); j++) {
+ char c = line.charAt(j);
+ if (c == '.' || c == '$') {
+ lastDelimiter = j;
+ continue;
+ }
+ if (!StringUtil.isJavaIdentifierPart(c)) {
+ return null;
+ }
+ }
+ String clazz = line.substring(lastDelimiter);
+ String abbreviate = abbreviate(clazz);
+ return abbreviate.length() > 1 ? abbreviate : clazz;
+ }
+
+ private static String abbreviate(String s) {
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ if (Character.isUpperCase(c)) {
+ builder.append(c);
+ }
+ }
+ return builder.toString();
+ }
+
}
\ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/unscramble/UnscrambleFromClipboardAction.java b/java/java-impl/src/com/intellij/unscramble/UnscrambleFromClipboardAction.java
deleted file mode 100644
index 589c68a0bd15..000000000000
--- a/java/java-impl/src/com/intellij/unscramble/UnscrambleFromClipboardAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.unscramble;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
-import com.intellij.openapi.actionSystem.Presentation;
-import com.intellij.openapi.project.Project;
-
-public final class UnscrambleFromClipboardAction extends AnAction {
- public void actionPerformed(AnActionEvent e) {
- Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
-
- // If there's a text in clipboard and log is specified or not needed, unscramble w/o extra questions
-
- String text = AnalyzeStacktraceUtil.getTextInClipboard();
- if (text != null) {
- String file = UnscrambleDialog.getLastUsedLogUrl();
- if (file != null && file.trim().length() == 0) {
- file = null;
- }
- UnscrambleSupport savedUnscrambler = UnscrambleDialog.getSavedUnscrambler();
- if (savedUnscrambler == null || file != null) {
- boolean success = UnscrambleDialog.showUnscrambledText(savedUnscrambler, file, project, text);
- if (success) {
- return;
- }
- }
- }
-
- // Use regular unscramble dialog
- UnscrambleDialog dialog = new UnscrambleDialog(project);
- dialog.show();
- }
-
- public void update(AnActionEvent event){
- Presentation presentation = event.getPresentation();
- Project project = PlatformDataKeys.PROJECT.getData(event.getDataContext());
- presentation.setEnabled(project != null);
- }
-}
diff --git a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
index be554463ffec..fb730076134b 100644
--- a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
@@ -216,10 +216,11 @@ public class GenericsUtil {
PsiClassType[] extendsTypes = typeParameter.getExtendsListTypes();
for (PsiClassType type : extendsTypes) {
PsiType extendsType = substitutor.substitute(type);
- if (!extendsType.isAssignableFrom(substituted)) {
- return false;
+ if (extendsType.isAssignableFrom(substituted)) {
+ return true;
}
}
+ if (extendsTypes.length > 0) return false;
}
return true;
diff --git a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
index 037c6f1b8a60..d75f9b95e591 100644
--- a/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
+++ b/java/java-psi-impl/src/com/intellij/psi/scope/conflictResolvers/JavaMethodsConflictResolver.java
@@ -31,10 +31,7 @@ import gnu.trove.THashSet;
import gnu.trove.TIntArrayList;
import org.jetbrains.annotations.Nullable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
/**
* Created by IntelliJ IDEA.
@@ -281,7 +278,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
@MethodCandidateInfo.ApplicabilityLevelConstant int maxApplicabilityLevel = 0;
boolean toFilter = false;
for (CandidateInfo conflict : conflicts) {
- @MethodCandidateInfo.ApplicabilityLevelConstant final int level = ((MethodCandidateInfo)conflict).getApplicabilityLevel();
+ final @MethodCandidateInfo.ApplicabilityLevelConstant int level = preferVarargs((MethodCandidateInfo)conflict);
if (maxApplicabilityLevel > 0 && maxApplicabilityLevel != level) {
toFilter = true;
}
@@ -293,7 +290,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
if (toFilter) {
for (Iterator iterator = conflicts.iterator(); iterator.hasNext();) {
CandidateInfo info = iterator.next();
- final int level = ((MethodCandidateInfo)info).getApplicabilityLevel(); //cached
+ final int level = preferVarargs(info);
if (level < maxApplicabilityLevel) {
iterator.remove();
}
@@ -303,6 +300,17 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
return maxApplicabilityLevel;
}
+ private static int preferVarargs(CandidateInfo info) {
+ final int level = ((MethodCandidateInfo)info).getApplicabilityLevel();
+ if (level == MethodCandidateInfo.ApplicabilityLevel.FIXED_ARITY) {
+ final PsiMethod psiMethod = (PsiMethod)info.getElement();
+ if (psiMethod != null && psiMethod.isVarArgs() && JavaVersionService.getInstance().isAtLeast(psiMethod, JavaSdkVersion.JDK_1_7)) {
+ return level + 1;
+ }
+ }
+ return level;
+ }
+
private static int getCheckLevel(MethodCandidateInfo method){
boolean visible = method.isAccessible();// && !method.myStaticProblem;
boolean available = method.isStaticsScopeCorrect();
@@ -318,10 +326,19 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
}
private static Specifics checkSubtyping(PsiType type1, PsiType type2, PsiMethod method1, PsiMethod method2) {
- boolean noBoxing = type1 instanceof PsiPrimitiveType == type2 instanceof PsiPrimitiveType;
+ return checkSubtyping(type1, type2, method1, method2, true);
+ }
+
+ @Nullable
+ private static Specifics checkSubtyping(PsiType type1,
+ PsiType type2,
+ PsiMethod method1,
+ PsiMethod method2,
+ boolean boxingHappening) {
+ boolean noBoxing = boxingHappening || type1 instanceof PsiPrimitiveType == type2 instanceof PsiPrimitiveType;
final boolean allowUncheckedConversion =
!method1.hasModifierProperty(PsiModifier.STATIC) && !method2.hasModifierProperty(PsiModifier.STATIC) ||
- method1.getContainingClass() == method2.getContainingClass();
+ method1.getContainingClass() == method2.getContainingClass();
final boolean assignable2From1 = noBoxing && TypeConversionUtil.isAssignable(type2, type1, allowUncheckedConversion);
final boolean assignable1From2 = noBoxing && TypeConversionUtil.isAssignable(type1, type2, allowUncheckedConversion);
if (assignable1From2 || assignable2From1) {
@@ -332,7 +349,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
return assignable1From2 ? Specifics.SECOND : Specifics.FIRST;
}
- return Specifics.NEITHER;
+ return allowUncheckedConversion ? Specifics.NEITHER : null;
}
private boolean isBoxingHappened(PsiType argType, PsiType parameterType) {
@@ -358,8 +375,6 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
final PsiTypeParameter[] typeParameters2 = method2.getTypeParameters();
final PsiSubstitutor classSubstitutor1 = info1.getSubstitutor(); //substitutions for method type parameters will be ignored
final PsiSubstitutor classSubstitutor2 = info2.getSubstitutor();
- PsiSubstitutor methodSubstitutor1 = PsiSubstitutor.EMPTY;
- PsiSubstitutor methodSubstitutor2 = PsiSubstitutor.EMPTY;
final int max = Math.max(params1.length, params2.length);
PsiType[] types1 = new PsiType[max];
@@ -382,26 +397,10 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
types2[i] = type2;
}
- if (typeParameters1.length == 0 || typeParameters2.length == 0) {
- if (typeParameters1.length > 0) {
- final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(myArgumentsList.getProject()).getResolveHelper();
- methodSubstitutor1 = calculateMethodSubstitutor(typeParameters1, types1, types2, resolveHelper);
- }
- else if (typeParameters2.length > 0) {
- final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(myArgumentsList.getProject()).getResolveHelper();
- methodSubstitutor2 = calculateMethodSubstitutor(typeParameters2, types2, types1, resolveHelper);
- }
- }
- else {
- PsiElementFactory factory = JavaPsiFacade.getInstance(myArgumentsList.getProject()).getElementFactory();
- methodSubstitutor1 = factory.createRawSubstitutor(PsiSubstitutor.EMPTY, typeParameters1);
- methodSubstitutor2 = factory.createRawSubstitutor(PsiSubstitutor.EMPTY, typeParameters2);
- }
-
int[] boxingHappened = new int[2];
for (int i = 0; i < types1.length; i++) {
- PsiType type1 = classSubstitutor1.substitute(methodSubstitutor1.substitute(types1[i]));
- PsiType type2 = classSubstitutor2.substitute(methodSubstitutor2.substitute(types2[i]));
+ PsiType type1 = classSubstitutor1.substitute(types1[i]);
+ PsiType type2 = classSubstitutor2.substitute(types2[i]);
PsiType argType = i < myActualParameterTypes.length ? myActualParameterTypes[i] : null;
boxingHappened[0] += isBoxingHappened(argType, type1) ? 1 : 0;
@@ -412,15 +411,31 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
Specifics isMoreSpecific = null;
for (int i = 0; i < types1.length; i++) {
- PsiType type1 = classSubstitutor1.substitute(methodSubstitutor1.substitute(types1[i]));
- PsiType type2 = classSubstitutor2.substitute(methodSubstitutor2.substitute(types2[i]));
-
- Specifics specifics = type1 == null || type2 == null ? null : checkSubtyping(type1, type2, method1, method2);
+ Specifics specifics = checkSubstitutorSpecific(method1, method2, classSubstitutor1, classSubstitutor2, types1[i], types2[i], isMoreSpecific);
if (specifics == null) {
- if (Comparing.equal(type1, type2)) {
- specifics = checkSubstitutorSpecific(method1, method2, classSubstitutor1, classSubstitutor2, types1[i], types2[i]);
+ PsiSubstitutor methodSubstitutor1 = PsiSubstitutor.EMPTY;
+ PsiSubstitutor methodSubstitutor2 = PsiSubstitutor.EMPTY;
+ if (typeParameters1.length == 0 || typeParameters2.length == 0) {
+ if (typeParameters1.length > 0) {
+ final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(myArgumentsList.getProject()).getResolveHelper();
+ methodSubstitutor1 = calculateMethodSubstitutor(typeParameters1, types1, types2, resolveHelper);
+ }
+ else if (typeParameters2.length > 0) {
+ final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(myArgumentsList.getProject()).getResolveHelper();
+ methodSubstitutor2 = calculateMethodSubstitutor(typeParameters2, types2, types1, resolveHelper);
+ }
+ }
+ else {
+ PsiElementFactory factory = JavaPsiFacade.getInstance(myArgumentsList.getProject()).getElementFactory();
+ methodSubstitutor1 = factory.createRawSubstitutor(PsiSubstitutor.EMPTY, typeParameters1);
+ methodSubstitutor2 = factory.createRawSubstitutor(PsiSubstitutor.EMPTY, typeParameters2);
+ }
+ PsiType type1 = classSubstitutor1.substitute(methodSubstitutor1.substitute(types1[i]));
+ PsiType type2 = classSubstitutor2.substitute(methodSubstitutor2.substitute(types2[i]));
+ specifics = type1 == null || type2 == null ? null : checkSubtyping(type1, type2, method1, method2, boxingHappened[0] == 0 || boxingHappened[1] == 0);
+ if (specifics == null) {
+ continue;
}
- if (specifics == null) continue;
}
switch (specifics) {
@@ -473,7 +488,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
PsiSubstitutor classSubstitutor1,
PsiSubstitutor classSubstitutor2,
PsiType type1,
- PsiType type2) {
+ PsiType type2, Specifics moreSpecific) {
final Map map1 = classSubstitutor1.getSubstitutionMap();
final Map map2 = classSubstitutor2.getSubstitutionMap();
@@ -491,20 +506,60 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
else {
final PsiTypeParameter p1 = map1.keySet().iterator().next();
final PsiTypeParameter p2 = map2.keySet().iterator().next();
- Specifics specifics = checkSubtyping(TypeConversionUtil.erasure(PsiSubstitutor.EMPTY.substitute(p1)),
- TypeConversionUtil.erasure(PsiSubstitutor.EMPTY.substitute(p2)), method1, method2);
- if (specifics != null) {
- return specifics;
- } else {
- final PsiType ctype1 = classSubstitutor1.substitute(type1);
- final PsiType ctype2 = classSubstitutor2.substitute(type2);
- return checkSubtyping(ctype1, ctype2, method1, method2);
- }
+ return checkTypeParams(method1, method2, classSubstitutor1, classSubstitutor2, type1, type2, p1, p2, moreSpecific);
+ }
+ } else {
+ final PsiClass aClass1 = PsiUtil.resolveClassInClassTypeOnly(type1);
+ final PsiClass aClass2 = PsiUtil.resolveClassInClassTypeOnly(type2);
+ if (aClass1 instanceof PsiTypeParameter && aClass2 instanceof PsiTypeParameter) {
+ return checkTypeParams(method1, method2, classSubstitutor1, classSubstitutor2, type1, type2, (PsiTypeParameter)aClass1, (PsiTypeParameter)aClass2,
+ moreSpecific);
}
}
return null;
}
+ @Nullable
+ private static Specifics checkTypeParams(PsiMethod method1,
+ PsiMethod method2,
+ PsiSubstitutor classSubstitutor1,
+ PsiSubstitutor classSubstitutor2,
+ PsiType type1,
+ PsiType type2,
+ PsiTypeParameter p1,
+ PsiTypeParameter p2, Specifics moreSpecific) {
+ Specifics specifics = checkSubtyping(TypeConversionUtil.erasure(PsiSubstitutor.EMPTY.substitute(p1)),
+ TypeConversionUtil.erasure(PsiSubstitutor.EMPTY.substitute(p2)), method1, method2);
+ if (specifics == Specifics.NEITHER) {
+ final Set resolved1 = new HashSet();
+ for (PsiJavaCodeReferenceElement referenceElement : p1.getExtendsList().getReferenceElements()) {
+ final PsiElement resolve = referenceElement.resolve();
+ if (resolve != null) {
+ resolved1.add(resolve);
+ }
+ }
+
+ final Set resolved2 = new HashSet();
+ for (PsiJavaCodeReferenceElement referenceElement : p2.getExtendsList().getReferenceElements()) {
+ final PsiElement resolve = referenceElement.resolve();
+ if (resolve != null) {
+ resolved2.add(resolve);
+ }
+ }
+
+ if (resolved1.size() > resolved2.size() && resolved1.containsAll(resolved2)) return Specifics.FIRST;
+ if (resolved2.size() > resolved1.size() && resolved2.containsAll(resolved1)) return Specifics.SECOND;
+ }
+ if (specifics != null) {
+ return specifics;
+ } else {
+ final PsiType ctype1 = classSubstitutor1.substitute(type1);
+ final PsiType ctype2 = classSubstitutor2.substitute(type2);
+ specifics = checkSubtyping(ctype1, ctype2, method1, method2);
+ return specifics == null && moreSpecific == null ? Specifics.NEITHER : specifics;
+ }
+ }
+
private PsiSubstitutor calculateMethodSubstitutor(final PsiTypeParameter[] typeParameters,
final PsiType[] types1,
final PsiType[] types2,
diff --git a/java/java-psi-impl/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
index 1dc16d9d3331..3260287f759b 100644
--- a/java/java-psi-impl/src/messages/JavaErrorMessages.properties
+++ b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
@@ -54,6 +54,7 @@ generics.cannot.be.inherited.with.different.type.arguments=''{0}'' cannot be inh
generics.select.static.class.from.parameterized.type=Cannot select static class ''{0}'' from parameterized type
generics.methods.have.same.erasure={0}; both methods have same erasure
generics.methods.have.same.erasure.override={0}; both methods have same erasure, yet neither overrides the other
+generics.methods.have.same.erasure.hide={0}; both methods have same erasure, yet neither hides the other
generics.type.parameter.cannot.be.instantiated=Type parameter ''{0}'' cannot be instantiated directly
wildcard.type.cannot.be.instantiated=Wildcard type ''{0}'' cannot be instantiated directly
generics.wildcard.not.expected=No wildcard expected
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA21660/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA21660/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..fd7315d2f4bb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA21660/pck/AmbiguousMethodCall.java
@@ -0,0 +1,15 @@
+package pck;
+
+class TestCase {
+ void assertEquals(Object o1, Object o2) {}
+
+ void assertEquals(int i1, int i2) {}
+}
+
+class Test extends TestCase {
+ void test() {
+ int expected = 1;
+ Integer actual = 2;
+ assertEquals(expected, actual);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA22547/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA22547/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..e91fac521f97
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA22547/pck/AmbiguousMethodCall.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pck;
+
+import static pck.Assert.assertEquals;
+
+class Assert {
+ static void assertEquals(Object o1, Object o2) {}
+
+ static void assertEquals(long l1, long l2) {}
+}
+
+class Test {
+ void test() {
+ assertEquals(100L, Long.valueOf(100L));
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA24768/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA24768/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..c8e98329b90d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA24768/pck/AmbiguousMethodCall.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pck;
+
+import java.util.ArrayList;
+import java.util.List;
+
+class IdeaBug {
+
+ public static void main(String[] args) {
+ ClassA.copyOf(new ArrayList());
+ }
+
+ private static class ClassA extends ClassB {
+
+ public static > ClassA copyOf(
+ Iterable extends E> elements) {
+ System.out.println("Hello from ClassA");
+ return null;
+ }
+ }
+
+ private static class ClassB {
+
+ public static ClassA copyOf(Iterable extends E> elements) {
+ System.out.println("Hello from ClassB");
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA25097/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA25097/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..685ba7e1597e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA25097/pck/AmbiguousMethodCall.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package pck;
+class Generics {
+ public void render(T t) {
+ System.out.println("generic");
+ }
+
+ public void render(Integer t) {
+ System.out.println("int");
+ }
+
+ static {
+ new Generics().render(5);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57269/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57269/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..78af0698ebf9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57269/pck/AmbiguousMethodCall.java
@@ -0,0 +1,19 @@
+package pck;
+
+class A {
+ void foo(T x) {
+ foo(1);
+
+ long x1 = 1L;
+ foo(x1);
+
+ Long x2 = 1L;
+ foo(x2);
+
+ Integer x3 = 1;
+ foo(x3);
+ }
+
+ void foo(long x) {
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57278/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57278/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..6ab825a06f29
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57278/pck/AmbiguousMethodCall.java
@@ -0,0 +1,12 @@
+package pck;
+
+interface I{
+ & Cloneable> void foo();
+}
+
+abstract class A {
+ abstract > void foo();
+ void bar(T x){
+ x.foo();
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57306/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57306/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..0e7807d7bb20
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57306/pck/AmbiguousMethodCall.java
@@ -0,0 +1,15 @@
+package pck;
+
+class A {}
+
+interface IA{
+ void foo(A x);
+}
+interface IB{
+ void foo(A x);
+}
+class C {
+ <T extends IA & IB> void bar(T x, A y){
+ x.foo(y);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57317/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57317/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..128fbe1956e7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57317/pck/AmbiguousMethodCall.java
@@ -0,0 +1,11 @@
+package pck;
+
+class B {}
+class A extends B {
+ void foo(A> b){
+ bar(b);
+ }
+
+ void bar(B extends A> a){}
+ void bar(A extends B> a){}
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57535/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57535/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..3949a2dca05a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA57535/pck/AmbiguousMethodCall.java
@@ -0,0 +1,9 @@
+package pck;
+
+abstract class C{
+ abstract > void foo(T x);
+ abstract > void foo(T x);
+ void bar(Integer x){
+ foo(x);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67573/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67573/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..b63b6aa93132
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67573/pck/AmbiguousMethodCall.java
@@ -0,0 +1,17 @@
+interface A
+{
+ abstract void foo(String[] ... s);
+}
+
+interface B
+{
+ abstract void foo(String[] s);
+}
+
+class C
+{
+ void bar(T x)
+ {
+ x.foo(null);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67832/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67832/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..45910d1c36bb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67832/pck/AmbiguousMethodCall.java
@@ -0,0 +1,17 @@
+package pck;
+import static pck.D.foo;
+import static pck.C.foo;
+
+public class C {
+ public static , S> void foo(T x){}
+}
+
+class D {
+ public static > void foo(T x){}
+}
+
+class B{
+ {
+ foo(1);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67837/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67837/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..0fbc5bc0db3d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67837/pck/AmbiguousMethodCall.java
@@ -0,0 +1,18 @@
+package pck;
+
+import static pck.D.foo;
+import static pck.C.foo;
+
+public class C {
+ public static void foo(Comparable extends Comparable> x){}
+}
+
+class D {
+ public static void foo(Comparable extends Number> x){}
+}
+
+class B{
+ public static void bar(){
+ foo(1);
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA78027/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA78027/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..00016a20e6f4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA78027/pck/AmbiguousMethodCall.java
@@ -0,0 +1,17 @@
+package pck;
+class Test {
+ void test() {
+ B.method(new ArgumentB());
+ }
+}
+
+class A {
+ static void method(ArgumentA a) { }
+}
+
+class B extends A {
+ static void method(ArgumentB b) { }
+}
+
+class ArgumentA {}
+class ArgumentB extends ArgumentA