Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Jonathan Locke
@jonathanlocke
I might have another open source project soon. We'll see if my company goes for it
Danny van Bruggen
@matozoid
Okay, let us know, always good to see what people are doing with it!
Jonathan Locke
@jonathanlocke
WIll do
With your project I created an automatic UML generator that's annotation driven
I might open source that too if they'll let me :)
without the type solvers, it would be impossible. that was a good idea.
ascopes
@ascopes
is javaparser compatible with the javax.annotation.processing API?
4 replies
aiddroid
@aiddroid
Is there anyway to create a methods call CFG via javaparser?
2 replies
Alexander Kardapolov
@akardapolov
Hi everyone! How to build source code in IDEA IDE? Couldn't find any info on the site (step by step). I can build the whole project using mvn clean install but have problems (for example with ParseException.class in JavaParserTest (javaparser-core-testing module) - error message "Cannot resolve symbol 'ParseException'".
6 replies
jessechen09
@jessechen09
image.png
I am an undergrad student using javaparser for a research project. I was just wondering if I did something wrong because many classes seem to be missing. E.g., I cannot find GeneratedJavaParser anywhere. Is this supposed to be a class somewhere?
13 replies
Thanks
Roger Howell
@MysterAitch
image.png
mdproctor
@mdproctor
I saw this, to update antlr grammar, as it's till stuck at java 9. I thought it might interest the group - but cannot sell if actual progress was made though :( https://summerofcode.withgoogle.com/archive/2020/projects/4999687213416448/
looks like the student didn't do it ;( https://github.com/search?q=user%3ANickCuso+antlr
mdproctor
@mdproctor
hmm he's added it to his linkedin https://www.linkedin.com/in/nick-mancuso-961352170/ maybe it's not public. will ping him.
Danny van Bruggen
@matozoid
It really shouldn't be hard to upgrade it to the latest. It's getting people to keep it up to date that is the problem :-)
Danny van Bruggen
@matozoid
Hey @jessechen09 - since you have checked out the source code of JavaParser, are you going to modify it? Maybe it is interesting for the JavaParser project?
jessechen09
@jessechen09

Hey @jessechen09 - since you have checked out the source code of JavaParser, are you going to modify it? Maybe it is interesting for the JavaParser project?

I'm using javaparser to create ASTs, as we need ASTs for our research project. That said I don't think I'll modify it, unless there is a feature that's missing and is an easy fix.

jessechen09
@jessechen09
In the Node class's toString() method, it prints out the node AND its children, so if I toString() a CompilationUnit, it should print out the whole AST, right? However, I am only getting the original class's code. Did I misunderstand something or did I do something wrong? Thanks
3 replies
image.png
TY
@CTY-git

I cant seem to find this in any documentation but how do you add java.lang.* and javax.* Type Declarations to the compilation unit?
or is there a way to check if a type, found by parsing source code, extends a java.lang.* and javax.* class?

I did set the ReflectionTypeSolver for my parser but java.lang.* and javax.* classes are unresolvable. This prevents me from using isAssignable to determine inheritance.

Thiago Henrique Hüpner
@Thihup
Hi all! I'd like to know if it is possible to parse some Expression Language using the JavaParser. While most of the SimpleJavaParse.parseExpression() would work just fine, they have added some changes to the change, like enabling using "eq" instead of "==", and they have added a new syntax for Lists and Sets ([1,2,3,4], {1,2,3}) and for Map ({"key":"value"}).
In this case it is still possible to use the JavaParser?
Roger Howell
@MysterAitch
@Thihup -- it wouldn't work as-is, instead you'd need to work with a forked version of the grammar/program
Thiago Henrique Hüpner
@Thihup
@MysterAitch Thanks
Roger Howell
@MysterAitch
if you do go for it, let us know - it sounds interesting! :)
antlr sounds like it could potentially be a good option too, though I think the latest java grammar isn't very recent
Thiago Henrique Hüpner
@Thihup
Yeah, is it a little outdated, but I only need to parse expressions, not a full class ;)
I have a prototype using ANTLR, but I'd like to reuse other code instead of implementing the Lexer, parser and stuff
Peeradon Sukkasem
@littleheart005
Hi. there! I have been using JavaParser and SymbolSolver for a while. Now I facing a problem (UnsolvedSymbolException) when I try to solve a method call in java class. These are part of my code.
Screen Shot 2564-04-07 at 16.06.46.png
Roger Howell
@MysterAitch
@littleheart005 -- double check your source value -- this is usually the source root (i.e. the place where the default package files would be)
e.g. if Duck is in the package headfirst.strategy, the source root will be the folder above headfirst(i.e. the src directory)
1 reply
aiddroid
@aiddroid
Here's a demo for callgraph: https://github.com/aiddroid/java-callgraph
aiddroid
@aiddroid
alt
Danny van Bruggen
@matozoid
Hey, nice work @aiddroid !
Shall I put it on Twitter?
aiddroid
@aiddroid

Shall I put it on Twitter?

ok

Danny van Bruggen
@matozoid
Several people asked if JP has data flow graph/diagram/analysis support, and I wondered how much effort it would be to build it. It's now in a state that the design is right - lots of stuff still missing though - so I thought I would make it public: https://github.com/matozoid/data_flow_analyser_with_javaparser
Feel free to help/comment/ignore :-)
DaGeRe
@DaGeRe
Hi, I'm currently trying to instrument code for monitoring using Javaparser. Therefore, I need to know whether a statement is considered as unreachable by the compiler or not (to eventually add a return statement). From what I've seen now, https://github.com/javaparser/javaparser/blob/master/javaparser-symbol-solver-core/src/main/java/com/github/javaparser/symbolsolver/resolution/typeinference/ControlFlowLogic.java should do this job, but is not implemented yet. Are there other options for doing this with javaparser (besides implementing ControlFlowLogic myself)?
Danny van Bruggen
@matozoid
Ah, @DaGeRe - you just made me realize that I'm building a control flow analyser, not a data flow analyser. Thanks!
jean pierre Lerbscher
@jlerbsc
@DaGeRe What you need is a control flow graph but it does not exist in JP. But JP (AST) can help you to build a cfg.
Danny van Bruggen
@matozoid
Thanks to @jlerbsc for teaching me a new word :-) https://en.wikipedia.org/wiki/Schmilblick
4 replies
Jonathan Locke
@jonathanl-telenav
Hi All
I saw a discussion on the web somewhere about adding Kotlin support to JavaParser. Has there been any work done on this?
Danny van Bruggen
@matozoid
No, I think that would have to be a separate product. Tons of work!
Jonathan Locke
@jonathanl-telenav
Thanks Danny