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

Runtime Annotation lost in parent interface when the code is compiled by eclipse #3562

Open
beanww opened this issue Jan 16, 2025 · 2 comments
Labels
needinfo Further information is requested

Comments

@beanww
Copy link

beanww commented Jan 16, 2025

Let's make sure issue is not already fixed in latest builds first.

[NO ] I verified I can reproduce this issue against latest Integration Build of Eclipse SDK
Steps to reproduce
From a fresh installation and clean workspace:

with eclipse-jee-2024-12-R-win32-x86_64.zip
and plugin: Lombok v1.18.36

I tried Test.java:

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;

public class Test {
public static void main(String[] args) {
Method[] methods = ChildInterface.class.getMethods();
for(Method method: methods) {
if(method.getName().contains("select")) {
System.out.println(method.getAnnotations().length);
}
}
}
}
interface ParentInterface{
V selectById();
}

interface ChildInterface extends ParentInterface{
@anno
default ImplClass selectById() {
return null;
}
}
interface ClassInf{}

class ImplClass implements ClassInf{}

@retention(RetentionPolicy.RUNTIME)
@target(ElementType.METHOD)
@interface anno{

}

Run Test.java

I expected: <what was the expected outcome?>

1
1
which means both 2 methods have annotation object

But got: <what is the actual undesired behavior?>

1
0

I encountered this issue when compiling Test.java with Eclipse: 'The method object with return type ClassInf has no annotation object.'

However, this issue does not occur when I compile Test.java using IntelliJ IDEA or javac.

Tested under this environment:
OS & version:
Win10
Eclipse IDE/Platform version (as shown in Help > About):
Version: 2024-12 (4.34.0)
Build id: 20241128-0757
*JDK:
jdk-21.0.5

@jukzi
Copy link
Contributor

jukzi commented Jan 16, 2025

Please give reproducer without Lombok and format the issue to quote examples as code

@jukzi jukzi added the needinfo Further information is requested label Jan 16, 2025
@beanww
Copy link
Author

beanww commented Jan 17, 2025

I have reprodunced this issue in pure eclipse(without lombok)Version: 2024-12 (4.34.0)
Build id: 20241128-0757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants