简体   繁体   中英

Change Scala default class access modifier

Say I have bunch of Scala classes and I want to compile and package it to JAR.

I want to expose only some limited number of classes to external user of the JAR and "hide" any other classes.

The question: How can I achieve that without explicitly specifying private access modifier for classes to hide?

The problem is that in Scala class is public by default.

The ideal solution would be some Scala compiler option that changes default class modifier to private .

I think you answered your own question. Scala provides private for exactly this usecase.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM