Skip to content
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

The getSuperClass() API for java interfaces. #125

Open
BowenZhang-UST opened this issue Oct 31, 2024 · 2 comments
Open

The getSuperClass() API for java interfaces. #125

BowenZhang-UST opened this issue Oct 31, 2024 · 2 comments
Assignees

Comments

@BowenZhang-UST
Copy link

📝 Overall Description

Currently a java interface in Tai-e is represented as a JClass whose API isInterface() returns true.

However, for those "root" interfaces without a super interface (e.g. java.io.Serializable), its getSuperClass() returns java.lang.Object. May I ask if this is an intentional design (i.e. we use isInterface() && getSuperClass().getName() == "java.lang.Object" to check that a JClass is a "root" interface)?

Thanks,

🎯 Expected Behavior

For this kind of interface, getSuperClass() returns null.

🐛 Current Behavior

getSuperClass() actually returns JClass java.lang.Object .

🔄 Reproducible Example

No response

⚙️ Tai-e Arguments

🔍 Click here to see Tai-e Options
{{The content of 'output/options.yml' file}}
🔍 Click here to see Tai-e Analysis Plan
{{The content of 'output/tai-e-plan.yml' file}}

📜 Tai-e Log

🔍 Click here to see Tai-e Log
{{The content of 'output/tai-e.log' file}}

ℹ️ Additional Information

No response

@jjppp
Copy link
Member

jjppp commented Nov 4, 2024

Hi @BowenZhang-UST!
The behavior of Tai-e on getSuperClass() is designed by purpose, to support analyses for not only source code, but also JVM compatible bytecode programs.

According to JVMS:

  • For an interface, the value of the super_class ... must be a CONSTANT_Class_info structure representing the class Object. see here for more info.

According to JLS, although a root interface does not extends Object:

  • Object is a supertype of any root interface, see here
  • All public methods declared in Object are also declared in every root interface, see here

@BowenZhang-UST
Copy link
Author

@jjppp Thank you for the comprehensive explanation! This design is very meaningful for future compatibility with other JVM languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants