You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "olabusayoT (via GitHub)" <gi...@apache.org> on 2025/04/02 18:09:45 UTC
[PR] Fix overriding non-lazy val with lazy val [daffodil]
olabusayoT opened a new pull request, #1468:
URL: https://github.com/apache/daffodil/pull/1468
- make non-lazy val a def since lazy vals cannot be abstract
- scala 3 no longer allows a lazy value of type Unit to override a def of type unit (warning: lazy value X of type Unit no longer has compatible type scala)
- scala 3 no longer allows overriding a val parameter (warning: overriding val parameter value X in class Y is deprecated, will be illegal in a future version)
- remove ambiguity causing abstract definitions
DAFFODIL-2975
--
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.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix overriding non-lazy val with lazy val [daffodil]
Posted by "olabusayoT (via GitHub)" <gi...@apache.org>.
olabusayoT merged PR #1468:
URL: https://github.com/apache/daffodil/pull/1468
--
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.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix overriding non-lazy val with lazy val [daffodil]
Posted by "olabusayoT (via GitHub)" <gi...@apache.org>.
olabusayoT commented on code in PR #1468:
URL: https://github.com/apache/daffodil/pull/1468#discussion_r2028925752
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/CompiledExpression1.scala:
##########
@@ -367,7 +367,7 @@ class DPathElementCompileInfo(
/**
* Cyclic objects require initialization
*/
- override lazy val initialize: Unit = {
+ override def initialize(): Unit = {
Review Comment:
Scala 3 complains of overrding a def with a lazy value...I will implement your change above to make it the same functionality
370 | override lazy val initialize: Unit = {
[error] | ^
[error] |error overriding method initialize in class DPathCompileInfo of type (): Unit;
[error] | lazy value initialize of type Unit no longer has compatible type
--
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.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix overriding non-lazy val with lazy val [daffodil]
Posted by "olabusayoT (via GitHub)" <gi...@apache.org>.
olabusayoT commented on code in PR #1468:
URL: https://github.com/apache/daffodil/pull/1468#discussion_r2028912283
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ExpressionEvaluatingParsers.scala:
##########
@@ -37,9 +37,11 @@ import org.apache.daffodil.runtime1.processors.VariableRuntimeData
*/
abstract class ExpressionEvaluationParser(
expr: CompiledExpression[AnyRef],
- override val context: RuntimeData
+ contextParam: RuntimeData
Review Comment:
IT emits a warning saying it is deprecated now but will be illegal in the future. Since we have this is other non-asbstract class cases in our code. It might just be overriding val params in abstract classes that are the issue
[error] |overriding val parameter value context in class ExpressionEvaluationParser is deprecated, will be illegal in a future version
--
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.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix overriding non-lazy val with lazy val [daffodil]
Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on code in PR #1468:
URL: https://github.com/apache/daffodil/pull/1468#discussion_r2025405704
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/processors/parsers/ExpressionEvaluatingParsers.scala:
##########
@@ -37,9 +37,11 @@ import org.apache.daffodil.runtime1.processors.VariableRuntimeData
*/
abstract class ExpressionEvaluationParser(
expr: CompiledExpression[AnyRef],
- override val context: RuntimeData
+ contextParam: RuntimeData
Review Comment:
Does scala 3 no longer allow `override val` parameters?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix overriding non-lazy val with lazy val [daffodil]
Posted by "mbeckerle (via GitHub)" <gi...@apache.org>.
mbeckerle commented on code in PR #1468:
URL: https://github.com/apache/daffodil/pull/1468#discussion_r2025732450
##########
daffodil-runtime1/src/main/scala/org/apache/daffodil/runtime1/dsom/CompiledExpression1.scala:
##########
@@ -367,7 +367,7 @@ class DPathElementCompileInfo(
/**
* Cyclic objects require initialization
*/
- override lazy val initialize: Unit = {
+ override def initialize(): Unit = {
Review Comment:
What is wrong with this as is? Changing this to def changes behavior from initializing only once.
I think you have to do this to preserve exactly the behavior:
```
private lazy val init_ : Unit = {
parents
elementChildrenCompileInfo
}
override def initialize(): Unit = init_
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org