-
Notifications
You must be signed in to change notification settings - Fork 86
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
'ClassFormatError: Duplicate method name' during runtime when using lambda as ITD field value #199
Comments
Thanks for raising this issue. It really looks like a bug to me at first glance. Like I just said in another issue: Andy as a project lead is basically inactive due to his daytime job. All things related to byte code generation are not my strong suit anyway, so usually I am reluctant to touch that stuff. But I might be able to at least take a look during holiday season, using your reproducer to guide me to the root cause. But that something is wrong with the byte code becomes clear when using javap:
There we find:
Uh-oh! Maybe they should not be named the same. @aclement, where would you start looking in order to fix this? |
For now, you can refactor the first lambda into a method reference as a workaround: private Consumer<String> Testjava.sConsumer2 = TestjavaAO::accept;
private static void accept(String task) {
System.out.println("call sConsumer2 " + task);
} Then the code runs fine:
That is, of course, not a solution forever, but at least you can continue to work. |
Thank you for your quick reply. It seems to be a similar problem, please check below error. execute & error log
build command
source code
TestjavaAO.aj
|
This is not a support channel, but a bug and feature request tracker. The bug has not been fixed yet, so I am reopening it. The suggested workaround does not fix the problem. |
gh-199-200.zip contains reproducers for both #199 and #200. Unpack into an empty directory and run with Git Bash:
|
I'd first look at where the names are generated for lambdas - why is the second one not getting a 1 suffix. I don't recall where that is done though. My quick thought is whether it is because the intertype scope in use for ITDs is somehow hiding the counter from the parent scope? |
@aclement: Sure, that is what I also thought. But I do not know where to find that part of the code, and debugging without knowing where to start looking can take a lot of time. We discussed my wish to get a proper introduction to the code base from you many times before. I am still waiting for that. At least pointers into the right direction would be better than nothing for the time being. Thank you. |
Hi,
I want that two statement(variable, method) including lambda was added Testjava class.
So after code was written as below code, I compiled code.
But when running code, It occur duplicate method runtime error with lambda statement.
There are below error log, source code and build command.
Build environment
Error log of runtime
Source code
Testjava.java
TestjavaAO.aj
build command
The text was updated successfully, but these errors were encountered: