You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/10/05 01:53:15 UTC

[GitHub] [calcite] zuozhiw commented on a change in pull request #1484: [CALCITE-3386] CyclicMetadataException singleton instance causes confusion when debugging

zuozhiw commented on a change in pull request #1484: [CALCITE-3386] CyclicMetadataException singleton instance causes confusion when debugging
URL: https://github.com/apache/calcite/pull/1484#discussion_r331727687
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/metadata/CyclicMetadataException.java
 ##########
 @@ -21,15 +21,12 @@
  * computing metadata.
  */
 public class CyclicMetadataException extends RuntimeException {
-  /** Singleton instance. Since this exception is thrown for signaling purposes,
-   * rather than on an actual error, re-using a singleton instance saves the
-   * effort of constructing an exception instance. */
-  @SuppressWarnings("ThrowableInstanceNeverThrown")
-  public static final CyclicMetadataException INSTANCE =
-      new CyclicMetadataException();
-
-  /** Creates a CyclicMetadataException. */
-  private CyclicMetadataException() {
+  /**
+   * Creates a CyclicMetadataException.
+   * Reusing a singleton instance is a bad idea because of wrong stack trace.
+   * See https://stackoverflow.com/questions/15090664
 
 Review comment:
   this is removed from the code and moved to commit message

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services