Skip to content

Remove legacy recursive classpath implementation#5112

Merged
retronym merged 3 commits intoscala:2.12.xfrom
lrytz:dropRecursiveClasspath
May 5, 2016
Merged

Remove legacy recursive classpath implementation#5112
retronym merged 3 commits intoscala:2.12.xfrom
lrytz:dropRecursiveClasspath

Conversation

@lrytz
Copy link
Member

@lrytz lrytz commented Apr 21, 2016

No description provided.

@scala-jenkins scala-jenkins added this to the 2.12.0-M5 milestone Apr 21, 2016
@lrytz lrytz added the on-hold label Apr 21, 2016
@lrytz lrytz force-pushed the dropRecursiveClasspath branch 5 times, most recently from 030b1cd to 12c7fbd Compare April 22, 2016 13:01
@lrytz
Copy link
Member Author

lrytz commented Apr 22, 2016

The question here is: should we also get rid of ClassFileLookup, which "abstract over how class file lookup is performed in different classpath representations". There's a single implementation now (FlatClassPath).

https://github.com/scala/scala/blob/12c7fbdf39ccd638d056cd43bd4dbf1772409995/src/compiler/scala/tools/nsc/util/ClassFileLookup.scala

@soc
Copy link
Contributor

soc commented Apr 22, 2016

I guess we will need a new implementation for Java >= 9 ... but whether the abstraction as given makes sense ... no idea. I'd probably remove it, and add a comment so that the person implementing Java 9 support is aware of it.

@lrytz lrytz force-pushed the dropRecursiveClasspath branch from 12c7fbd to dd3fa5b Compare April 22, 2016 15:53
@lrytz lrytz force-pushed the dropRecursiveClasspath branch from dd3fa5b to 0f9a704 Compare April 23, 2016 10:46
@retronym
Copy link
Member

@lrytz I've hacked together happy path support Java 9 / Jigsaw based on this PR:

https://github.com/scala/scala/compare/dd3fa5b...retronym:review/5112?expand=1

There is a backend crash in the REPL under power mode (see the commit comment for a transcript) that I don't understand. Might be worth a quick look to see if you can see what's going on.

I would then vote to remove the unneeded abstraction layers, as it doesn't look like they are needed to support Jigsaw.

@soc
Copy link
Contributor

soc commented Apr 24, 2016

@retronym Looks great!
Just wondering ... as far as I remember, Oracle licensed the filesystem code under an acceptable license. Would it make sense to ship that file so that jimage files can be read, even when running scalac on Java 8?

@retronym
Copy link
Member

@soc Yeah, that would be ideal.

@retronym
Copy link
Member

There is a backend crash in the REPL under power mode (see the commit comment for a transcript) that I don't understand. Might be worth a quick look to see if you can see what's going on.

I've pushed a fix to my branch, it was a dumb mistake in my patch.

@soc
Copy link
Contributor

soc commented Apr 24, 2016

Mhh, I thought they had published such a jar file ... I can't find it anymore. In the worst case the recommendation seems to be that the compiler loads jrt-fs.jar from a JDK9 installation.

That might be annoying with the current tooling (but less annoying with the sbs tool I'm working on).

@retronym
Copy link
Member

@soc
Copy link
Contributor

soc commented Apr 24, 2016

Yes, found that, too. But that has the GPL license because it is just extracted from the OpenJDK repo.

@retronym
Copy link
Member

retronym commented Apr 25, 2016

@lrytz I've updated my branch with my suggested refactorings to eliminate the now-unused abstraction between legacy and flat classpaths.

I renamed FlatClasspath to scala.tools.nsc.util.ClassPath and left the other implementation details in nsc.classpath._.

This will require an patch to partest, which has a type alias to Classpath: https://github.com/scala/scala-partest/blob/master/src/main/scala/scala/tools/partest/package.scala#L19. This is a good example of why @soc's suggestion to in-source partest's code into scala/scala has merit.

@lrytz
Copy link
Member Author

lrytz commented Apr 25, 2016

for partest: type ClassPath[T] = scala.tools.nsc.util.ClassPath[T] is unused, val ClassPath = scala.tools.nsc.util.ClassPath is used only for the join and split methods. so in this case here it should be enough to just remove the type alias to get source compatibility. binary compatibility doesn't even break.

@lrytz
Copy link
Member Author

lrytz commented Apr 25, 2016

thanks for the follow-up work, great stuff!

should I cherry-pick the last commit (5e07d57) and push it here?

@retronym
Copy link
Member

Yep, let's that would be good. Sorry I didn't leave a cleaner history, but it would be ideal to keep the Java 9 stuff as an separate commit (or maybe separate PR)

@lrytz
Copy link
Member Author

lrytz commented Apr 25, 2016

allright thanks! think a separate PR for the Java 9 support would make sense - does it even compile on Java 8? you're not using any Java 9 API?

@retronym
Copy link
Member

retronym commented Apr 25, 2016

On Java 8, you get a NIO exception when looking up the jrt:/ filesystem, which my code handles.

But regardless, a separate PR makes sense.

@lrytz lrytz force-pushed the dropRecursiveClasspath branch 3 times, most recently from ba6e71d to 371627f Compare April 26, 2016 08:01
@lrytz lrytz force-pushed the dropRecursiveClasspath branch from 371627f to e5bf42b Compare April 26, 2016 18:53
@lrytz
Copy link
Member Author

lrytz commented Apr 27, 2016

@retronym should be ready now

override def classFileLookup: util.ClassFileLookup[AbstractFile] = settings.YclasspathImpl.value match {
case ClassPathRepresentationType.Recursive => platform.classPath
case ClassPathRepresentationType.Flat => platform.flatClassPath
}
Copy link
Member

@retronym retronym Apr 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the classFileLookup methods should be reviewed and either removed or renamed to classPath.

Here's the commit that introduced them for a guide: 7448377

@retronym retronym changed the title WIP: remove recursive classpath implementation Remove recursive classpath implementation Apr 27, 2016
@retronym retronym changed the title Remove recursive classpath implementation Remove legacy recursive classpath implementation Apr 27, 2016
@retronym
Copy link
Member

Aside from the s/classFileLookup/classPath comment, this looks ready to me.

@lrytz lrytz force-pushed the dropRecursiveClasspath branch from e5bf42b to 30d6fce Compare May 2, 2016 15:27
@lrytz
Copy link
Member Author

lrytz commented May 2, 2016

ok, renamed classFileLookup.

@retronym
Copy link
Member

retronym commented May 5, 2016

LGTM, sorry about the slow final review. and thanks again for moving this forward!

@retronym retronym merged commit a46af82 into scala:2.12.x May 5, 2016
@lrytz lrytz deleted the dropRecursiveClasspath branch May 17, 2016 13:37
@SethTisue
Copy link
Member

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants