{"action":"created","issue":{"url":"https://api.github.com/repos/javaparser/javaparser/issues/1491","repository_url":"https://api.github.com/repos/javaparser/javaparser","labels_url":"https://api.github.com/repos/javaparser/javaparser/issues/1491/labels{/name}","comments_url":"https://api.github.com/repos/javaparser/javaparser/issues/1491/comments","events_url":"https://api.github.com/repos/javaparser/javaparser/issues/1491/events","html_url":"https://github.com/javaparser/javaparser/issues/1491","id":310863417,"node_id":"MDU6SXNzdWUzMTA4NjM0MTc=","number":1491,"title":"Static MethodCallExpr Resolving Problem","user":{"login":"seoj135","id":6122672,"node_id":"MDQ6VXNlcjYxMjI2NzI=","avatar_url":"https://avatars3.githubusercontent.com/u/6122672?v=4","gravatar_id":"","url":"https://api.github.com/users/seoj135","html_url":"https://github.com/seoj135","followers_url":"https://api.github.com/users/seoj135/followers","following_url":"https://api.github.com/users/seoj135/following{/other_user}","gists_url":"https://api.github.com/users/seoj135/gists{/gist_id}","starred_url":"https://api.github.com/users/seoj135/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seoj135/subscriptions","organizations_url":"https://api.github.com/users/seoj135/orgs","repos_url":"https://api.github.com/users/seoj135/repos","events_url":"https://api.github.com/users/seoj135/events{/privacy}","received_events_url":"https://api.github.com/users/seoj135/received_events","type":"User","site_admin":false},"labels":[{"id":803662472,"node_id":"MDU6TGFiZWw4MDM2NjI0NzI=","url":"https://api.github.com/repos/javaparser/javaparser/labels/Symbol%20Solver","name":"Symbol Solver","color":"cee57b","default":false}],"state":"open","locked":false,"assignee":{"login":"ftomassetti","id":439078,"node_id":"MDQ6VXNlcjQzOTA3OA==","avatar_url":"https://avatars2.githubusercontent.com/u/439078?v=4","gravatar_id":"","url":"https://api.github.com/users/ftomassetti","html_url":"https://github.com/ftomassetti","followers_url":"https://api.github.com/users/ftomassetti/followers","following_url":"https://api.github.com/users/ftomassetti/following{/other_user}","gists_url":"https://api.github.com/users/ftomassetti/gists{/gist_id}","starred_url":"https://api.github.com/users/ftomassetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ftomassetti/subscriptions","organizations_url":"https://api.github.com/users/ftomassetti/orgs","repos_url":"https://api.github.com/users/ftomassetti/repos","events_url":"https://api.github.com/users/ftomassetti/events{/privacy}","received_events_url":"https://api.github.com/users/ftomassetti/received_events","type":"User","site_admin":false},"assignees":[{"login":"ftomassetti","id":439078,"node_id":"MDQ6VXNlcjQzOTA3OA==","avatar_url":"https://avatars2.githubusercontent.com/u/439078?v=4","gravatar_id":"","url":"https://api.github.com/users/ftomassetti","html_url":"https://github.com/ftomassetti","followers_url":"https://api.github.com/users/ftomassetti/followers","following_url":"https://api.github.com/users/ftomassetti/following{/other_user}","gists_url":"https://api.github.com/users/ftomassetti/gists{/gist_id}","starred_url":"https://api.github.com/users/ftomassetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ftomassetti/subscriptions","organizations_url":"https://api.github.com/users/ftomassetti/orgs","repos_url":"https://api.github.com/users/ftomassetti/repos","events_url":"https://api.github.com/users/ftomassetti/events{/privacy}","received_events_url":"https://api.github.com/users/ftomassetti/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-04-03T14:35:07Z","updated_at":"2018-07-08T10:44:16Z","closed_at":null,"author_association":"NONE","body":"Hello. When I tried to resolve methodcallexpr, I found some bug. \r\nThis is on 3.5.20.\r\n\r\n1. Call Static Function on Iterable, ForeachStmt problem.\r\nMethodCallExprContext line 157: context return null. So It Throw RuntimeException\r\nI guess some errors on solveType() function on StatementContext(Wrapped BlockStmt).\r\nHere is target project from git: https://github.com/davidar/lljvm\r\nand positions is src/lljvm/runtime/Function.java line 22.\r\n\r\n```\r\nTypeSolver Settings: \r\n   ReflectionTypeSolver\r\n   JavaParserTypeSolver(Root of project)\r\n   JavaParserTypeSolver(Root of Java base libraries, I zipped out it to my custom directory)\r\n```\r\n\r\n2. visit NameExpr problem.\r\nSo To find the solution to the first bug, I make some short code and found another bug.\r\nHow to fix UnsolvedSymbolException?\r\nWhy does not some nodes resolve? \r\n !ref.isSolved() \r\n\r\nHere is my whole test code:\r\n```java\r\nimport java.io.File;\r\nimport java.io.FileWriter;\r\nimport java.io.IOException;\r\n\r\nimport com.github.javaparser.JavaParser;\r\nimport com.github.javaparser.ParserConfiguration;\r\nimport com.github.javaparser.ast.CompilationUnit;\r\nimport com.github.javaparser.ast.expr.MethodCallExpr;\r\nimport com.github.javaparser.ast.expr.NameExpr;\r\nimport com.github.javaparser.ast.visitor.VoidVisitorAdapter;\r\nimport com.github.javaparser.resolution.declarations.ResolvedMethodDeclaration;\r\nimport com.github.javaparser.resolution.types.ResolvedType;\r\nimport com.github.javaparser.symbolsolver.JavaSymbolSolver;\r\nimport com.github.javaparser.symbolsolver.javaparsermodel.JavaParserFacade;\r\nimport com.github.javaparser.symbolsolver.resolution.typesolvers.CombinedTypeSolver;\r\nimport com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver;\r\nimport com.github.javaparser.symbolsolver.resolution.typesolvers.ReflectionTypeSolver;\r\n\r\npublic class test {\r\n\t@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\r\n\tpublic static void main(String[] args) {\r\n\t\tString code = \r\n\t\t\t\"public class A { \" + \r\n\t\t\t\t\"public int FUNC() { Class<?> cls = null; if(cls == null) return 0; else { B.FUNC3(cls); return 1;} } \" +\r\n\t\t\t\t\"public void FUNC2(Class<?> arg) { return; }\" +\r\n\t\t\t\"}\" + \r\n\t\t\t\"class B {\" + \r\n\t\t\t\t\"public static void FUNC3(Class<?> arg) { return; }\" +\r\n\t\t\t\"}\" +\r\n\t\t\t\"\";\r\n\t\tFile file = new File(\"A.java\");\r\n\t\ttry {\r\n\t\t\tfile.createNewFile();\r\n\t\t\tFileWriter fw = new FileWriter(file);\r\n\t\t\tfw.write(code);\r\n\t\t\tfw.flush();\r\n\t\t\tfw.close();\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\tCombinedTypeSolver localCts = new CombinedTypeSolver();\r\n\t\tlocalCts.add(new ReflectionTypeSolver());\r\n\t\tlocalCts.add(new JavaParserTypeSolver(file.getAbsoluteFile().getParentFile()));\r\n\t\t\r\n\t\tParserConfiguration parserConfiguration = new ParserConfiguration().setSymbolResolver(new JavaSymbolSolver(localCts));\r\n\t\tJavaParser.setStaticConfiguration(parserConfiguration);\r\n\t\t\r\n\t\tCompilationUnit cu = JavaParser.parse(code);\r\n\t\tcu.accept(new VoidVisitorAdapter() {\r\n\t\t\tpublic void visit(NameExpr n, Object arg) {\t\t\t\t\r\n\t\t\t\tResolvedType type = JavaParserFacade.get(localCts) .getType(n);\r\n\t\t\t\tsuper.visit(n, args);\r\n\t\t\t}\r\n\t\t\tpublic void visit(MethodCallExpr n, Object arg) {\r\n\t\t\t\tResolvedMethodDeclaration decl = JavaParserFacade.get(localCts).solve(n).getCorrespondingDeclaration();\r\n\t\t\t\tsuper.visit(n, args);       // <---------- bug is occur.\r\n                                // Exception in thread \"main\" UnsolvedSymbolException{context='Solving B', name='B', typeSolver=null}\r\n\t\t\t}\r\n\t\t}, null);\r\n\t}\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/javaparser/javaparser/issues/comments/403278844","html_url":"https://github.com/javaparser/javaparser/issues/1491#issuecomment-403278844","issue_url":"https://api.github.com/repos/javaparser/javaparser/issues/1491","id":403278844,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzI3ODg0NA==","user":{"login":"matozoid","id":55701,"node_id":"MDQ6VXNlcjU1NzAx","avatar_url":"https://avatars3.githubusercontent.com/u/55701?v=4","gravatar_id":"","url":"https://api.github.com/users/matozoid","html_url":"https://github.com/matozoid","followers_url":"https://api.github.com/users/matozoid/followers","following_url":"https://api.github.com/users/matozoid/following{/other_user}","gists_url":"https://api.github.com/users/matozoid/gists{/gist_id}","starred_url":"https://api.github.com/users/matozoid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matozoid/subscriptions","organizations_url":"https://api.github.com/users/matozoid/orgs","repos_url":"https://api.github.com/users/matozoid/repos","events_url":"https://api.github.com/users/matozoid/events{/privacy}","received_events_url":"https://api.github.com/users/matozoid/received_events","type":"User","site_admin":false},"created_at":"2018-07-08T10:44:16Z","updated_at":"2018-07-08T10:44:16Z","author_association":"MEMBER","body":"Isn't it more or less solved now?"}}
{"actor":{"display_login":"matozoid"}}