You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
org.apache.commons.lang3.exception.ContextedRuntimeException: java.lang.IllegalArgumentException: Bad intersection, unrelated class types java.lang.Object[] and java.lang.Number in [java.lang.Number, java.lang.Object[]]
Exception Context:
[1:Resolving type of=!debug only! [MethodCall:81:10]Stream.of(foo())]
[2:Rule applied on node=!debug only! [MethodCall:81:10]Stream.of(foo())]
---------------------------------
at net.sourceforge.pmd.util.AssertionUtil.contexted(AssertionUtil.java:236)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaTypeNode.getTypeMirror(AbstractJavaTypeNode.java:54)
at net.sourceforge.pmd.lang.java.ast.ASTMethodCall.getTypeMirror(ASTMethodCall.java:22)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaTypeNode.getTypeMirror(AbstractJavaTypeNode.java:39)
at net.sourceforge.pmd.lang.java.ast.ASTMethodCall.getTypeMirror(ASTMethodCall.java:22)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaTypeNode.forceTypeResolution(AbstractJavaTypeNode.java:29)
at net.sourceforge.pmd.lang.java.ast.AbstractInvocationExpr.getOverloadSelectionInfo(AbstractInvocationExpr.java:27)
at net.sourceforge.pmd.lang.java.ast.ASTMethodCall.getOverloadSelectionInfo(ASTMethodCall.java:22)
at net.sourceforge.pmd.lang.java.ast.InvocationNode.getMethodType(InvocationNode.java:48)
at net.sourceforge.pmd.lang.java.rule.internal.TestFrameworksUtil.isCallOnAssertionContainer(TestFrameworksUtil.java:166)
at net.sourceforge.pmd.lang.java.rule.bestpractices.JUnitAssertionsShouldIncludeMessageRule.visit(JUnitAssertionsShouldIncludeMessageRule.java:37)
at net.sourceforge.pmd.lang.java.ast.ASTMethodCall.acceptVisitor(ASTMethodCall.java:75)
at net.sourceforge.pmd.lang.java.ast.AbstractJavaNode.acceptVisitor(AbstractJavaNode.java:38)
at net.sourceforge.pmd.lang.java.rule.AbstractJavaRule.apply(AbstractJavaRule.java:30)
at net.sourceforge.pmd.lang.rule.RuleReference.apply(RuleReference.java:415)
at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.applyOnIndex(RuleApplicator.java:77)
at net.sourceforge.pmd.lang.rule.internal.RuleApplicator.apply(RuleApplicator.java:57)
at net.sourceforge.pmd.lang.rule.internal.RuleSets.apply(RuleSets.java:155)
at net.sourceforge.pmd.lang.impl.PmdRunnable.processSource(PmdRunnable.java:140)
at net.sourceforge.pmd.lang.impl.PmdRunnable.run(PmdRunnable.java:80)
at java.base@21.0.2/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base@21.0.2/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base@21.0.2/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base@21.0.2/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base@21.0.2/java.lang.Thread.run(Thread.java:1583)
boris-petrov
changed the title
[java] Bad intersection, unr elated class types java.lang.Object[] and java.lang.Number
[java] Bad intersection, unrelated class types java.lang.Object[] and java.lang.Number
Apr 26, 2024
- When an applicability test fails (ie: during LUB) we don't want that
to bubble up and fail the process, simply to discard the candidate
and move forward. If no matching candidate is found, the inference
will fail anyway.
@boris-petrov thanks for pointing this one out. It's effectively a bug, I'm able to reproduce it and have a basic fix in place. Still some work to do, but should be ok for 7.2.0
Affects PMD Version:
7.1.0.
Description:
This code:
Leads to:
Exception Stacktrace:
Code Sample demonstrating the issue:
See above.
Steps to reproduce:
Run PMD on that code.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Gradle.
The text was updated successfully, but these errors were encountered: