A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/4885 below:

Method should be accessible · Issue #4885 · pmd/pmd · GitHub

Affects PMD Version:

7.0.0

Description:

Errors about unreachable methods are intermittently (only 50% of the times) produced.

  1. Unknown error occurred while executing a PmdRunnable: net.sourceforge.pmd.util.ContextedAssertionError: This should be unreachable: Method should be accessible java.lang.IllegalAccessException: no such method: net.sourceforge.pmd.lang.java.ast.ASTStringLiteral.getLiteralText()Chars/invokeVirtual
    Exception Context:
    [1:Rule applied on node=!debug only! [StringLiteral:9:29]"retracted"]
    at net.sourceforge.pmd.util.AssertionUtil.shouldNotReachHere(AssertionUtil.java:219)
  2. Unknown error occurred while executing a PmdRunnable: net.sourceforge.pmd.util.ContextedAssertionError: This should be unreachable: Method should be accessible java.lang.IllegalAccessException: no such method: net.sourceforge.pmd.lang.java.ast.ASTNumericLiteral.getLiteralText()Chars/invokeVirtual
    Exception Context:
    [1:Rule applied on node=!debug only! [NumericLiteral:11:21]0]
  3. Unknown error occurred while executing a PmdRunnable: net.sourceforge.pmd.util.ContextedAssertionError: This should be unreachable: Method should be accessible java.lang.IllegalAccessException: no such method: net.sourceforge.pmd.lang.java.ast.ASTStringLiteral.getLiteralText()Chars/invokeVirtual
    Exception Context:
    [1:Rule applied on node=!debug only! [StringLiteral:15:31]"no classes should use field injection"]

Exception Stacktrace:

  1.          at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:130)
            ....
     Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.gradle.api.plugins.quality.internal.PmdAction
             at org.gradle.workers.internal.DefaultWorkerExecutor$WorkItemExecution.waitForCompletion(DefaultWorkerExecutor.java:287)
             ....
     Caused by: : net.sourceforge.pmd.util.ContextedAssertionError: This should be unreachable: Method should be accessible java.lang.IllegalAccessException: no such method: net.sourceforge.pmd.lang.java.ast.ASTStringLiteral.getLiteralText()Chars/invokeVirtual
     Exception Context:
             [1:Rule applied on node=!debug only! [StringLiteral:9:29]"<retracted>"]
     ---------------------------------
             at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:109)
             ....
     Caused by: net.sourceforge.pmd.util.ContextedAssertionError: This should be unreachable: Method should be accessible java.lang.IllegalAccessException: no such method: net.sourceforge.pmd.lang.java.ast.ASTStringLiteral.getLiteralText()Chars/invokeVirtual
     Exception Context:
             [1:Rule applied on node=!debug only! [StringLiteral:9:29]"<retracted>"]
     ---------------------------------
             at net.sourceforge.pmd.util.AssertionUtil.shouldNotReachHere(AssertionUtil.java:219)
             at net.sourceforge.pmd.lang.rule.xpath.impl.AttributeAxisIterator.lambda$getWrappersForClass$1(AttributeAxisIterator.java:92)
             at net.sourceforge.pmd.lang.rule.xpath.impl.AttributeAxisIterator.getWrappersForClass(AttributeAxisIterator.java:95)
             at net.sourceforge.pmd.lang.rule.xpath.impl.AttributeAxisIterator.<init>(AttributeAxisIterator.java:82)
             at net.sourceforge.pmd.lang.ast.Node.getXPathAttributesIterator(Node.java:278)
             at net.sourceforge.pmd.lang.rule.xpath.internal.AstElementNode.getLightAttributes(AstElementNode.java:105)
             at net.sourceforge.pmd.lang.rule.xpath.internal.AstElementNode.getAttributeValue(AstElementNode.java:178)
             at net.sf.saxon.expr.AttributeGetter.evaluateItem(AttributeGetter.java:127)
             at net.sf.saxon.expr.AtomicSequenceConverter.evaluateItem(AtomicSequenceConverter.java:364)
             at net.sf.saxon.expr.AtomicSequenceConverter.evaluateItem(AtomicSequenceConverter.java:28)
             at net.sf.saxon.expr.Expression.evaluateAsString(Expression.java:917)
             at net.sf.saxon.functions.StartsWith$1.effectiveBooleanValue(StartsWith.java:52)
             at net.sf.saxon.expr.FilterIterator$NonNumeric.matches(FilterIterator.java:180)
             at net.sf.saxon.expr.FilterIterator.getNextMatchingItem(FilterIterator.java:77)
             at net.sf.saxon.expr.FilterIterator.next(FilterIterator.java:63)
             at net.sourceforge.pmd.lang.rule.xpath.internal.SaxonXPathRuleQuery.evaluate(SaxonXPathRuleQuery.java:127)
             at net.sourceforge.pmd.lang.rule.xpath.XPathRule.apply(XPathRule.java:101)
             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)
    
  2.          at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:130)
             ....
     Caused by: : net.sourceforge.pmd.util.ContextedAssertionError: This should be unreachable: Method should be accessible java.lang.IllegalAccessException: no such method: net.sourceforge.pmd.lang.java.ast.ASTNumericLiteral.getLiteralText()Chars/invokeVirtual
     Exception Context:
             [1:Rule applied on node=!debug only! [NumericLiteral:11:21]0]
     ---------------------------------
             at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:109)
            ....
     Caused by: net.sourceforge.pmd.util.ContextedAssertionError: This should be unreachable: Method should be accessible java.lang.IllegalAccessException: no such method: net.sourceforge.pmd.lang.java.ast.ASTNumericLiteral.getLiteralText()Chars/invokeVirtual
     Exception Context:
             [1:Rule applied on node=!debug only! [NumericLiteral:11:21]0]
     ---------------------------------
             at net.sourceforge.pmd.util.AssertionUtil.shouldNotReachHere(AssertionUtil.java:219)
             at net.sourceforge.pmd.lang.rule.xpath.impl.AttributeAxisIterator.lambda$getWrappersForClass$1(AttributeAxisIterator.java:92)
             at java.base@11.0.22/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
             at java.base@11.0.22/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
             at java.base@11.0.22/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
             at java.base@11.0.22/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
             at java.base@11.0.22/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
             at java.base@11.0.22/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
             at java.base@11.0.22/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
             at java.base@11.0.22/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
             at net.sourceforge.pmd.lang.rule.xpath.impl.AttributeAxisIterator.getWrappersForClass(AttributeAxisIterator.java:95)
             at java.base@11.0.22/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
             at net.sourceforge.pmd.lang.rule.xpath.impl.AttributeAxisIterator.<init>(AttributeAxisIterator.java:82)
             at net.sourceforge.pmd.lang.ast.Node.getXPathAttributesIterator(Node.java:278)
             at net.sourceforge.pmd.lang.rule.xpath.internal.AstElementNode.getLightAttributes(AstElementNode.java:105)
             at net.sourceforge.pmd.lang.rule.xpath.internal.AstElementNode.getAttributeValue(AstElementNode.java:178)
             at net.sf.saxon.expr.AttributeGetter.evaluateItem(AttributeGetter.java:127)
             at net.sf.saxon.expr.ValueComparison.effectiveBooleanValue(ValueComparison.java:357)
             at net.sf.saxon.expr.FilterIterator$NonNumeric.matches(FilterIterator.java:180)
             at net.sf.saxon.expr.FilterIterator.getNextMatchingItem(FilterIterator.java:77)
             at net.sf.saxon.expr.FilterIterator.next(FilterIterator.java:63)
             at net.sf.saxon.om.FocusTrackingIterator.next(FocusTrackingIterator.java:76)
             at net.sf.saxon.expr.FilterIterator.getNextMatchingItem(FilterIterator.java:76)
             at net.sf.saxon.expr.FilterIterator.next(FilterIterator.java:63)
             at net.sf.saxon.om.FocusTrackingIterator.next(FocusTrackingIterator.java:76)
             at net.sf.saxon.expr.FilterIterator.getNextMatchingItem(FilterIterator.java:76)
             at net.sf.saxon.expr.FilterIterator.next(FilterIterator.java:63)
             at net.sourceforge.pmd.lang.rule.xpath.internal.SaxonXPathRuleQuery.evaluate(SaxonXPathRuleQuery.java:127)
             at net.sourceforge.pmd.lang.rule.xpath.XPathRule.apply(XPathRule.java:101)
             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@11.0.22/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
             at java.base@11.0.22/java.util.concurrent.FutureTask.run(FutureTask.java:264)
             ... 3 more```
  3. see next comment, can't post here due to character limit

Code Sample demonstrating the issue:

I'm not a 100% sure, but these lines of code seem to be involved in producing the errors.

    @AnalyzeClasses(packages = {"<retracted-package-1>", "<retracted-package-2>"})
    assertNotEquals(0, hashCode());
    assertThatThrownBy(() -> MainArchUnitTest.NO_CLASSES_SHOULD_USE_FIELD_INJECTION.check(jc)).hasMessageContaining("no classes should use field injection");

Steps to reproduce:

Please provide detailed steps for how we can reproduce the bug.

  1. ./gradlew clean build --stacktrace

Running PMD through: Gradle

JDK 11


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4