I'm trying to extend the class A which is written in Java to class B in Scala.
class A { 
    private Pattern pattern;
    private String regex= "folder1/folder2/folder3/.*";
    A(...){
       this.regex = regex;
       this.pattern = Pattern.compile(getRegex());
    }
    
    
    public String getRegex() {
        return regex;
    }
}
class B(...) extends A(...) {
    val regex: String= "folder4/.*";
    
    override def getRegex(): String = {
        return regex;
    }
}
However it seems that the Pattern.compile(getRegex()) is getting null value from the B class. I'm also not allowed to pass the override regex through the constructor. Not sure how I can resolve this issue.
 
     
    