[ 
https://issues.apache.org/jira/browse/NETBEANS-5996?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aliaksandr Rasolka updated NETBEANS-5996:
-----------------------------------------
    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.
{noformat}
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
...{noformat}
 

>From *UserDao* I call method
{code:java}
public <T> List<T> processMultipleResultsSelectRequest(
            String sql,
            PreparedStatementContainerInitializer statementInitializer,
            Supplier<T> entityCreator,
            EntityInitializer<T> entityInitializer) throws DaoException {
...
}{code}
I pass reference to constructor as a parameter for *entityCreator* parameter.
 If I place parameters correctly:
{code:java}
requestHandler.processMultipleResultsSelectRequest(
        "some SQL String",
        null,
        User::new,
        this::initUser);
{code}
, everything works just fine.

However, I've found that if i swap parameters by mistake and do something like 
that:
{code:java}
requestHandler.processMultipleResultsSelectRequest(
        SQL_SELECT_ALL,
        User::new,
        null,
        this::initUser);
{code}
, instead of highlighting my mistake, I got 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.

 

  was:
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.
{noformat}
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
...{noformat}
 

>From *UserDao* I call method
{code:java}
public <T> List<T> processMultipleResultsSelectRequest(
            String sql,
            PreparedStatementContainerInitializer statementInitializer,
            Supplier<T> entityCreator,
            EntityInitializer<T> entityInitializer) throws DaoException {
...
}{code}
I pass reference to constructor as a parameter for *entityCreator* parameter.
 If I place parameters correctly:
{code:java}
requestHandler.processMultipleResultsSelectRequest(
        "some SQL String",
        null,
        User::new,
        this::initUser);
{code}
, everything works just fine.

However, I've found that if i swap parameters by mistake and do something like 
that:
{code:java}
requestHandler.processMultipleResultsSelectRequest(
        SQL_SELECT_ALL,
        User::new,
        null,
        this::initUser);
{code}
, instead of highlighting my mistake, I got 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.

 


> Code highlighting and error checking stop working when method reference 
> passed as a parameter where it should't be. Page and/or application reload 
> don't help
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: NETBEANS-5996
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-5996
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Source
>    Affects Versions: 12.4
>            Reporter: Aliaksandr Rasolka
>            Priority: Major
>         Attachments: IDE log.txt, UI log.zip, UserDao_150.dump
>
>
> 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.
> {noformat}
> 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
> ...{noformat}
>  
> From *UserDao* I call method
> {code:java}
> public <T> List<T> processMultipleResultsSelectRequest(
>             String sql,
>             PreparedStatementContainerInitializer statementInitializer,
>             Supplier<T> entityCreator,
>             EntityInitializer<T> entityInitializer) throws DaoException {
> ...
> }{code}
> I pass reference to constructor as a parameter for *entityCreator* parameter.
>  If I place parameters correctly:
> {code:java}
> requestHandler.processMultipleResultsSelectRequest(
>         "some SQL String",
>         null,
>         User::new,
>         this::initUser);
> {code}
> , everything works just fine.
> However, I've found that if i swap parameters by mistake and do something 
> like that:
> {code:java}
> requestHandler.processMultipleResultsSelectRequest(
>         SQL_SELECT_ALL,
>         User::new,
>         null,
>         this::initUser);
> {code}
> , instead of highlighting my mistake, I got 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.
>  



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

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

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

Reply via email to