Bug 547376 - [1.8][compiler] method resolution in local class violates the comb rule
Summary: [1.8][compiler] method resolution in local class violates the comb rule
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.11   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-16 06:26 EDT by Abdulhakim Unlu CLA
Modified: 2022-08-13 15:16 EDT (History)
2 users (show)

See Also:


Attachments
source code to reproduce issue (243 bytes, text/plain)
2019-05-16 09:43 EDT, Abdulhakim Unlu CLA
no flags Details
source code to reproduce issue (334 bytes, text/x-java)
2019-05-16 09:44 EDT, Abdulhakim Unlu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Abdulhakim Unlu CLA 2019-05-16 06:26:55 EDT

    
Comment 2 Abdulhakim Unlu CLA 2019-05-16 09:43:07 EDT
Created attachment 278627 [details]
source code to reproduce issue
Comment 3 Abdulhakim Unlu CLA 2019-05-16 09:44:00 EDT
Created attachment 278628 [details]
source code to reproduce issue
Comment 4 Abdulhakim Unlu CLA 2019-05-16 09:50:31 EDT
when there is an anonymous class where both parent class and outer class has a method with same name but parent class method is private, openjdk/oracle jdk 1.8 gives following compile error:

[ERROR] /Workspace/gwtcleanmvn/src/main/java/com/aunlu/test2/MainTest.java:[14,33] method test in class com.aunlu.test2.AbstractTest cannot be applied to given types;
[ERROR]   required: boolean
[ERROR]   found: no arguments
[ERROR]   reason: actual and formal argument lists differ in length

however, eclipse compiler does not give any compile error and when compiled class is run, it seems application calls outer class method.


build-id:
Eclipse IDE for Enterprise Java Developers.

Version: 2019-03 (4.11.0)
Build id: 20190314-1200

java version "1.8.0_212"
Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)
Comment 5 Abdulhakim Unlu CLA 2019-05-16 09:52:03 EDT
reopening after providing details
Comment 6 Stephan Herrmann CLA 2019-05-16 10:13:48 EDT
I can reproduce now.

Here ecj seems to violate the "comb rule" from JLS ยง15.12.1., which is illustrated in example 6.5.7.1-1. [1]

ecj correctly reports all errors indicated in that example.

Interestingly, ecj starts reporting an error against MainTest, when we remove the private method in AbstractTest. That method definitely shouldn't have an impact.

To reproduce, the class need not be anonymous, any local class in that context will do.

[1] https://docs.oracle.com/javase/specs/jls/se12/html/jls-6.html#jls-6.5.7.1
Comment 7 Eclipse Genie CLA 2022-08-13 15:16:27 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.