sdedic opened a new pull request, #5191:
URL: https://github.com/apache/netbeans/pull/5191

   In #5118, I have created a generic method that rethrows callable's (checked) 
exception using `sneaky throws` approach - but the code is not compilable on 
JDK8 because the JDK8 javac fails to infer types properly:
   ```
    [nb-javac] 
/space/src/vscode/netbeans/java/java.lsp.server/nbcode/integration/src/org/netbeans/modules/nbcode/integration/commands/ProjectAuditCommand.java:149:
 error: call() in <anonymous 
org.netbeans.modules.nbcode.integration.commands.ProjectAuditCommand$> cannot 
implement call() in OCIOperation
    [nb-javac]         return OCIManager.usingSession(auditWithProfile, () -> 
v.findKnowledgeBase(knowledgeBase).
    [nb-javac]                                                          ^
    [nb-javac]   overridden method does not throw Exception
   ```
   
   One way is to typecast the lambda or augment the mehod call using explicit 
type parameters `<Object, Exception>`, but it seems that removing `extends 
Callable` from the `OCIOperation` interface does the same - and leaves caller 
code clean - and compiles on both JDK8 and JDK11 (JDK17)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to