I have a module written in Scala that I need to integrate into a Java web application. Everything works great, except the fact that methods and fields that are
private[somepackage]
in the Scala classes appear to be accessible from the Java code from outside that package. Is there any way to hide those?
EDIT: example illustrating what is happening
package my.scala.module
class SomeClass {
private[scala] val myValue = "this should be hidden"
}
package com.something.service;
import my.scala.module.SomeClass;
public class MyService {
private static SomeClass someInstance = new SomeClass();
public static void main(String[] args){
System.out.println(someInstance.myValue());
}
}
Running main will cause "this should be hidden" to print