sanha commented on a change in pull request #241: [NEMO-424] Fix Sonarcloud 
bugs regarding Optional
URL: https://github.com/apache/incubator-nemo/pull/241#discussion_r334502150
 
 

 ##########
 File path: 
compiler/optimizer/src/main/java/org/apache/nemo/compiler/optimizer/pass/compiletime/annotating/ResourceSitePass.java
 ##########
 @@ -164,7 +164,7 @@ private static void assignNodeShares(
    */
   private static boolean isOneToOneEdge(final Collection<IREdge> inEdges) {
     return inEdges.size() == 1 && inEdges.iterator().next()
-      .getPropertyValue(CommunicationPatternProperty.class).get()
+      
.getPropertyValue(CommunicationPatternProperty.class).orElseThrow(IllegalStateException::new)
 
 Review comment:
   It seems that all `Optional`s changed in this PR must have some value but 
not empty. (I guess that this is the reason why the authors just `.get()` 
instead of `.orElseThrow(...)`.) If you found any of them may have a legal 
empty, please let me know.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to