hsyuan commented on a change in pull request #1484: [Calcite-3386] fix 
misleading stack trace of Calcite's cyclic meta exception
URL: https://github.com/apache/calcite/pull/1484#discussion_r331698624
 
 

 ##########
 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:
   You can remove these 2 lines. Better to move them into the commit messages, 
instead of commenting here.

----------------------------------------------------------------
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