Giter Site home page Giter Site logo

classpath path separator about spoon HOT 8 CLOSED

inria avatar inria commented on May 16, 2024
classpath path separator

from spoon.

Comments (8)

monperrus avatar monperrus commented on May 16, 2024

Hi Stefan,
The API is on purpose. The SpoonCompiler API is different from the Java Classpath API, which is irregular.
To me, the only problem with ":" as convention is that one cannot use path with drive names on Windows.
I tend to accept to pay this price instead of reproducing the Java Classpath API problem.
Another solution would be to use a completely different convention, for instance a comma.
What do you think?

from spoon.

pschichtel avatar pschichtel commented on May 16, 2024

Using the native path separator is pretty much the only thing you can use without the need for escaping. There is no character that is safe to use on any OS/filesystem, that's exactly why the File.pathSeparator constant exists.

instead of reproducing the Java Classpath API problem

What problem exactly do you mean?

from spoon.

monperrus avatar monperrus commented on May 16, 2024

Furthermore I found in the code that you still use the File.pathSeparator to build up a default classpath

This is different, it's not the Spoon API of --source-classpath/setSourceClasspath that is handled there, it's a default strategy for backward compatibility.

instead of reproducing the Java Classpath API problem

What problem exactly do you mean?

A platform-dependent API

from spoon.

swolf91 avatar swolf91 commented on May 16, 2024

But you use the source classpath which was set by the setSourceClasspath method or the classpath with the File.pathSeparator if the other doesn't exist... So both classpaths have different element separators. That should be a problem.


What do you mean exactly by platform-dependent API? Do you just want to have a program which can be used with Unix?

from spoon.

pschichtel avatar pschichtel commented on May 16, 2024

Well you're working with paths which are different on different platforms. I don't see how using File.pathSeparator makes you more platform dependent. Any other solution is either a mess to use or will just not work on at least one platform

from spoon.

monperrus avatar monperrus commented on May 16, 2024

What do you mean exactly by platform-dependent API?

I mean an API whose usage depends on the platform.

For the interface SpoonCompiler, the solution is to avoid string parsing by slightly changing the contract and the signature.
signature: void setSourceClasspath(String... classpathElement); (note the ...)
contract: classpathElement must be a valid jar file or a folder containing bytecode files

For the command line API --source-classpath either we use File.pathSeparator or we allow multiple occurrences of the flag. I like the second solution.

--Martin

from spoon.

seintur avatar seintur commented on May 16, 2024

On 14 Aug 2014, at 13:26, Phillip Schichtel [email protected] wrote:

Well you're working with paths which are different on different platforms. I don't see how using File.pathSeparator makes you more platform dependent. Any other solution is either a mess to use or will just not work on at least one platform

Exactly. I agree with Philip and Stefan. The use of File.pathSeparator does not make you platform-dependent. On the contrary, it makes you platform-independent. It is just that the independence is parameterized by File.pathSeparator.

Lionel.

Prof. Lionel Seinturier
University Lille 1
http://www.lifl.fr/~seinturi

from spoon.

swolf91 avatar swolf91 commented on May 16, 2024

@monperrus You can nevertheless change the signature of setSourceClasspath and change it for the command line api too. I agree with you at this points, because one can use one command line on different platforms. But please, you've to use the File.pathSeparator constant. How @pschichtel said, every other way doesn't work on at least one platform.

If you want I can provide a pull request which removes the CLASSPATH_ELEMENT_SEPARATOR and uses the File.pathSeparator instead.

from spoon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.