Fraunhofer-AISEC / cpg

A library to extract Code Property Graphs from C/C++, Java, Go, Python, Ruby and every other language through LLVM-IR.
https://fraunhofer-aisec.github.io/cpg/
Apache License 2.0
292 stars 62 forks source link

Java parsing for help #647

Open YujiaoWu-111 opened 2 years ago

YujiaoWu-111 commented 2 years ago

When I am parsing the following file:

public static boolean isTypeIncludedIn(TypeName value, Type... types) {
        for (Type item : types) {
            if (value.equals(typeName(item))) {
                return true;
            }
        }
        return false;
    }

it prompts: Found "boolean", expected one of ";" "@" "class" "enum" "interface" "module" "open" "record" (line 1,col 8).

Can I parse only a java method, not a class?It seems that the method parseBodyDeclaration defined in Javaparser can be used. But I don't know how to modify JavaLanguageFrontend.java file. Please give me some advice.Thanks a lot!

YujiaoWu-111 commented 2 years ago

Anybody can help me please?

oxisto commented 2 years ago

Sorry, at the moment only parsing of a complete Java file is supported.