mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+1
@@ -403,6 +403,7 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
|
||||
if (varargParam != null && pi >= parameters.length) return false;
|
||||
PsiType exprType = RefactoringUtil.getTypeByExpression(expression);
|
||||
if (exprType == null) return false;
|
||||
exprType = GenericsUtil.getVariableTypeByExpressionType(exprType);
|
||||
JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(expression.getProject());
|
||||
String name = suggestUniqueParameterName(codeStyleManager, expression, exprType, existingNames);
|
||||
final ParameterInfoImpl newParameterInfo = new ParameterInfoImpl(-1, name, exprType, expression.getText().replace('\n', ' '));
|
||||
|
||||
@@ -351,6 +351,9 @@ public class GenericsUtil {
|
||||
@Nullable
|
||||
public static PsiType getVariableTypeByExpressionType(@Nullable PsiType type, final boolean openCaptured) {
|
||||
if (type == null) return null;
|
||||
if (type instanceof PsiDisjunctionType) {
|
||||
type = ((PsiDisjunctionType)type).getLeastUpperBound();
|
||||
}
|
||||
if (type instanceof PsiCapturedWildcardType) {
|
||||
type = ((PsiCapturedWildcardType)type).getWildcard();
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
|
||||
}
|
||||
else {
|
||||
//unbounded
|
||||
substituted = PsiWildcardType.createExtends(manager, substitutedBoundType);
|
||||
substituted = substitutedBoundType instanceof PsiCapturedWildcardType ? ((PsiCapturedWildcardType)substitutedBoundType).getWildcard() : PsiWildcardType.createExtends(manager, substitutedBoundType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class Test<X extends Getter<?, ?> & Runnable> {}
|
||||
|
||||
interface Supplier<K> {
|
||||
K get();
|
||||
}
|
||||
|
||||
interface Getter<C, S extends C> extends Supplier<C> {
|
||||
public S get();
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Map<Integer, Object> map = <error descr="Inferred type 'java.lang.Object' for type parameter 'V' is not within its bound; should implement 'java.lang.Comparable'">make()</error>;
|
||||
}
|
||||
|
||||
|
||||
public static <K extends Comparable, V extends Comparable> Map<K,V> make() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import java.util.Map;
|
||||
|
||||
class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
<error descr="Incompatible types. Found: 'T', required: 'java.util.Map<java.lang.Object,java.lang.Object>'">Map<Object, Object> b = newMapTrie();</error>
|
||||
<error descr="Incompatible types. Found: 'T', required: 'java.util.Map<java.lang.Object,java.util.Map<java.lang.Object,java.lang.Object>>'">Map<Object, Map<Object, Object>> c = newMapTrie();</error>
|
||||
<error descr="Incompatible types. Found: 'T', required: 'java.util.Map<java.lang.Object,java.util.Map<java.lang.Object,java.util.Map<java.lang.Object,java.lang.Object>>>'">Map<Object, Map<Object, Map<Object, Object>>> d = newMapTrie();</error>
|
||||
<error descr="Incompatible types. Found: 'T', required: 'java.util.Map<java.lang.Object,java.util.Map<java.lang.Object,java.util.Map<java.lang.Object,java.util.Map<java.lang.Object,java.lang.Object>>>>'">Map<Object, Map<Object, Map<Object, Map<Object, Object>>>> e = newMapTrie();</error>
|
||||
}
|
||||
|
||||
public static <T extends Map<Byte, T>> T newMapTrie() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Add 'Exception' as 1st parameter to method 'f'" "true"
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
class Test {
|
||||
public void createFileInputStream() {
|
||||
try {
|
||||
new FileInputStream("test");
|
||||
} catch (IOException |NullPointerException e) {
|
||||
f(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void f(Exception e) { }
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Add 'Exception' as 1st parameter to method 'f'" "true"
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
class Test {
|
||||
public void createFileInputStream() {
|
||||
try {
|
||||
new FileInputStream("test");
|
||||
} catch (IOException |NullPointerException e) {
|
||||
f(<caret>e);
|
||||
}
|
||||
}
|
||||
|
||||
public void f() { }
|
||||
}
|
||||
@@ -372,6 +372,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA126633() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA124363() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA78402() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testIDEA106985() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testCaptureWildcardFromUnboundCaptureWildcard() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testSuperCaptureSubstitutionWhenTypeParameterHasUpperBounds() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
public void testParameterBoundsWithCapturedWildcard() { doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
|
||||
//jdk should propagate LL 1.4 but actually it provides LL 1.7?!
|
||||
|
||||
+4
@@ -236,6 +236,10 @@ public class GraphInferenceHighlightingTest extends LightDaemonAnalyzerTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIncompatibleBoundsFromAssignment() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest(false);
|
||||
}
|
||||
|
||||
+10
-1
@@ -22,6 +22,8 @@ import com.intellij.idea.Bombed;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -107,7 +109,6 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Bombed(day = 30, month = Calendar.SEPTEMBER)
|
||||
public void testIDEA124983() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
@@ -145,4 +146,12 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
protected Sdk getProjectJDK() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
/*
|
||||
public static Test suite() {
|
||||
final TestSuite suite = new TestSuite();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
suite.addTestSuite(NewLambdaHighlightingTest.class);
|
||||
}
|
||||
return suite;
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.intellij.platform.templates.github;
|
||||
|
||||
import com.intellij.openapi.application.ex.ApplicationInfoEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
@@ -19,7 +20,6 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author Sergey Simonchik
|
||||
@@ -176,6 +176,7 @@ public class DownloadUtil {
|
||||
URLConnection urlConnection = HttpConfigurable.getInstance().openConnection(location);
|
||||
HttpURLConnection httpURLConnection = ObjectUtils.tryCast(urlConnection, HttpURLConnection.class);
|
||||
try {
|
||||
urlConnection.setRequestProperty("User-Agent", ApplicationInfoEx.getInstanceEx().getFullApplicationName());
|
||||
urlConnection.connect();
|
||||
InputStream in = urlConnection.getInputStream();
|
||||
int contentLength = urlConnection.getContentLength();
|
||||
|
||||
@@ -418,7 +418,7 @@ public class PathManager {
|
||||
|
||||
private static String getAbsolutePath(String path) {
|
||||
path = FileUtil.expandUserHome(path);
|
||||
return FileUtil.toCanonicalPath(new File(FileUtil.toCanonicalPath(path)).getAbsolutePath());
|
||||
return FileUtil.toCanonicalPath(new File(path).getAbsolutePath());
|
||||
}
|
||||
|
||||
private static String trimPathQuotes(String path){
|
||||
|
||||
@@ -2,14 +2,14 @@ interface I1 {
|
||||
void m();
|
||||
}
|
||||
|
||||
interface I2<X> {
|
||||
X m();
|
||||
interface I2 {
|
||||
void m();
|
||||
}
|
||||
|
||||
class Ambiguity1 {
|
||||
|
||||
static void m(I1 i1) {}
|
||||
static <T> void m(I2<T> i2) {}
|
||||
static void m(I2 i2) {}
|
||||
|
||||
{
|
||||
m((<caret>)->{throw new AssertionError();});
|
||||
|
||||
Reference in New Issue
Block a user