Javaparser: Save filepath/filename in CompilationUnit

Created on 7 Mar 2017  路  4Comments  路  Source: javaparser/javaparser

It would be nice if JavaParser.parse(Filename) could return the filepath/filename in the returned Object.

Improvement

Most helpful comment

Yes, it's probably a good thing and this will be built. In the end it is a design decision, but since our approach is "the Abstract Syntax Christmas Tree" full of decorations, this can go in too.

All 4 comments

On one hand: this would mean refactoring SourceRoot, on the other hand: this would enable more validations (class matches filename, package declaration wrong, etc.)

At the moment we have an "information leak". When i for example iterate over a big java project and produce CompilationUnits for every file and sort these units into a bigger modell, I would like to have the filepath/filename for every CompilationUnit. I am sure that also other projects would profit from this changes.

Yes, it's probably a good thing and this will be built. In the end it is a design decision, but since our approach is "the Abstract Syntax Christmas Tree" full of decorations, this can go in too.

@matozoid cool awesome!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronak111091 picture ronak111091  路  3Comments

NicoN777 picture NicoN777  路  5Comments

qingdujun picture qingdujun  路  4Comments

huangwaylon picture huangwaylon  路  4Comments

MysterAitch picture MysterAitch  路  4Comments