Skip to content

Keep classpath used to run the compiler separate from compilation classpath. #44

Closed
@adriaanm

Description

@adriaanm
Contributor

A program should not be able to see the classes of the compiler that's compiling it unless the compiler's classes are explicitly added to the compilation (user) classpath. Currently, they all leak through by default (you have one chance to opt-out by not setting usejavacp): https://github.com/lampepfl/dotty/blob/master/src/dotty/tools/dotc/config/PathResolver.scala#L227

This is not a problem in sbt (it manages the classpath itself), and you might consider it a feature in the REPL, but it's pretty complicated for build tools to navigate the maze of settings. Would be good to clean this up early on.

Activity

gkossakowski

gkossakowski commented on Mar 5, 2014

@gkossakowski
Contributor
smarter

smarter commented on Nov 18, 2015

@smarter
Member

@adriaanm : is this fixed/planned to be fixed in Scala 2.12 ?

adriaanm

adriaanm commented on Nov 18, 2015

@adriaanm
ContributorAuthor

No, but we were just talking about tackling this in 2.13 earlier this week!

SethTisue

SethTisue commented on Nov 18, 2015

@SethTisue
Member

the context being, this is important if we want to support alternate and/or slimmer “standard” libraries as in Martin's proposal at scala/slip#31

smarter

smarter commented on Jan 26, 2019

@smarter
Member

Starting with Java 9, we cannot inspect the Java bootclasspath anymore, so I think the problem basically solved itself :). (usejavacp still exists, but I think that's OK since it's not enabled by default)

added a commit that references this issue on Nov 21, 2019

Merge pull request scala#44 from noti0na1/dotty-explicit-nulls-only

35dda77
added a commit that references this issue on Mar 19, 2025

Merge pull request scala#44 from scala/backport-lts-3.3-21814

b7c454b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gkossakowski@smarter@adriaanm@SethTisue@odersky

        Issue actions

          Keep classpath used to run the compiler separate from compilation classpath. · Issue #44 · scala/scala3