Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-6025

Jackpot has trouble with lambdas

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 12.5
    • None
    • java - Hints
    • None
    • JDK 17 (both for NB and the test project), no nb-javac used.

    Description

      The first rule works. The second rule never captures anything, the third causes a class cast exception.

      $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()
      ;;

       

      // test snippet:
      IntStream.of(1,2,3).mapToObj(x -> x);

      exception of third rule:

      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)
       
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            mbien Michael Bien
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: