You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2020/04/18 20:06:19 UTC
[GitHub] [incubator-daffodil] mbeckerle opened a new pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
mbeckerle opened a new pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366
Converted many pass-by-name into pass-by-value for RuntimeData structures.
Other minor mods that eliminate some circularities that allow for more
by-value passing.
One of the major problems preventing more by-value passing is described in DAFFODIL-2326, which is about the passing of RuntimeData to the constructor of DPathCompileInfo.
This branch changes things that can be changed without fixing DAFFODIL-2326.
This set of changes should make incremental progress on DAFFODIL-1879.
DAFFODIL-2325
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r410744847
##########
File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/RuntimeData.scala
##########
@@ -224,75 +198,36 @@ sealed class NonTermRuntimeData(
object UseNilForDefault
final class SimpleTypeRuntimeData(
- @TransientParam variableMapArg: => VariableMap,
- @TransientParam schemaFileLocationArg: => SchemaFileLocation,
- @TransientParam diagnosticDebugNameArg: => String,
- @TransientParam pathArg: => String,
- @TransientParam namespacesArg: => NamespaceBinding,
- @TransientParam primTypeArg: => NodeInfo.PrimType,
- @TransientParam noFacetChecksArg: => Boolean,
- @TransientParam patternValuesArg: => Seq[FacetTypes.FacetValueR],
- @TransientParam enumerationValuesArg: => Option[String],
- @TransientParam minLengthArg: => Option[java.math.BigDecimal],
- @TransientParam maxLengthArg: => Option[java.math.BigDecimal],
- @TransientParam minInclusiveArg: => Option[java.math.BigDecimal],
- @TransientParam maxInclusiveArg: => Option[java.math.BigDecimal],
- @TransientParam minExclusiveArg: => Option[java.math.BigDecimal],
- @TransientParam maxExclusiveArg: => Option[java.math.BigDecimal],
- @TransientParam totalDigitsArg: => Option[java.math.BigDecimal],
- @TransientParam fractionDigitsArg: => Option[java.math.BigDecimal],
- @TransientParam unionMemberTypesArg: => Seq[SimpleTypeRuntimeData],
- @TransientParam unqualifiedPathStepPolicyArg: => UnqualifiedPathStepPolicy,
- @TransientParam repTypeRuntimeDataArg: => Option[SimpleTypeRuntimeData],
- @TransientParam repValueSetArg: => Option[RepValueSet],
- @TransientParam typeCalculatorArg: => Option[TypeCalculator],
- @TransientParam optRepPrimTypeArg: => Option[PrimType])
+ variableMapArg: VariableMap,
+ schemaFileLocationArg: SchemaFileLocation,
+ diagnosticDebugNameArg: String,
+ pathArg: String,
+ namespacesArg: NamespaceBinding,
+ val primType: NodeInfo.PrimType,
+ val noFacetChecks: Boolean,
+ val patternValues: Seq[FacetTypes.FacetValueR],
+ val enumerationValues: Option[String],
+ val minLength: Option[java.math.BigDecimal],
+ val maxLength: Option[java.math.BigDecimal],
+ val minInclusive: Option[java.math.BigDecimal],
+ val maxInclusive: Option[java.math.BigDecimal],
+ val minExclusive: Option[java.math.BigDecimal],
+ val maxExclusive: Option[java.math.BigDecimal],
+ val totalDigits: Option[java.math.BigDecimal],
+ val fractionDigits: Option[java.math.BigDecimal],
+ val unionMemberTypes: Seq[SimpleTypeRuntimeData],
+ unqualifiedPathStepPolicyArg: UnqualifiedPathStepPolicy,
+ val repTypeRuntimeData: Option[SimpleTypeRuntimeData],
+ val repValueSet: Option[RepValueSet],
+ val typeCalculator: Option[TypeCalculator],
+ val optRepPrimType: Option[PrimType])
extends NonTermRuntimeData(variableMapArg, schemaFileLocationArg, diagnosticDebugNameArg,
pathArg, namespacesArg, unqualifiedPathStepPolicyArg) {
import org.apache.daffodil.util.OKOrError._
- lazy val primType = primTypeArg
- lazy val noFacetChecks = noFacetChecksArg
- lazy val patternValues = patternValuesArg
- lazy val enumerationValues = enumerationValuesArg
- lazy val minLength = minLengthArg
- lazy val maxLength = maxLengthArg
- lazy val minInclusive = minInclusiveArg
- lazy val maxInclusive = maxInclusiveArg
- lazy val minExclusive = minExclusiveArg
- lazy val maxExclusive = maxExclusiveArg
- lazy val totalDigits = totalDigitsArg
- lazy val fractionDigits = fractionDigitsArg
- lazy val unionMemberTypes = unionMemberTypesArg
- lazy val repTypeRuntimeData = repTypeRuntimeDataArg
- lazy val repValueSet = repValueSetArg
- lazy val typeCalculator = typeCalculatorArg
- lazy val optRepPrimType = optRepPrimTypeArg
-
- override def preSerialization: Unit = {
- super.preSerialization
- primType
- noFacetChecks
- patternValues
- enumerationValues
- minLength
- maxLength
- minInclusive
- maxInclusive
- minExclusive
- maxExclusive
- totalDigits
- fractionDigits
- unionMemberTypes
- repTypeRuntimeData
- repValueSet
- typeCalculator
- optRepPrimType
- }
-
- @throws(classOf[java.io.IOException])
- final private def writeObject(out: java.io.ObjectOutputStream): Unit = serializeObject(out)
+// @throws(classOf[java.io.IOException])
Review comment:
delete commented code.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r410744639
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/grammar/AlignedMixin.scala
##########
@@ -17,17 +17,10 @@
package org.apache.daffodil.grammar
-import org.apache.daffodil.dsom.Term
-import org.apache.daffodil.dsom.ElementBase
-import org.apache.daffodil.dsom.ModelGroup
-import org.apache.daffodil.dsom.PrefixLengthQuasiElementDecl
-import org.apache.daffodil.schema.annotation.props.gen.AlignmentUnits
-import org.apache.daffodil.schema.annotation.props.gen.LengthKind
-import org.apache.daffodil.schema.annotation.props.gen.LengthUnits
+import org.apache.daffodil.schema.annotation.props.gen.{AlignmentUnits, LengthKind, LengthUnits}
import org.apache.daffodil.util.Math
-import org.apache.daffodil.dsom.Root
import org.apache.daffodil.exceptions.Assert
-import org.apache.daffodil.dsom.QuasiElementDeclBase
+import org.apache.daffodil.dsom.{Term, ElementBase, Root, ModelGroup, QuasiElementDeclBase}
Review comment:
revert import changes
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r410744598
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/TermEncodingMixin.scala
##########
@@ -31,7 +31,7 @@ import org.apache.daffodil.schema.annotation.props.gen.YesNo
*/
trait TermEncodingMixin extends KnownEncodingMixin { self: Term =>
- requiredEvaluationsAlways(encodingInfo.preSerialization)
+ // requiredEvaluationsAlways(encodingInfo.preSerialization)
Review comment:
Consider putting this back. Shouldn't hurt. If not delete commented code.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r410744533
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponent.scala
##########
@@ -19,21 +19,10 @@ package org.apache.daffodil.dsom
import scala.xml.Node
import org.apache.daffodil.exceptions.Assert
-import org.apache.daffodil.xml.GetAttributesMixin
-import org.apache.daffodil.xml.NS
-import org.apache.daffodil.xml.XMLUtils
-import org.apache.daffodil.processors.NonTermRuntimeData
-import org.apache.daffodil.processors.RuntimeData
-import org.apache.daffodil.processors.VariableMap
-import org.apache.daffodil.processors.NonTermRuntimeData
-import org.apache.daffodil.xml.ResolvesQNames
-import org.apache.daffodil.schema.annotation.props.LookupLocation
-import org.apache.daffodil.schema.annotation.props.PropTypes
-import org.apache.daffodil.oolag.OOLAG._
+import org.apache.daffodil.processors.{RuntimeData, VariableMap, NonTermRuntimeData}
Review comment:
Revert. This is just IntelliJ IDEA folding the imports into the scala { style } instead of line by line.
It also may be removing unneeded ones, which is ok, but we're not consciously converting everything to the other style.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r410744969
##########
File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/RuntimeData.scala
##########
@@ -993,22 +912,22 @@ final class ChoiceRuntimeData(
* hook these objects into a parent-child tree without
Review comment:
Fix comment. Not really about parent-child tree, but the fact that these provide access to objects which direclty or indirectly refer to this object.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r410744345
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
##########
@@ -422,7 +419,7 @@ trait ElementBase
case Representation.Binary =>
if (isComplexType || (primType != PrimType.HexBinary && primType != PrimType.AnyURI)) byteOrderEv // ensure defined
case _ =>
- charsetEv // ensure defined
+ encodingRaw // charsetEv // ensure defined
Review comment:
fix comment
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r410744710
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/runtime1/SchemaSetRuntime1Mixin.scala
##########
@@ -34,10 +34,10 @@ import org.apache.daffodil.util.LogLevel
trait SchemaSetRuntime1Mixin { self : SchemaSet =>
- requiredEvaluationsAlways(variableMap)
+ // requiredEvaluationsAlways(variableMap)
Review comment:
put back or delete commented code.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] stevedlawrence commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
stevedlawrence commented on a change in pull request #366:
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r411354604
##########
File path: daffodil-core/src/test/scala/org/apache/daffodil/dsom/TestMiddleEndAttributes.scala
##########
@@ -116,7 +115,8 @@ class TestMiddleEndAttributes {
@Test def testStaticallyFirstWithChoice {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format representation="text" occursCountKind="parsed" lengthUnits="bytes" encoding="US-ASCII" initiator="" terminator="" separator="" ignoreCase="no"/>,
+ <dfdl:format representation="text" occursCountKind="parsed" lengthUnits="bytes" encoding="US-ASCII" initiator="" terminator="" separator="" ignoreCase="no"
+ alignment="1" alignmentUnits="bytes" leadingSkip="0" trailingSkip="0"/>,
Review comment:
Why was this change needed?
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] olabusayoT commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
olabusayoT commented on a change in pull request #366:
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r413012854
##########
File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/RuntimeData.scala
##########
@@ -993,22 +912,22 @@ final class ChoiceRuntimeData(
* hook these objects into a parent-child tree without
Review comment:
is this supposed to be fixed w/i this PR?
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/runtime1/SchemaSetRuntime1Mixin.scala
##########
@@ -34,10 +34,10 @@ import org.apache.daffodil.util.LogLevel
trait SchemaSetRuntime1Mixin { self : SchemaSet =>
- requiredEvaluationsAlways(variableMap)
+ // requiredEvaluationsAlways(variableMap)
Review comment:
With the efforts from the Sonarcloud clean ups, I'd rather we delete. If we need it we can add it back
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/runtime1/SchemaSetRuntime1Mixin.scala
##########
@@ -34,10 +34,10 @@ import org.apache.daffodil.util.LogLevel
trait SchemaSetRuntime1Mixin { self : SchemaSet =>
- requiredEvaluationsAlways(variableMap)
+ // requiredEvaluationsAlways(variableMap)
requiredEvaluationsAlways(parser)
requiredEvaluationsAlways(unparser)
- requiredEvaluationsAlways(root.runtimeData)
+ // requiredEvaluationsAlways(root.runtimeData)
Review comment:
Same as above
##########
File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/TermEncodingMixin.scala
##########
@@ -31,7 +31,7 @@ import org.apache.daffodil.schema.annotation.props.gen.YesNo
*/
trait TermEncodingMixin extends KnownEncodingMixin { self: Term =>
- requiredEvaluationsAlways(encodingInfo.preSerialization)
+ // requiredEvaluationsAlways(encodingInfo.preSerialization)
Review comment:
same.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366:
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r413156242
##########
File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/RuntimeData.scala
##########
@@ -993,22 +912,22 @@ final class ChoiceRuntimeData(
* hook these objects into a parent-child tree without
Review comment:
I think so. One reason for the cycles was, in the past parent/child doubly-linked structure. We don't have that now so that reason isn't there any more, which is why the comment is no longer relevant.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on a change in pull request #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on a change in pull request #366:
URL: https://github.com/apache/incubator-daffodil/pull/366#discussion_r411454544
##########
File path: daffodil-core/src/test/scala/org/apache/daffodil/dsom/TestMiddleEndAttributes.scala
##########
@@ -116,7 +115,8 @@ class TestMiddleEndAttributes {
@Test def testStaticallyFirstWithChoice {
val testSchema = SchemaUtils.dfdlTestSchema(
<xs:include schemaLocation="org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>,
- <dfdl:format representation="text" occursCountKind="parsed" lengthUnits="bytes" encoding="US-ASCII" initiator="" terminator="" separator="" ignoreCase="no"/>,
+ <dfdl:format representation="text" occursCountKind="parsed" lengthUnits="bytes" encoding="US-ASCII" initiator="" terminator="" separator="" ignoreCase="no"
+ alignment="1" alignmentUnits="bytes" leadingSkip="0" trailingSkip="0"/>,
Review comment:
Well these properties are allowed to be required "from the get go" by the DFDL spec. Daffodil was not requiring them because the by-name parameters for the RunitmeData was allowing the error of not having them to be delayed until later, and at that point it got masked by some other error.
When I removed the by-name from this, now the test fails earlier with lack of alignment and leading/strailing skip, rather than getting the expected error. Putting in these properties enables the test to continue to test what it was intended to illustrate.
----------------------------------------------------------------
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
[GitHub] [incubator-daffodil] mbeckerle commented on issue #366: Converted many pass-by-name into pass-by-value for RuntimeData struct…
Posted by GitBox <gi...@apache.org>.
mbeckerle commented on issue #366:
URL: https://github.com/apache/incubator-daffodil/pull/366#issuecomment-617998792
Oops. I force-pushed this, which means it's harder to see updates where comments were made.
All the comments were fixed. All the commented code lines removed.
----------------------------------------------------------------
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