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

There is a bug in the type checking of JClass when the application path does not specify a specific package name. #119

Closed
YunFy26 opened this issue Sep 15, 2024 · 2 comments
Labels
type: bug A general bug

Comments

@YunFy26
Copy link

YunFy26 commented Sep 15, 2024

📝 Overall Description

In options.yml

appClassPath: [project/BOOT-INF/classes]

#appClassPath: [project/BOOT-INF/classes/org/example/springtest]

The first configuration causes incorrect type checking.

For example, there is an interface type

package org.example.springtest;

public interface Injection {
    String sayInjection();
}

If the first appClassPath configuration is used, it will result in

JClass aClass = World.get().getClassHierarchy().getClass("org.example.springtest.Injection");
aClass.isAbstract() == true;
aClass.isInterface() == true;

I have created a repo to reproduce this bug, please check it.

🎯 Expected Behavior

None

🐛 Current Behavior

None

🔄 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

@YunFy26 YunFy26 added the type: bug A general bug label Sep 15, 2024
@zhangt2333
Copy link
Member

zhangt2333 commented Sep 15, 2024

The first configuration causes incorrect type checking.

As stated in the Java Language Specification, §9.1.1.1, Every interface is implicitly abstract.

appClassPath: [project/BOOT-INF/classes/org/example/springtest]

This class path is incorrect in your case. It results in World.get().getClassHierarchy().getClass("org.example.springtest.Injection") retrieving a phantom class, which is expected to be located at project/BOOT-INF/classes/org/example/springtest/org/example/springtest/Injection. Consequently, the modifiers for this phantom class may not be reliable.

@YunFy26
Copy link
Author

YunFy26 commented Sep 15, 2024

Got it. Thanks!

@YunFy26 YunFy26 closed this as completed Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants