question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$$Lambda$ class files

See original GitHub issue

CFR version

CFR 0.151

Compiler

unknown, java 8?

Description

When decompiling .jar file (decompiled with dex2jar, also tried enjarify, same output), i get multiple $$Lambda$ .class files along with some .class files, but in code clogged with unreadable code. But when i ran in procyon, it decompiled without those $$Lambda$ .class files, and at least got all in one place, in java, even if not perfect. So it must have to do with Java 8 lambda expressions, or whatever it is.

Example

this is file content

ls
 InstanceSettings.java      
Service.java                      
 'SettingsActivity$$Lambda$14.java'  
'SettingsActivity$$Lambda$5.java'  
 SettingsActivity.java
'Provider$$Lambda$1.java'  
'SettingsActivity$$Lambda$10.java'  
'SettingsActivity$$Lambda$1.java'  
 'SettingsActivity$$Lambda$6.java'   
Settings.java
'Provider$$Lambda$2.java' 
 'SettingsActivity$$Lambda$11.java'  
'SettingsActivity$$Lambda$2.java'   
'SettingsActivity$$Lambda$7.java'
 Provider.java            
 'SettingsActivity$$Lambda$12.java' 
 'SettingsActivity$$Lambda$3.java'  
 'SettingsActivity$$Lambda$8.java'
 RemoteViewsFactory.java   
'SettingsActivity$$Lambda$13.java'  
'SettingsActivity$$Lambda$4.java'   
'SettingsActivity$$Lambda$9.java'

and just a small fraction of code, to see how it looks in code

final class RandomVersePopup$$Lambda$1
implements CompoundButton.OnCheckedChangeListener {
    private final RadioButton arg$1;

    private RandomVersePopup$$Lambda$1(RadioButton radioButton) {
        this.arg$1 = radioButton;
    }

    private static CompoundButton.OnCheckedChangeListener get$Lambda(RadioButton radioButton) {
        return new RandomVersePopup$$Lambda$1(radioButton);
    }

    public static CompoundButton.OnCheckedChangeListener lambdaFactory$(RadioButton radioButton) {
        return new RandomVersePopup$$Lambda$1(radioButton);
    }

    @LambdaForm.Hidden
    public void onCheckedChanged(CompoundButton compoundButton, boolean bl) {
        RandomVersePopup.access$lambda$0(this.arg$1, compoundButton, bl);
    }


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
leibnitz27commented, Mar 18, 2021

I don’t like the idea of undoing this sort of thing automatically (especially not something as complex as this), because I want to actually see the java represented by the bytecode.

That being said, I can imagine given code like the above, it’s really useful to see what’s really going on - so - there’s an EXPLICIT argument sugarretrolambda, (hey, it’ll probably never get used, but it’s a nice toy to have).

I’m not going to enable this automatically, so I may add something in the future to warn it might be appropriate.

(also the code’s a bit of a mess 😉 )

Normal

    private void confirmAndDeleteSelectedItems() {
        AlertDialog.Builder builder = new AlertDialog.Builder((Context)this);
        builder.setTitle(2131297197);
        int n = this.getSelectedItemsCount();
        if (n == 1) {
            builder.setMessage((CharSequence)this.getString(2131296860, new Object[]{((Map)this.itemsData.get(this.getSelectedItemIndex())).get("name")}));
        } else {
            builder.setMessage((CharSequence)this.getString(2131296861, new Object[]{n}));
        }
        builder.setNegativeButton(2131296302, null);
        builder.setPositiveButton(2131296306, Profiles$$Lambda$6.lambdaFactory$((Profiles)this));
        builder.show();
    }

With --sugarretrolambda true

    private void confirmAndDeleteSelectedItems() {
        AlertDialog.Builder builder = new AlertDialog.Builder((Context)this);
        builder.setTitle(2131297197);
        int n = this.getSelectedItemsCount();
        if (n == 1) {
            builder.setMessage((CharSequence)this.getString(2131296860, new Object[]{this.itemsData.get(this.getSelectedItemIndex()).get(KEY_NAME)}));
        } else {
            builder.setMessage((CharSequence)this.getString(2131296861, new Object[]{n}));
        }
        builder.setNegativeButton(2131296302, null);
        builder.setPositiveButton(2131296306, (DialogInterface dialogInterface, int n) -> {
            this.deleteSelectedItems();
        });
        builder.show();
    }
0reactions
Lanchoncommented, Mar 18, 2021

then again, decompilation is mostly done to understand the code, not to recompile it. and enabled helps understanding…

maybe youll find that sensible defaults are different for analyzing than for roundtripping. a general “roundtrip” option could disable all stuff like this while otherwise defaulting to analysis mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy Java Lambda functions with .zip or JAR file archives
This page describes how to create your deployment package as a .zip file or Jar file, and then use the deployment package to...
Read more >
What is a Java 8 Lambda Expression Compiled to? [duplicate]
As we are aware, lambda expression/function is an anonymous class method implementation for abstract method in functional interface and if we ...
Read more >
Lambda Expressions (The Java™ Tutorials > Learning the ...
Lambda expressions enable you to do this, to treat functionality as method argument, or code as data. The previous section, Anonymous Classes, shows...
Read more >
Chapter 4. Operating AWS Lambda Functions - O'Reilly
Operating AWS Lambda Functions This chapter will introduce a more ... In the following example, Library A contains a class file and a...
Read more >
symphoniacloud/lambda-packaging: A collection of ... - GitHub
A collection of Maven assembly descriptors for building AWS Lambda deployment ... The resulting .zip file contains compiled class files and resources at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found