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

Code highlighting and error checking stop working when method reference passed as a parameter where it should't be.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 12.4
    • None
    • java - Source
    • None

    Description

      Code highlighting and error checking stop working when method reference passed as a parameter to method not on it's proper place. Page and/or application reload don't help.

      IDE said that I have found a bug in the application.

      Annotation: An error occurred during parsing of 
      'C:\Users\User\Documents\NetBeansProjects\MusicWaves\src\java\by\musicwaves\dao\UserDao.java'. 
      ...
      Please report a bug against java/source and attach dump file 
      'C:\Users\User\AppData\Roaming\NetBeans\12.4\var\log\UserDao_150.dump'.
      ...
      Caused by: java.lang.IllegalStateException: java.lang.ClassCastException  
      at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:383)  
      at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:729)  
      at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:515)  
      at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:139)  
      at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)  
      at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:239)  
      at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)  
      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:515)  
      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)
      Caused by: java.lang.ClassCastException
      ...

       

      From UserDao I call method

      public <T> List<T> processMultipleResultsSelectRequest(
                  String sql,
                  PreparedStatementContainerInitializer statementInitializer,
                  Supplier<T> entityCreator,
                  EntityInitializer<T> entityInitializer) throws DaoException {
      ...
      }

      I pass reference to constructor as entityCreator parameter.
      If I place parameters correctly:

      requestHandler.processMultipleResultsSelectRequest(
              "some SQL String",
              null,
              User::new,
              this::initUser);
      

      , everything works just fine.

      However, I've found that if I swap parameters by mistake and do something like that:

      requestHandler.processMultipleResultsSelectRequest(
              "some SQL String",
              User::new,
              null,
              this::initUser);
      

      , instead of highlighting my mistake, I get an error message from IDE.

       

      IDE log and UI log are attached in case there is something useful inside. I copied text from them a bit earlier so there might be mentioned some other UserDao_XXX.dump.

      UserDao_150.dump attached since it was requested by IDE.

       

      Attachments

        1. UI log.zip
          100 kB
          Aliaksandr Rasolka
        2. IDE log.txt
          591 kB
          Aliaksandr Rasolka
        3. UserDao_150.dump
          13 kB
          Aliaksandr Rasolka

        Activity

          People

            mjayan Meghna Jayan
            Hush Aliaksandr Rasolka
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: