diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java index f6a6f2cd6487..b9094ead13bd 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java @@ -907,14 +907,9 @@ final class ExpressionChecker { 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; - } myVisitor.report(JavaErrorKinds.REFERENCE_QUALIFIER_PRIMITIVE.create(ref, primitiveType)); return; } - if (type instanceof PsiClassType t && t.resolve() == null || PsiTypes.nullType().equals(type)) return; } } else if (ImplicitClassSearch.search(ref.getQualifiedName(), ref.getProject(), ref.getResolveScope()).findFirst() != null) { @@ -1266,17 +1261,9 @@ final class ExpressionChecker { else if (qualifierExpression != null && qualifierExpression.getType() instanceof PsiPrimitiveType primitiveType && !primitiveType.equals(PsiTypes.nullType())) { - if (PsiTypes.voidType().equals(primitiveType) && - PsiUtil.deparenthesizeExpression(qualifierExpression) instanceof PsiReferenceExpression) { - return; - } myVisitor.report(JavaErrorKinds.CALL_QUALIFIER_PRIMITIVE.create(methodCall, primitiveType)); } else { - if (qualifierExpression != null) { - PsiType type = qualifierExpression.getType(); - if (type instanceof PsiClassType t && t.resolve() == null || PsiTypes.nullType().equals(type)) return; - } if (IncompleteModelUtil.isIncompleteModel(myVisitor.file()) && IncompleteModelUtil.canBePendingReference(referenceToMethod)) { myVisitor.report(JavaErrorKinds.REFERENCE_PENDING.create(anchor)); return; diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java index 99473b711084..d26902a8fe59 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.daemon.impl.analysis; import com.intellij.codeInsight.ExceptionUtil; diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/InvalidExpressions.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/InvalidExpressions.java index 5dabf4c4e8e9..aea354ea677a 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/InvalidExpressions.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/InvalidExpressions.java @@ -55,8 +55,8 @@ public class a12 { System.out.println(true.toString()); System.out.println().field; System.out.println().method(); - System.out.println(ufo.lights); - System.out.println(ufo.hover()); + System.out.println(ufo.lights); + System.out.println(ufo.hover()); xxxxxx(xxxxxx); diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariables.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariables.java index a43e3c630596..1e1cde4880f1 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariables.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariables.java @@ -14,7 +14,7 @@ public class UnnamedVariables { Consumer consumer3 = _ -> System.out.println(_.trim()); Consumer consumer4 = _ -> { var v = _; - System.out.println(v.trim()); + System.out.println(v.trim()); }; BiConsumer consumer5 = (_,_) -> {}; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava22.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava22.java index a43e3c630596..1e1cde4880f1 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava22.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava22.java @@ -14,7 +14,7 @@ public class UnnamedVariables { Consumer consumer3 = _ -> System.out.println(_.trim()); Consumer consumer4 = _ -> { var v = _; - System.out.println(v.trim()); + System.out.println(v.trim()); }; BiConsumer consumer5 = (_,_) -> {}; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava8.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava8.java index f4dd7a8552ec..804882cec239 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava8.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava8.java @@ -14,7 +14,7 @@ public class UnnamedVariables { Consumer consumer3 = _ -> System.out.println(_.trim()); Consumer consumer4 = _ -> { var v = _; - System.out.println(v.trim()); + System.out.println(v.trim()); }; BiConsumer consumer5 = (_,_) -> {}; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava9.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava9.java index cc331a9c04fd..a6739554e556 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava9.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlightingUnnamed/UnnamedVariablesJava9.java @@ -14,7 +14,7 @@ public class UnnamedVariables { Consumer consumer3 = _ -> System.out.println(_.trim()); Consumer consumer4 = _ -> { var v = _; - System.out.println(v.trim()); + System.out.println(v.trim()); }; BiConsumer consumer5 = (_,_) -> {}; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advLVTI/SimpleAvailability.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advLVTI/SimpleAvailability.java index 09377ba02513..d3681fec2981 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advLVTI/SimpleAvailability.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advLVTI/SimpleAvailability.java @@ -14,8 +14,8 @@ class Main { var y = new Object[] {y = null}; var z = baz(z = 1); var zz = zz; - zz.hashCode(); - System.out.println(zz.zz); + zz.hashCode(); + System.out.println(zz.zz); var v = ; var w = } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/IncompleteRecursiveParameters.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/IncompleteRecursiveParameters.java index 1e7c0280e86d..eccb01c220c8 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/IncompleteRecursiveParameters.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/IncompleteRecursiveParameters.java @@ -14,13 +14,13 @@ public class LombokDumbModeApplication { .surname("3") .email("4") .name("1")a - .id(1) + .id(1) .build(); String name = userDao .nhaame(); UserChain userChain = new UserChain(); - String name1 = userChain.getName(); + String name1 = userChain.getName(); } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Server.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Server.java index 0d9dd0980d33..6b3a0a903ce8 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Server.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Server.java @@ -87,7 +87,7 @@ public class Server { } protected void initGenerate() throws IOException { - Reporting reporting = new ReportEngineCreator().createReportingEngine(propertiesLoader); + Reporting reporting = new ReportEngineCreator().createReportingEngine(propertiesLoader); get("/generate", (req, res) -> { try { @@ -101,15 +101,15 @@ public class Server { Map params = parseParameters(req, report); String templateCode = req.queryParams("templateCode"); - RunParams reportParams = new RunParams(report).params(params); + RunParams reportParams = new RunParams(report).params(params); if (StringUtils.isNotBlank(templateCode)) { - reportParams.templateCode(templateCode); + reportParams.templateCode(templateCode); } - ReportOutputDocument reportOutputDocument = reporting.runReport(reportParams); + ReportOutputDocument reportOutputDocument = reporting.runReport(reportParams); writeResult(res, reportOutputDocument); return "Ok"; } catch (Exception e) { - logger.error(String.format("An error occurred while generating report [%s]", req.queryParams("report")), e); + logger.error(String.format("An error occurred while generating report [%s]", req.queryParams("report")), e); throw new RuntimeException(e); } }); @@ -123,24 +123,24 @@ public class Server { } protected Report loadReport(Request req) throws IOException { - String reportName = req.queryParams("report"); + String reportName = req.queryParams("report"); if (StringUtils.isBlank(reportName)) { return null; } else { XmlReader xmlReader = new DefaultXmlReader(); - return xmlReader.parseXml(FileUtils.readFileToString(new File(String.format("%s/%s.xml", reportsPath, reportName)))); + return xmlReader.parseXml(FileUtils.readFileToString(new File(String.format("%s/%s.xml", reportsPath, reportName)))); } } protected Map parseParameters(Request req, Report report) { - QueryParamsMap queryParams = req.queryMap("params"); + QueryParamsMap queryParams = req.queryMap("params"); Map params = new HashMap<>(); - for (ReportParameter reportParameter : report.getReportParameters()) { - java.lang.String paramValueStr = queryParams.value(reportParameter.getAlias()); + for (ReportParameter reportParameter : report.getReportParameters()) { + java.lang.String paramValueStr = queryParams.value(reportParameter.getAlias()); if (paramValueStr != null) { - params.put(reportParameter.getAlias(), - converter.convertFromString(reportParameter.getParameterClass(), paramValueStr)); + params.put(reportParameter.getAlias(), + converter.convertFromString(reportParameter.getParameterClass(), paramValueStr)); } } @@ -148,10 +148,10 @@ public class Server { } protected void writeResult(Response res, ReportOutputDocument reportOutputDocument) throws IOException { - HttpServletResponse raw = res.raw(); - raw.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", reportOutputDocument.getDocumentName())); - raw.setContentLength(reportOutputDocument.getContent().length); - raw.getOutputStream().write(reportOutputDocument.getContent()); - res.status(200); + HttpServletResponse raw = res.raw(); + raw.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", reportOutputDocument.getDocumentName())); + raw.setContentLength(reportOutputDocument.getContent().length); + raw.getOutputStream().write(reportOutputDocument.getContent()); + res.status(200); } } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Simple.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Simple.java index c72846a05d1e..2a3b60a5e7f9 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Simple.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/incompleteHighlighting/Simple.java @@ -45,9 +45,9 @@ public class Simple { } void refsInUnresolvedClass(Cls s) { - s.hashCode(); - s.dream(); - System.out.println(s.field); + s.hashCode(); + s.dream(); + System.out.println(s.field); System.out.println(Cls.STATIC); } @@ -98,11 +98,11 @@ public class Simple { @Anno(Cls.CONST) void testAssign(Unknown u) { - u.field = 2; + u.field = 2; } void callOnArray(Unknown u) { - u.foo()[0].blah(); + u.foo()[0].blah(); } void initArray() { @@ -116,10 +116,10 @@ public class Simple { void varTest() { var x = Cls.getSomething(); - x.getSomethingElse(); + x.getSomethingElse(); var y = x; - var z = y.getSomethingCompletelyDifferent(); - z.getFromZ(); + var z = y.getSomethingCompletelyDifferent(); + z.getFromZ(); var t = t; } @@ -135,7 +135,7 @@ public class Simple { void testThrow(Cls cls) { try { - cls.unknownM(); + cls.unknownM(); } catch (Cls x) { } catch (IOException | RuntimeException ex) { @@ -158,7 +158,7 @@ public class Simple { void declaredUnknownException() throws Cls {} void testConcat(Cls cls) { - System.out.println("hello " + cls.getSomething() + "!!!"); + System.out.println("hello " + cls.getSomething() + "!!!"); } static class Clss implements MyInterface { diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/AvoidWarningAtNotInferredType.java b/java/java-tests/testData/inspection/dataFlow/fixture/AvoidWarningAtNotInferredType.java index 5b3ddfd1aab6..a48ff3773520 100644 --- a/java/java-tests/testData/inspection/dataFlow/fixture/AvoidWarningAtNotInferredType.java +++ b/java/java-tests/testData/inspection/dataFlow/fixture/AvoidWarningAtNotInferredType.java @@ -1,7 +1,7 @@ class Test { void test() { var x = unresolved(); - System.out.println(x.hashCode()); - System.out.println(x.x); + System.out.println(x.hashCode()); + System.out.println(x.x); } } \ No newline at end of file diff --git a/java/java-tests/testData/inspection/dataFlow/fixture/InstanceOfUnresolved.java b/java/java-tests/testData/inspection/dataFlow/fixture/InstanceOfUnresolved.java index 0a90009da697..1f92ae0a5ee4 100644 --- a/java/java-tests/testData/inspection/dataFlow/fixture/InstanceOfUnresolved.java +++ b/java/java-tests/testData/inspection/dataFlow/fixture/InstanceOfUnresolved.java @@ -4,7 +4,7 @@ class Test { } void test2(XXX bar) { - System.out.println(bar.hashCode()); + System.out.println(bar.hashCode()); if (bar instanceof CharSequence) {} } diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt index 1c8c11be9f5a..5754efffeb48 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 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(1, ProjectProblemUtils.getReportedProblems(myFixture.editor).entries) + assertSize(2, ProjectProblemUtils.getReportedProblems(myFixture.editor).entries) changeClass(targetClass) { psiClass, _ -> psiClass.identifyingElement?.replace(factory.createIdentifier("A")) diff --git a/plugins/lombok/testData/highlights/incomplete/Logs.java b/plugins/lombok/testData/highlights/incomplete/Logs.java index c9133134e465..4ff5988ba751 100644 --- a/plugins/lombok/testData/highlights/incomplete/Logs.java +++ b/plugins/lombok/testData/highlights/incomplete/Logs.java @@ -4,6 +4,6 @@ import lombokinfo("Hello World!"); } } \ No newline at end of file