You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this is my first time using JSS 3.18.
This may a question rather than an issue.
I faced a problem when resolving the arguments in a method call expression.
It seems that the CollectionUtils.get(expected, 0) at line 6 is a cause.
The related JARS are added through lines 22-25 including a classpath (i.e., CollectionUtils' parent dir) that is declared the method
Sorry for not being able to explainable the problem as descriptive
Here are my codes and a stack trace:
Method call
1 public void getFromMap() {
2 final Map<String, String> expected = new HashMap<>();
3 expected.put("zeroKey", "zero");
4 expected.put("oneKey", "one");
5 final Map<String, String> found = new HashMap<>();
6 Map.Entry<String, String> entry = CollectionUtils.get(expected, 0);
7 }
Method declaration (CollectionUtils.java)
69 public static <K,V> Map.Entry<K, V> get(final Map<K,V> map, final int index) { ... }
JSS part
20 TypeSolver typeSolver = new CombinedTypeSolver(
21 new ReflectionTypeSolver(),
22 JarTypeSolver.getJarTypeSolver("NECESSARY-JARS"),
... ... );
26 JavaSymbolSolver symbolSolver = new JavaSymbolSolver(typeSolver);
27 StaticJavaParser.getConfiguration().setSymbolResolver(symbolSolver);
28 CompilationUnit cu = StaticJavaParser.parse(new File(FILE_PATH));
Stack trace
com.github.javaparser.resolution.MethodAmbiguityException: Ambiguous method call: cannot find a most applicable method:
JavassistMethodDeclaration{ctMethod=javassist.CtMethod@fc1cfe2e[public static get (Ljava/lang/Object;I)Ljava/lang/Object;]},
JavassistMethodDeclaration{ctMethod=javassist.CtMethod@46eaf0f9[public static get (Ljava/util/Map;I)Ljava/util/Map$Entry;]}
at com.github.javaparser.symbolsolver.resolution.MethodResolutionLogic.findMostApplicable (MethodResolutionLogic.java:587)
at com.github.javaparser.symbolsolver.resolution.MethodResolutionLogic.findMostApplicable (MethodResolutionLogic.java:501)
at com.github.javaparser.symbolsolver.javassistmodel.JavassistClassDeclaration.solveMethod (JavassistClassDeclaration.java:259)
at com.github.javaparser.symbolsolver.resolution.MethodResolutionLogic.solveMethodInType (MethodResolutionLogic.java:787)
at com.github.javaparser.symbolsolver.javaparsermodel.contexts.MethodCallExprContext.solveMethod (MethodCallExprContext.java:177)
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.solve (JavaParserFacade.java:321)
at com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade.solve (JavaParserFacade.java:183)
at com.github.javaparser.symbolsolver.JavaSymbolSolver.resolveDeclaration (JavaSymbolSolver.java:161)
at com.github.javaparser.ast.expr.MethodCallExpr.resolve (MethodCallExpr.java:313)
at org.myMain.lambda$GetMethodCallExprList$3 (myMain.java:183)
Do I have to add the java.util.* to within lines 22-25?
Could you give me any advice or materials to solve the problem?
I read a tutorial (JavaParser-visited)
The text was updated successfully, but these errors were encountered:
Do I have to add the java.util.* to within lines 22-25?
No you don't have to declare this package because ReflectionTypeSolver can scan it for you.
Unfortunately this exception is probably caused by a bug! We will have to isolate the problem first with a simpler test case before we can help you solve this problem. It would have been faster if you had sent us a simplified test case :-)
Hi, this is my first time using JSS 3.18.
This may a question rather than an issue.
I faced a problem when resolving the arguments in a method call expression.
It seems that the
CollectionUtils.get(expected, 0)
at line 6 is a cause.The related JARS are added through lines 22-25 including a classpath (i.e., CollectionUtils' parent dir) that is declared the method
Sorry for not being able to explainable the problem as descriptive
Here are my codes and a stack trace:
Method call
Method declaration (
CollectionUtils.java
)JSS part
Stack trace
Do I have to add the
java.util.*
to within lines 22-25?Could you give me any advice or materials to solve the problem?
I read a tutorial (JavaParser-visited)
The text was updated successfully, but these errors were encountered: