8000 bug: gen.java | findEntityNodeByName 导致 data_type 类型边连接出错 · Issue #135 · Symbolk/Code2Graph · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bug: gen.java | findEntityNodeByName 导致 data_type 类型边连接出错 #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Guitenbay opened this issue Jul 1, 2022 · 0 comments

Comments

@Guitenbay
Copy link

对于一下的情况,data_type 类型边连接出错:

public static void scan1() {
    char x1 = 'a';
    char x2 = 'b';
    int x_val = digits[x1] * 16 + digits[x2];
    char x_char = (char) x_val;
}

问题发生原因:
x_char 会被认为是 char 的类,因为 findEntityNodeByName 是按最后字符串一致来判断是否找到 Entity

edu/pku/code2graph/gen/jdt/AbstractJdtVisitor.java 代码:

protected Optional<Node> findEntityNodeByName(String name) {
    if (defPool.containsKey(name)) {
      return Optional.of(defPool.get(name));
    } else {
      // greedily match as simple name
      return defPool.entrySet().stream()
          .filter(e -> e.getKey().endsWith(name)) // 这里有问题
          .map(Map.Entry::getValue)
          .findFirst();
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0