Skip to content

Add expressionAllowed param to getPropertyOption#1312

Merged
olabusayoT merged 1 commit intoapache:mainfrom
olabusayoT:daf-2928-fixGetPropertyOptionCalls
Sep 30, 2024
Merged

Add expressionAllowed param to getPropertyOption#1312
olabusayoT merged 1 commit intoapache:mainfrom
olabusayoT:daf-2928-fixGetPropertyOptionCalls

Conversation

@olabusayoT
Copy link
Copy Markdown
Contributor

  • update function calls
  • update tests to ensure we no longer get warnings about textStandardExponentRep

DAFFODIL-2928

Copy link
Copy Markdown
Contributor

@mbeckerle mbeckerle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Member

@stevedlawrence stevedlawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 👍 just minor suggestions for possible cleanup

Comment on lines 462 to 468
"textStandardInfinityRep",
"textStandardNaNRep",
"textStandardZeroRep",
"nilValue",
"textStringPadCharacter",
"textNumberPadCharacter",
"textBooleanPadCharacter",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ones now in the runtimeValuedProperties are not really runtime valued properties, they are just done by hand for some reason (i'm not sure why?). I wonder if they really belong in the excludedBecauseDoneByHand member up above? And then excludeRuntimeProperties really only has to look at expressionAllowedProperities

.replaceAll("false", "true") // add expression allowed for these
} else {
template.replaceAll("currency", propName)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on changing false to expressionAllowed and then just always do something like this?

val expressionAllowStr = expressionAllowedProperties.contains(propName).toString
template
  .replace("currency", propName)
  .replace("expressionAllowed", expressionAllowedStr)

Avoids the replace duplicate code and matches on something less common to avoid possible incorrect replacements if we ever tweak this template.

lazy val textStandardExponentRep: Found = {
val tsec = getPropertyOption("textStandardExponentCharacter")
val tser = getPropertyOption("textStandardExponentRep")
val tser = getPropertyOption("textStandardExponentRep", expressionAllowed = true)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug mentioned several properties that needed this. Did you confirm this is the only case that's missing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, most of the properties that needed it were called by GeneratedCode.scala...this was the only one that needed it that was called outside generated code

- move non-runtimed valued properties to excludedBecauseDoneByHand
- update function calls
- update tests to ensure we no longer get warnings about textStandardExponentRep

DAFFODIL-2928
@olabusayoT olabusayoT force-pushed the daf-2928-fixGetPropertyOptionCalls branch from 93f7afb to b5be895 Compare September 30, 2024 17:28
@olabusayoT olabusayoT merged commit 97463b7 into apache:main Sep 30, 2024
@olabusayoT olabusayoT deleted the daf-2928-fixGetPropertyOptionCalls branch September 30, 2024 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants