mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javac 1.7 bug workaround: give error for language level 1.7 despite of java 1.8 would compile the code (IDEA-166358)
This commit is contained in:
@@ -18,8 +18,6 @@ package com.intellij.psi;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.JavaVersionService;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -211,8 +209,8 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
|
||||
final DiamondInferenceResult result = new DiamondInferenceResult(classOrAnonymousClassReference.getReferenceName() + "<>");
|
||||
|
||||
if (PsiUtil.isRawSubstitutor(staticFactory, inferredSubstitutor)) {
|
||||
if (!JavaVersionService.getInstance().isAtLeast(newExpression, JavaSdkVersion.JDK_1_8) &&
|
||||
PsiUtil.skipParenthesizedExprUp(newExpression.getParent()) instanceof PsiExpressionList) {
|
||||
//http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html#A999198 REF 7144506
|
||||
if (!PsiUtil.isLanguageLevel8OrHigher(newExpression) && PsiUtil.skipParenthesizedExprUp(newExpression.getParent()) instanceof PsiExpressionList) {
|
||||
for (PsiTypeParameter ignored : parameters) {
|
||||
result.addInferredType(PsiType.getJavaLangObject(newExpression.getManager(), GlobalSearchScope.allScope(newExpression.getProject())));
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import java.util.*;
|
||||
|
||||
class Test {
|
||||
|
||||
void foo() {
|
||||
set<error descr="'set(java.util.List<java.lang.String>)' in 'Test' cannot be applied to '(java.util.ArrayList<java.lang.Object>)'">(new ArrayList<>(new Vector()))</error>;
|
||||
}
|
||||
|
||||
void set(List<String> list) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -618,4 +618,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testUncheckedConversionInReturnType() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
|
||||
}
|
||||
|
||||
public void testNotErasedReturnValueUnderJdk7() throws Exception {
|
||||
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_8, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user