Lars Triers
Lars Triers

Reputation: 167

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.

Upvotes: 0

Views: 166

Answers (1)

andyczerwonka
andyczerwonka

Reputation: 4260

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

Upvotes: 1

Related Questions