mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: don't report error on qualified reference if the type of the qualifier is unknown (IDEA-240047)
GitOrigin-RevId: c5c197eca630832e9f96d1cbee1a1ed545e0212f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3184367385
commit
ed768499e2
+19
-6
@@ -909,11 +909,20 @@ public final class HighlightMethodUtil {
|
||||
}
|
||||
else if (qualifierExpression != null &&
|
||||
qualifierExpression.getType() instanceof PsiPrimitiveType primitiveType &&
|
||||
!primitiveType.equals(PsiTypes.nullType()) && !primitiveType.equals(PsiTypes.voidType())) {
|
||||
description =
|
||||
JavaErrorBundle.message("cannot.call.method.on.type", qualifierExpression.getText(), primitiveType.getPresentableText(false));
|
||||
!primitiveType.equals(PsiTypes.nullType())) {
|
||||
if (PsiTypes.voidType().equals(primitiveType) &&
|
||||
PsiUtil.deparenthesizeExpression(qualifierExpression) instanceof PsiReferenceExpression) {
|
||||
return null;
|
||||
}
|
||||
description = JavaErrorBundle.message("cannot.call.method.on.type", primitiveType.getPresentableText(false));
|
||||
}
|
||||
else {
|
||||
if (qualifierExpression != null) {
|
||||
PsiType type = qualifierExpression.getType();
|
||||
if (type instanceof PsiClassType t && t.resolve() == null || PsiTypes.nullType().equals(type)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (IncompleteModelUtil.isIncompleteModel(file) && IncompleteModelUtil.canBePendingReference(referenceToMethod)) {
|
||||
return HighlightUtil.getPendingReferenceHighlightInfo(elementToHighlight);
|
||||
}
|
||||
@@ -966,9 +975,10 @@ public final class HighlightMethodUtil {
|
||||
|
||||
String description;
|
||||
String toolTip;
|
||||
PsiExpression[] expressions = list.getExpressions();
|
||||
if (methodCandidate2 != null) {
|
||||
if (IncompleteModelUtil.isIncompleteModel(list) &&
|
||||
ContainerUtil.exists(list.getExpressions(), e -> IncompleteModelUtil.mayHaveUnknownTypeDueToPendingReference(e))) {
|
||||
ContainerUtil.exists(expressions, e -> IncompleteModelUtil.mayHaveUnknownTypeDueToPendingReference(e))) {
|
||||
return null;
|
||||
}
|
||||
PsiMethod element1 = methodCandidate1.getElement();
|
||||
@@ -1000,7 +1010,10 @@ public final class HighlightMethodUtil {
|
||||
return null;
|
||||
}
|
||||
if (IncompleteModelUtil.isIncompleteModel(list) &&
|
||||
ContainerUtil.exists(list.getExpressions(), IncompleteModelUtil::mayHaveUnknownTypeDueToPendingReference)) {
|
||||
ContainerUtil.exists(expressions, IncompleteModelUtil::mayHaveUnknownTypeDueToPendingReference)) {
|
||||
return null;
|
||||
}
|
||||
if (ContainerUtil.exists(expressions, e -> e.getType() == null)) {
|
||||
return null;
|
||||
}
|
||||
String methodName = referenceToMethod.getReferenceName() + buildArgTypesList(list, true);
|
||||
@@ -1024,7 +1037,7 @@ public final class HighlightMethodUtil {
|
||||
CastMethodArgumentFix.REGISTRAR.registerCastActions(candidates, methodCall, builder, fixRange);
|
||||
WrapWithAdapterMethodCallFix.registerCastActions(candidates, methodCall, builder, fixRange);
|
||||
WrapObjectWithOptionalOfNullableFix.REGISTAR.registerCastActions(candidates, methodCall, builder, fixRange);
|
||||
WrapExpressionFix.registerWrapAction(candidates, list.getExpressions(), builder, fixRange);
|
||||
WrapExpressionFix.registerWrapAction(candidates, expressions, builder, fixRange);
|
||||
PermuteArgumentsFix.registerFix(builder, methodCall, candidates, fixRange);
|
||||
registerChangeParameterClassFix(methodCall, list, builder, fixRange);
|
||||
return builder;
|
||||
|
||||
+20
-12
@@ -217,8 +217,8 @@ public final class HighlightUtil {
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message);
|
||||
if (((operandIsPrimitive || checkIsPrimitive) && !primitiveInPatternsEnabled) && convertible) {
|
||||
HighlightInfo.Builder infoFeature =
|
||||
HighlightUtil.checkFeature(expression, JavaFeature.PRIMITIVE_TYPES_IN_PATTERNS,
|
||||
PsiUtil.getLanguageLevel(expression), expression.getContainingFile());
|
||||
checkFeature(expression, JavaFeature.PRIMITIVE_TYPES_IN_PATTERNS,
|
||||
PsiUtil.getLanguageLevel(expression), expression.getContainingFile());
|
||||
if (infoFeature != null) {
|
||||
info = infoFeature;
|
||||
}
|
||||
@@ -554,8 +554,8 @@ public final class HighlightUtil {
|
||||
PsiType lType = variable.getType();
|
||||
if (PsiTypes.nullType().equals(lType) &&
|
||||
ExpressionUtils.nonStructuralChildren(initializer).allMatch(ExpressionUtils::isNullLiteral)) {
|
||||
HighlightInfo.Builder info =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).descriptionAndTooltip(JavaErrorBundle.message("lvti.null"))
|
||||
HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR)
|
||||
.descriptionAndTooltip(JavaErrorBundle.message("lvti.null"))
|
||||
.range(typeElement);
|
||||
HighlightFixUtil.registerSpecifyVarTypeFix(localVariable, info);
|
||||
return info;
|
||||
@@ -2878,7 +2878,7 @@ public final class HighlightUtil {
|
||||
}
|
||||
|
||||
// references to private methods from the outer class are not calls to super methods
|
||||
// even if the outer class is the super class
|
||||
// even if the outer class is the superclass
|
||||
if (resolved instanceof PsiMember member && member.hasModifierProperty(PsiModifier.PRIVATE) && referencedClass != parentClass) {
|
||||
return null;
|
||||
}
|
||||
@@ -3568,14 +3568,22 @@ public final class HighlightUtil {
|
||||
boolean definitelyIncorrect = false;
|
||||
if (ref instanceof PsiReferenceExpression expression) {
|
||||
PsiExpression qualifierExpression = expression.getQualifierExpression();
|
||||
if (qualifierExpression != null &&
|
||||
qualifierExpression.getType() instanceof PsiPrimitiveType primitiveType &&
|
||||
!primitiveType.equals(PsiTypes.nullType()) && !primitiveType.equals(PsiTypes.voidType())) {
|
||||
description = JavaErrorBundle.message("cannot.access.member.on.type", qualifierExpression.getText(),
|
||||
primitiveType.getPresentableText(false));
|
||||
definitelyIncorrect = true;
|
||||
if (qualifierExpression != null) {
|
||||
PsiType type = qualifierExpression.getType();
|
||||
if (type instanceof PsiPrimitiveType primitiveType && !primitiveType.equals(PsiTypes.nullType())) {
|
||||
if (PsiTypes.voidType().equals(primitiveType) &&
|
||||
PsiUtil.deparenthesizeExpression(qualifierExpression) instanceof PsiReferenceExpression) {
|
||||
return null;
|
||||
}
|
||||
description = JavaErrorBundle.message("cannot.access.member.on.type", primitiveType.getPresentableText(false));
|
||||
definitelyIncorrect = true;
|
||||
}
|
||||
else if (type instanceof PsiClassType t && t.resolve() == null || PsiTypes.nullType().equals(type)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else if (!JavaImplicitClassIndex.getInstance().getElements(ref.getQualifiedName(), ref.getProject(), ref.getResolveScope()).isEmpty()) {
|
||||
}
|
||||
else if (!JavaImplicitClassIndex.getInstance().getElements(ref.getQualifiedName(), ref.getProject(), ref.getResolveScope()).isEmpty()) {
|
||||
description = JavaErrorBundle.message("implicit.class.can.not.be.referenced", ref.getText());
|
||||
definitelyIncorrect = true;
|
||||
}
|
||||
|
||||
@@ -327,9 +327,9 @@ marked.for.removal.symbol=''{0}'' is deprecated and marked for removal
|
||||
marked.for.removal.symbol.since=''{0}'' is deprecated since version {1} and marked for removal
|
||||
qualifier.must.be.expression=Qualifier must be an expression
|
||||
cannot.resolve.symbol=Cannot resolve symbol ''{0}''
|
||||
cannot.access.member.on.type=Cannot access member because ''{0}'' has primitive type {1}
|
||||
cannot.access.member.on.type=Cannot access fields on ''{0}'' type
|
||||
implicit.class.can.not.be.referenced=Implicitly declared class ''{0}'' cannot be referenced
|
||||
cannot.call.method.on.type=Cannot call method because ''{0}'' has primitive type {1}
|
||||
cannot.call.method.on.type=Cannot call methods on ''{0}'' type
|
||||
class.is.already.defined.in.single.static.import=Class ''{0}'' is already defined in a single static import
|
||||
class.is.ambiguous.in.single.static.import=Class ''{0}'' is ambiguous in a single static import
|
||||
field.is.already.defined.in.single.static.import=Field ''{0}'' is already defined in a single static import
|
||||
|
||||
+7
-3
@@ -39,7 +39,7 @@ public class a12 {
|
||||
|
||||
|
||||
//////////////////////////
|
||||
void f() {
|
||||
void f(<error descr="Cannot resolve symbol 'Unknown'">Unknown</error> ufo) {
|
||||
a12 a[] = new a12[4];
|
||||
int[] ai = null;
|
||||
|
||||
@@ -51,8 +51,12 @@ public class a12 {
|
||||
<error descr="Cannot resolve method 'foo123Unresolved' in 'a12'">foo123Unresolved</error>(<error descr="Expression expected">String</error>);
|
||||
<error descr="Cannot resolve method 'foo123Unresolved' in 'a12'">foo123Unresolved</error>(<error descr="Cannot resolve symbol 'xxxx'">xxxx</error>);
|
||||
int i = 0;
|
||||
System.out.println(i.<error descr="Cannot access member because 'i' has primitive type int">x</error>);
|
||||
System.out.println(true.<error descr="Cannot call method because 'true' has primitive type boolean">toString</error>());
|
||||
System.out.println(i.<error descr="Cannot access fields on 'int' type">x</error>);
|
||||
System.out.println(true.<error descr="Cannot call methods on 'boolean' type">toString</error>());
|
||||
System.out.println().<error descr="Cannot access fields on 'void' type">field</error>;
|
||||
System.out.println().<error descr="Cannot call methods on 'void' type">method</error>();
|
||||
System.out.println(ufo.lights);
|
||||
System.out.println(ufo.hover());
|
||||
|
||||
<error descr="Cannot resolve method 'xxxxxx' in 'a12'">xxxxxx</error>(<error descr="Cannot resolve symbol 'xxxxxx'">xxxxxx</error>);
|
||||
|
||||
|
||||
+1
-1
@@ -12,6 +12,6 @@ class B
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
A a = null;
|
||||
char c = a.foo(null).<error descr="Cannot resolve method 'charAt(int)'">charAt</error>(0);
|
||||
char c = a.foo(null).<error descr="Cannot call methods on 'void' type">charAt</error>(0);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class UnnamedVariables {
|
||||
Consumer<String> consumer3 = _ -> System.out.println(<error descr="Using '_' as a reference is not allowed">_</error>.trim());
|
||||
Consumer<String> consumer4 = _ -> {
|
||||
var v = <error descr="Using '_' as a reference is not allowed">_</error>;
|
||||
System.out.println(v.<error descr="Cannot resolve method 'trim()'" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">trim</error>());
|
||||
System.out.println(v.trim());
|
||||
};
|
||||
BiConsumer<String, String> consumer5 = (_,_) -> {};
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class UnnamedVariables {
|
||||
Consumer<String> consumer3 = _ -> System.out.println(<error descr="Using '_' as a reference is not allowed">_</error>.trim());
|
||||
Consumer<String> consumer4 = _ -> {
|
||||
var v = <error descr="Using '_' as a reference is not allowed">_</error>;
|
||||
System.out.println(v.<error descr="Cannot resolve method 'trim()'" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">trim</error>());
|
||||
System.out.println(v.trim());
|
||||
};
|
||||
BiConsumer<String, String> consumer5 = (_,_) -> {};
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class UnnamedVariables {
|
||||
Consumer<String> consumer3 = <error descr="Use of '_' as a lambda parameter name is not allowed">_</error> -> System.out.println(_.trim());
|
||||
Consumer<String> consumer4 = <error descr="Use of '_' as a lambda parameter name is not allowed">_</error> -> {
|
||||
<error descr="Cannot resolve symbol 'var'" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">var</error> v = _;
|
||||
System.out.println(v.<error descr="Cannot resolve method 'trim()'" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">trim</error>());
|
||||
System.out.println(v.trim());
|
||||
};
|
||||
BiConsumer<String, String> consumer5 = (<error descr="Use of '_' as a lambda parameter name is not allowed"><error descr="Variable '_' is already defined in the scope">_</error></error>,<error descr="Use of '_' as a lambda parameter name is not allowed"><error descr="Variable '_' is already defined in the scope">_</error></error>) -> {};
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public class UnnamedVariables {
|
||||
Consumer<String> consumer3 = <error descr="Unnamed patterns and variables are not supported at language level '9'">_</error> -> System.out.println(<error descr="Since Java 9, '_' is a keyword, and may not be used as an identifier">_</error>.trim());
|
||||
Consumer<String> consumer4 = <error descr="Unnamed patterns and variables are not supported at language level '9'">_</error> -> {
|
||||
<error descr="Cannot resolve symbol 'var'" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">var</error> v = <error descr="Since Java 9, '_' is a keyword, and may not be used as an identifier">_</error>;
|
||||
System.out.println(v.<error descr="Cannot resolve method 'trim()'" textAttributesKey="WRONG_REFERENCES_ATTRIBUTES">trim</error>());
|
||||
System.out.println(v.trim());
|
||||
};
|
||||
BiConsumer<String, String> consumer5 = (<error descr="Unnamed patterns and variables are not supported at language level '9'">_</error>,<error descr="Unnamed patterns and variables are not supported at language level '9'">_</error>) -> {};
|
||||
}
|
||||
|
||||
+2
-1
@@ -14,7 +14,8 @@ class Main {
|
||||
var y = new Object[] {<error descr="Cannot infer type for 'y', it is used in its own variable initializer">y</error> = null};
|
||||
var z = baz(<error descr="Cannot infer type for 'z', it is used in its own variable initializer">z</error> = 1);
|
||||
var zz = <error descr="Variable 'zz' might not have been initialized">zz</error>;
|
||||
zz.<error descr="Cannot resolve method 'hashCode()'">hashCode</error>();
|
||||
zz.hashCode();
|
||||
System.out.println(zz.zz);
|
||||
}
|
||||
|
||||
static int baz(Object o) {return 42;}
|
||||
|
||||
+2
-2
@@ -14,13 +14,13 @@ public class LombokDumbModeApplication {
|
||||
.surname("3")
|
||||
.email("4")
|
||||
.name("1")</error><error descr="';' expected">a</error>
|
||||
.<info descr="Not resolved until the project is fully loaded">id</info>(1)
|
||||
.id(1)
|
||||
.<info descr="Not resolved until the project is fully loaded">build</info>();
|
||||
|
||||
String name = userDao
|
||||
.nhaame();
|
||||
<info descr="Not resolved until the project is fully loaded">UserChain</info> userChain = new <info descr="Not resolved until the project is fully loaded">UserChain</info>();
|
||||
String name1 = userChain.<info descr="Not resolved until the project is fully loaded">getName</info>();
|
||||
String name1 = userChain.getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-17
@@ -87,7 +87,7 @@ public class Server {
|
||||
}
|
||||
|
||||
protected void initGenerate() throws IOException {
|
||||
<info descr="Not resolved until the project is fully loaded">Reporting</info> reporting = new <info descr="Not resolved until the project is fully loaded">ReportEngineCreator</info>().<info descr="Not resolved until the project is fully loaded">createReportingEngine</info>(propertiesLoader);
|
||||
<info descr="Not resolved until the project is fully loaded">Reporting</info> reporting = new <info descr="Not resolved until the project is fully loaded">ReportEngineCreator</info>().createReportingEngine(propertiesLoader);
|
||||
|
||||
<info descr="Not resolved until the project is fully loaded">get</info>("/generate", (req, res) -> {
|
||||
try {
|
||||
@@ -101,15 +101,15 @@ public class Server {
|
||||
|
||||
Map<String, Object> params = parseParameters(req, report);
|
||||
String templateCode = req.<info descr="Not resolved until the project is fully loaded">queryParams</info>("templateCode");
|
||||
<info descr="Not resolved until the project is fully loaded">RunParams</info> reportParams = new <info descr="Not resolved until the project is fully loaded">RunParams</info>(report).<info descr="Not resolved until the project is fully loaded">params</info>(params);
|
||||
<info descr="Not resolved until the project is fully loaded">RunParams</info> reportParams = new <info descr="Not resolved until the project is fully loaded">RunParams</info>(report).params(params);
|
||||
if (<info descr="Not resolved until the project is fully loaded">StringUtils</info>.<info descr="Not resolved until the project is fully loaded">isNotBlank</info>(templateCode)) {
|
||||
reportParams.<info descr="Not resolved until the project is fully loaded">templateCode</info>(templateCode);
|
||||
reportParams.templateCode(templateCode);
|
||||
}
|
||||
<info descr="Not resolved until the project is fully loaded">ReportOutputDocument</info> reportOutputDocument = reporting.<info descr="Not resolved until the project is fully loaded">runReport</info>(reportParams);
|
||||
<info descr="Not resolved until the project is fully loaded">ReportOutputDocument</info> reportOutputDocument = reporting.runReport(reportParams);
|
||||
writeResult(res, reportOutputDocument);
|
||||
return "Ok";
|
||||
} catch (Exception e) {
|
||||
logger.<info descr="Not resolved until the project is fully loaded">error</info>(String.format("An error occurred while generating report [%s]", req.<info descr="Not resolved until the project is fully loaded">queryParams</info>("report")), e);
|
||||
logger.error(String.format("An error occurred while generating report [%s]", req.<info descr="Not resolved until the project is fully loaded">queryParams</info>("report")), e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
@@ -123,24 +123,24 @@ public class Server {
|
||||
}
|
||||
|
||||
protected <info descr="Not resolved until the project is fully loaded">Report</info> loadReport(<info descr="Not resolved until the project is fully loaded">Request</info> req) throws IOException {
|
||||
String reportName = req.<info descr="Not resolved until the project is fully loaded">queryParams</info>("report");
|
||||
String reportName = req.queryParams("report");
|
||||
if (<info descr="Not resolved until the project is fully loaded">StringUtils</info>.<info descr="Not resolved until the project is fully loaded">isBlank</info>(reportName)) {
|
||||
return null;
|
||||
} else {
|
||||
<info descr="Not resolved until the project is fully loaded">XmlReader</info> xmlReader = new <info descr="Not resolved until the project is fully loaded">DefaultXmlReader</info>();
|
||||
return xmlReader.<info descr="Not resolved until the project is fully loaded">parseXml</info>(<info descr="Not resolved until the project is fully loaded">FileUtils</info>.<info descr="Not resolved until the project is fully loaded">readFileToString</info>(new File(String.format("%s/%s.xml", reportsPath, reportName))));
|
||||
return xmlReader.parseXml(<info descr="Not resolved until the project is fully loaded">FileUtils</info>.<info descr="Not resolved until the project is fully loaded">readFileToString</info>(new File(String.format("%s/%s.xml", reportsPath, reportName))));
|
||||
}
|
||||
}
|
||||
|
||||
protected Map<String, Object> parseParameters(<info descr="Not resolved until the project is fully loaded">Request</info> req, <info descr="Not resolved until the project is fully loaded">Report</info> report) {
|
||||
<info descr="Not resolved until the project is fully loaded">QueryParamsMap</info> queryParams = req.<info descr="Not resolved until the project is fully loaded">queryMap</info>("params");
|
||||
<info descr="Not resolved until the project is fully loaded">QueryParamsMap</info> queryParams = req.queryMap("params");
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
||||
for (<info descr="Not resolved until the project is fully loaded">ReportParameter</info> reportParameter : report.<info descr="Not resolved until the project is fully loaded">getReportParameters</info>()) {
|
||||
java.lang.String paramValueStr = queryParams.<info descr="Not resolved until the project is fully loaded">value</info>(reportParameter.<info descr="Not resolved until the project is fully loaded">getAlias</info>());
|
||||
for (<info descr="Not resolved until the project is fully loaded">ReportParameter</info> reportParameter : report.getReportParameters()) {
|
||||
java.lang.String paramValueStr = queryParams.value(reportParameter.getAlias());
|
||||
if (paramValueStr != null) {
|
||||
params.put(reportParameter.<info descr="Not resolved until the project is fully loaded">getAlias</info>(),
|
||||
converter.<info descr="Not resolved until the project is fully loaded">convertFromString</info>(reportParameter.<info descr="Not resolved until the project is fully loaded">getParameterClass</info>(), paramValueStr));
|
||||
params.put(reportParameter.getAlias(),
|
||||
converter.convertFromString(reportParameter.getParameterClass(), paramValueStr));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,10 +148,10 @@ public class Server {
|
||||
}
|
||||
|
||||
protected void writeResult(<info descr="Not resolved until the project is fully loaded">Response</info> res, <info descr="Not resolved until the project is fully loaded">ReportOutputDocument</info> reportOutputDocument) throws IOException {
|
||||
<info descr="Not resolved until the project is fully loaded">HttpServletResponse</info> raw = res.<info descr="Not resolved until the project is fully loaded">raw</info>();
|
||||
raw.<info descr="Not resolved until the project is fully loaded">setHeader</info>("Content-Disposition", String.format("attachment; filename=\"%s\"", reportOutputDocument.<info descr="Not resolved until the project is fully loaded">getDocumentName</info>()));
|
||||
raw.<info descr="Not resolved until the project is fully loaded">setContentLength</info>(reportOutputDocument.<info descr="Not resolved until the project is fully loaded">getContent</info>().<info descr="Not resolved until the project is fully loaded">length</info>);
|
||||
raw.<info descr="Not resolved until the project is fully loaded">getOutputStream</info>().<info descr="Not resolved until the project is fully loaded">write</info>(reportOutputDocument.<info descr="Not resolved until the project is fully loaded">getContent</info>());
|
||||
res.<info descr="Not resolved until the project is fully loaded">status</info>(200);
|
||||
<info descr="Not resolved until the project is fully loaded">HttpServletResponse</info> raw = res.raw();
|
||||
raw.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", reportOutputDocument.getDocumentName()));
|
||||
raw.setContentLength(reportOutputDocument.getContent().<info descr="Not resolved until the project is fully loaded">length</info>);
|
||||
raw.getOutputStream().<info descr="Not resolved until the project is fully loaded">write</info>(reportOutputDocument.getContent());
|
||||
res.status(200);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -12,7 +12,7 @@ import <info descr="Not resolved until the project is fully loaded">my</info>.<i
|
||||
|
||||
public class Simple {
|
||||
int test() {
|
||||
test().<error descr="Cannot call method because 'test()' has primitive type int">run</error>();
|
||||
test().<error descr="Cannot call methods on 'int' type">run</error>();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public class Simple {
|
||||
}
|
||||
|
||||
void refsInUnresolvedClass(<info descr="Not resolved until the project is fully loaded">Cls</info> s) {
|
||||
s.<info descr="Not resolved until the project is fully loaded">hashCode</info>();
|
||||
s.<info descr="Not resolved until the project is fully loaded">dream</info>();
|
||||
System.out.println(s.<info descr="Not resolved until the project is fully loaded">field</info>);
|
||||
s.hashCode();
|
||||
s.dream();
|
||||
System.out.println(s.field);
|
||||
System.out.println(<info descr="Not resolved until the project is fully loaded">Cls</info>.<info descr="Not resolved until the project is fully loaded">STATIC</info>);
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ public class Simple {
|
||||
|
||||
@<info descr="Not resolved until the project is fully loaded">Anno</info>(<info descr="Not resolved until the project is fully loaded">Cls</info>.<info descr="Not resolved until the project is fully loaded">CONST</info>)
|
||||
void testAssign(<info descr="Not resolved until the project is fully loaded">Unknown</info> u) {
|
||||
u.<info descr="Not resolved until the project is fully loaded">field</info> = 2;
|
||||
u.field = 2;
|
||||
}
|
||||
|
||||
void callOnArray(<info descr="Not resolved until the project is fully loaded">Unknown</info> u) {
|
||||
u.<info descr="Not resolved until the project is fully loaded">foo</info>()[0].<info descr="Not resolved until the project is fully loaded">blah</info>();
|
||||
u.foo()[0].<info descr="Not resolved until the project is fully loaded">blah</info>();
|
||||
}
|
||||
|
||||
void initArray() {
|
||||
@@ -116,10 +116,10 @@ public class Simple {
|
||||
|
||||
void varTest() {
|
||||
<info descr="null">var</info> x = <info descr="Not resolved until the project is fully loaded">Cls</info>.<info descr="Not resolved until the project is fully loaded">getSomething</info>();
|
||||
x.<info descr="Not resolved until the project is fully loaded">getSomethingElse</info>();
|
||||
x.getSomethingElse();
|
||||
<info descr="null">var</info> y = x;
|
||||
<info descr="null">var</info> z = y.<info descr="Not resolved until the project is fully loaded">getSomethingCompletelyDifferent</info>();
|
||||
z.<info descr="Not resolved until the project is fully loaded">getFromZ</info>();
|
||||
<info descr="null">var</info> z = y.getSomethingCompletelyDifferent();
|
||||
z.getFromZ();
|
||||
|
||||
<info descr="null">var</info> t = <error descr="Variable 't' might not have been initialized">t</error>;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class Simple {
|
||||
|
||||
void testThrow(<info descr="Not resolved until the project is fully loaded">Cls</info> cls) {
|
||||
try {
|
||||
cls.<info descr="Not resolved until the project is fully loaded">unknownM</info>();
|
||||
cls.unknownM();
|
||||
} catch (<info descr="Not resolved until the project is fully loaded">Cls</info> x) {
|
||||
|
||||
} catch (IOException | RuntimeException ex) {
|
||||
@@ -158,7 +158,7 @@ public class Simple {
|
||||
void declaredUnknownException() throws <info descr="Not resolved until the project is fully loaded">Cls</info> {}
|
||||
|
||||
void testConcat(<info descr="Not resolved until the project is fully loaded">Cls</info> cls) {
|
||||
System.out.println("hello " + cls.<info descr="Not resolved until the project is fully loaded">getSomething</info>() + "!!!");
|
||||
System.out.println("hello " + cls.getSomething() + "!!!");
|
||||
}
|
||||
|
||||
static class Clss implements <info descr="Not resolved until the project is fully loaded">MyInterface</info> {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
class Test {
|
||||
void test() {
|
||||
var x = <error descr="Cannot resolve method 'unresolved' in 'Test'">unresolved</error>();
|
||||
System.out.println(x.<error descr="Cannot resolve method 'hashCode()'">hashCode</error>());
|
||||
System.out.println(x.<error descr="Cannot resolve symbol 'x'">x</error>);
|
||||
System.out.println(x.hashCode());
|
||||
System.out.println(x.x);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ class Test {
|
||||
}
|
||||
|
||||
void test2(<error descr="Cannot resolve symbol 'XXX'">XXX</error> bar) {
|
||||
System.out.println(bar.<error descr="Cannot resolve method 'hashCode()'">hashCode</error>());
|
||||
System.out.println(bar.hashCode());
|
||||
if (<error descr="Inconvertible types; cannot cast 'XXX' to 'java.lang.CharSequence'">bar instanceof CharSequence</error>) {}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.codeInsight.daemon.problems
|
||||
|
||||
import com.intellij.codeInsight.daemon.problems.Problem
|
||||
@@ -292,7 +292,7 @@ internal class ClassProblemsTest : ProjectProblemsViewTest() {
|
||||
method.identifyingElement?.replace(factory.createIdentifier("foo"))
|
||||
}
|
||||
myFixture.doHighlighting()
|
||||
assertSize(2, ProjectProblemUtils.getReportedProblems(myFixture.editor).entries)
|
||||
assertSize(1, ProjectProblemUtils.getReportedProblems(myFixture.editor).entries)
|
||||
|
||||
changeClass(targetClass) { psiClass, _ ->
|
||||
psiClass.identifyingElement?.replace(factory.createIdentifier("A"))
|
||||
|
||||
@@ -4,6 +4,6 @@ import <info descr="Not resolved until the project is fully loaded">lombok</info
|
||||
public class Logs {
|
||||
|
||||
public static void main(String[] args) {
|
||||
log.<info descr="Not resolved until the project is fully loaded">info</info>("Hello World!");
|
||||
log.info("Hello World!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user