javaparser / javasymbolsolver

*old repository* --> this is now integrated in https://github.com/javaparser/javaparser
Apache License 2.0
290 stars 76 forks source link

JSS throws StackOverFlow exception when trying to resolve NameExpr #376

Closed eartvit closed 6 years ago

eartvit commented 6 years ago

Hi, I am trying to find out if a NameExpr resolves to a primitive type or not. In general it finds out type with the exception of unchecked types.

For example, trying to find out the the resolved type for the IfStmt: if (ind != numSamples) { samples.set(ind, key); } on line 194 of InputSampler.java from Hadoop branch 3.0.0 always crashes (it enters an infinite loop on JavaParserFactory line 114: return getContext(parentNode, typeSolver);

The complete input file (inside Hadoop branch 3.0.0) is hadoop-branch-3.0.0/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/InputSampler.java

Is there a way around this problem?

I am trying to resolve the type using the below approach: SymbolReference<? extends ResolvedValueDeclaration> rRef = JavaParserFacade .get(new ReflectionTypeSolver()).solve(n.getName()); where n is the left or right expression of an IfStmt...

As I said, it works in all my other cases, except the above...

Thanks in advance for any advice or perhaps a bug fix?

matozoid commented 6 years ago

Hi! Please move this to https://github.com/javaparser/javaparser/issues because this project is now part of the main project :-)

eartvit commented 6 years ago

Okay, well, don't know how to "move" it so I closed it here and opened it on the other tracker...