gpt4 book ai didi

java - Eclipse AST Java 模型 : Where in ICompilationUnit stored whether it is class, 接口(interface)或枚举?

转载 作者:行者123 更新时间:2023-12-01 12:21:05 24 4
gpt4 key购买 nike

enter image description here

如何确定编译单元是接口(interface)、类还是枚举?根据上图,它似乎不包含存储 AST 信息的字段。我在 DOCUMENTATION 中找不到任何内容

最佳答案

ICompilationUnit.findPrimaryType() 为您提供编译单元中主类的 IType(一个编译单元中可以有多个类)。

IType.isClass()IType.isEnum()IType.isInterface() 方法告诉您有关类型的信息。

关于java - Eclipse AST Java 模型 : Where in ICompilationUnit stored whether it is class, 接口(interface)或枚举?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26653891/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com