Comments (8)
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.
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.
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.
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.
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.
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.
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.
@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)
- [Bug]: StackOverflowError occurred in CtExecutableReference.getExecutableDeclaration HOT 5
- [Bug]: Not allowed javaletter or keyword in identifier found HOT 5
- Move or delete spoon testing package from src/main HOT 1
- Delete old unused javadoc package HOT 2
- [Bug]: Under multithreading, using the isOverriding method will lead to incorrect results of the getElements method
- [Bug]: How to correctly recognize the signature of invoked methods in lambda expression?
- Java Compatibility with Older Versions of Spoon HOT 1
- [Bug]: CtReferenceImpl.isSpecialType throws an exception
- [Bug]: Bug adding comment in AST of lambda HOT 2
- Update a method calls reference
- java 22 HOT 1
- [Bug]: Control Flow graph missing edge for implicit default case in switch
- [Bug]: Control Flow Graph doesn't handle cases with multiple expressions
- Spotless for imports HOT 2
- [Bug]: Spoon inserts incorrect break in enhanced switch block
- [Feature Request]: Minimize Parens in `DefaultJavaPrettyPrinter` should use operator precedence (`(a == b) || (b == c)` could be `a == b || b == c`) HOT 2
- [Bug]: Javadoc of class missing HOT 1
- improve reproducible build architecture for Spoon HOT 2
- Unable to start JavaFX UI
- How to Implement Angelic Value with Spoon for APR
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spoon.