mbeckerle commented on a change in pull request #326: Daffodil 2280 cleanup - 
removes backpointers and factory patterns no longer needed
URL: https://github.com/apache/incubator-daffodil/pull/326#discussion_r394622980
 
 

 ##########
 File path: daffodil-lib/src/main/scala/org/apache/daffodil/api/Diagnostic.scala
 ##########
 @@ -21,29 +21,64 @@ import org.apache.daffodil.util.Misc
 import org.apache.daffodil.exceptions.Assert
 import org.apache.daffodil.util.Maybe
 import org.apache.daffodil.exceptions.SchemaFileLocation
-import org.apache.daffodil.exceptions.ThinThrowableWithCause
+import org.apache.daffodil.exceptions.ThinException
 
 /**
- * Base class for all error, warning, info, and other sorts of objects
- * that capture diagnostic information.
+ * Base class for all "thin" (no stack trace) diagnostic objects.
+ * Such as processing errors.
+ */
+abstract class ThinDiagnostic(
+  schemaContext: Maybe[SchemaFileLocation],
+  dataContext: Maybe[DataLocation],
+  maybeCause: Maybe[Throwable],
+  maybeFormatString: Maybe[String],
+  args: Any*)
+  extends Diagnostic(
+    false, // thin, i.e., not isThick
+    schemaContext,
+    dataContext,
+    maybeCause,
+    maybeFormatString,
+    args: _*) {
+  Assert.invariant(maybeCause.isDefined || maybeFormatString.isDefined)
+}
+/**
+ * Base class for all thick or thin error, warning, info, and other sorts of 
objects
+ * that capture diagnostic information. Such as Schema Definition 
Errors/Warnings.
  *
  * Allows for lazy message creation, internationalization, etc.
  */
-abstract class Diagnostic(
+abstract class Diagnostic protected (
 
 Review comment:
   Again this is protected constructor. This idiom is so that this particular 
constructor, the primary one with all the various confusing parameters, is only 
available for derived classes or more tidy public constructors to use.  
   
   As for what this actually means. This means derived classes will implement a 
constructor with this same big all-the-args signature, and that one will ahve 
this same visibility protected. Their public constructors are the ones in the 
API intended for use. 

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