You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Michael Bien (Jira)" <ji...@apache.org> on 2021/09/20 08:01:00 UTC

[jira] [Created] (NETBEANS-6025) Jackpot has trouble with lambdas

Michael Bien created NETBEANS-6025:
--------------------------------------

             Summary: Jackpot has trouble with lambdas
                 Key: NETBEANS-6025
                 URL: https://issues.apache.org/jira/browse/NETBEANS-6025
             Project: NetBeans
          Issue Type: Bug
          Components: java - Hints
    Affects Versions: 12.5
         Environment: JDK 17 (both for NB and the test project), no nb-javac used.
            Reporter: Michael Bien


The first rule works. The second rule never captures anything, the third causes a class cast exception.
{code:java}
$stream.mapToObj($lambda) :: $stream instanceof java.util.stream.IntStream =>
$stream.boxed()
;;

$stream.mapToObj($x -> $x) :: $stream instanceof java.util.stream.IntStream =>
$stream.boxed()
;;

$stream.mapToObj(($x) -> $x) :: $stream instanceof java.util.stream.IntStream =>
$stream.boxed()
;;{code}
 
{code:java}
// test snippet:
IntStream.of(1,2,3).mapToObj(x -> x);{code}
exception of third rule:
{code:java}
java.lang.ClassCastException: class org.netbeans.modules.java.hints.spiimpl.JackpotTrees$com$sun$tools$javac$tree$JCTree$JCVariableDecl cannot be cast to class com.sun.tools.javac.tree.JCTree$JCIdent (org.netbeans.modules.java.hints.spiimpl.JackpotTrees$com$sun$tools$javac$tree$JCTree$JCVariableDecl is in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @6c880b02; com.sun.tools.javac.tree.JCTree$JCIdent is in module jdk.compiler of loader 'app')
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.visitIdentifier(TreeCopier.java:244)
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.visitIdentifier(TreeCopier.java:44)
 at org.netbeans.modules.java.hints.spiimpl.JackpotTrees$com$sun$tools$javac$tree$JCTree$JCVariableDecl.accept(Unknown Source)
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.copy(TreeCopier.java:60)
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.copy(TreeCopier.java:72)
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.visitBlock(TreeCopier.java:135)
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.visitBlock(TreeCopier.java:44)
 at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1103)
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.copy(TreeCopier.java:60)
 at jdk.compiler/com.sun.tools.javac.tree.TreeCopier.copy(TreeCopier.java:53)
 at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:479)
 at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:467)
 at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:442)
 at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.lambda$visitLambda$4(ArgumentAttr.java:301)
 at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.processArg(ArgumentAttr.java:242)
 at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitLambda(ArgumentAttr.java:299)
 at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1974)
 at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:197)
 at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:672)
 at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:775)
 at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2554)
 at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1797)
 at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
 at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:720)
 at org.netbeans.modules.java.hints.spiimpl.Utilities.attributeTree(Utilities.java:656)
 at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:436)
 at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:350)
 at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:330)
 at org.netbeans.modules.java.hints.spiimpl.Utilities.parseAndAttribute(Utilities.java:326)
 at org.netbeans.modules.java.hints.spiimpl.pm.PatternCompiler.compile(PatternCompiler.java:44)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.doComputeHints(HintsInvoker.java:535)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHintsImpl(HintsInvoker.java:283)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:228)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:193)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:166)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker.computeHints(HintsInvoker.java:128)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:114)
 at org.netbeans.modules.java.hints.spiimpl.hints.HintsTask.run(HintsTask.java:65)
[catch] at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:273)
 at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561)
 at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786)
 at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
 at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
 at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
 at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
 at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
 at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
 at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
 
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists