olabusayoT commented on code in PR #1455:
URL: https://github.com/apache/daffodil/pull/1455#discussion_r1992389072


##########
daffodil-core/src/main/scala/org/apache/daffodil/core/dsom/AnnotatedSchemaComponent.scala:
##########
@@ -294,7 +294,7 @@ trait AnnotatedSchemaComponent
   with AnnotatedMixin
   with OverlapCheckMixin {
 
-  protected override def initialize(): Unit = {
+  protected[dsom] override def initialize(): Unit = {

Review Comment:
   That's right, it serves the function of allowing instances of subclasses to 
call it. Scala 3 seems to tighten protected access control so protected methods 
can only be accessed from within the class, instances of the class and from 
subclasses (but not instances of subclasses). 
   
   
   ```scala
   Welcome to Scala 3.6.4 (17.0.12, Java Java HotSpot(TM) 64-Bit Server VM).
   Type in expressions for evaluation. Or try :help.
                                                                                
                                                                                
                                                                    
   scala> class Animal:
        |   private def breathe() = println("I’m breathing")
        |   def walk() =
        |     breathe()
        |     println("I’m walking")
        |   protected def speak() = println("Hello?")
        | 
   // defined class Animal
                                                                                
                                                                                
                                                                    
   scala> class Cat extends Animal
   // defined class Cat
                                                                                
                                                                                
                                                                    
   scala> val c = new Cat
   val c: Cat = Cat@7853363c
                                                                                
                                                                                
                                                                    
   scala> c.speak()
   -- [E173] Reference Error: 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1 |c.speak()
     |^^^^^^^
     |method speak in class Animal cannot be accessed as a member of (c : Cat) 
from object rs$line$4.
     |  protected method speak can only be accessed from class Animal or one of 
its subclasses.
   1 error found
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to