Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 515549

Summary: Eclipse JDT failed to detect compilation error in the program
Product: [Eclipse Project] JDT Reporter: Yongkang Guo <guogin>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard: stalebug
Attachments:
Description Flags
project-to-reproduce-issue none

Description Yongkang Guo CLA 2017-04-21 03:00:32 EDT
Created attachment 267896 [details]
project-to-reproduce-issue

Occasionally I find this issue. Where standard Java compiler says "wrong", the eclipse JDT says "OK".(Intellij IDEA also says "wrong" for your reference)
There're two ways to reproduce the issue:

Approach A:
1) Download the attached ZIP file and UNZIP.
2) Import the maven project into your workspace.
3) Right click the program 'AmbiguousMethodCallShowcase.java' and run as Java program.
At this point, you will see one line of output "Program is correct"
4) Now open command line prompt and 'cd' to the source directory.
5) Run command 'javac AmbiguousMethodCallShowcase.java'
At this point, you will see the java compiler gives error:

AmbiguousMethodCallShowcase.java:46: error: reference to findOne is ambiguous
        repo.findOne(1L);
            ^
  both method findOne(Long) in MyBaseEntityRepository and method findOne(ID) in CrudRepository match
  where T#1,ID,T#2 are type-variables:
    T#1 extends BaseEntity declared in interface MyBaseEntityRepository
    ID extends Serializable declared in interface CrudRepository
    T#2 extends Object declared in interface CrudRepository
1 error

Approach B:
1) Get the source code from https://github.com/guogin/problemapp
2) Import into eclipse as a maven project
3) Right click the program com.myapp.ProblemApplication and run as Java program (no need to install Spring boot plugins)
At this point, you will see the program is launched.
4) However if you go to command line and execute 'mvn clean package', you will see compilation error on ReportController.
The error says, reference to method 'findOne' is ambiguous, just like the approach A.

Best Regards,
Guo, Yongkang
Comment 1 Eclipse Genie CLA 2019-09-09 14:14:57 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.