Giter Club home page Giter Club logo

Comments (2)

aumann avatar aumann commented on June 2, 2024

We have a similar problem. We've updated our (maven) tycho version, which compiles with a newer JDT, and now we get an additional warning from proguard.

This is approximately the pattern we have:

// package a;

public interface A {
  default void m() {
    throw new UnsupportedOperationException("");
  }
}

public class L {
  public void onEvent() {}
  public void other() {}
}

// package b;

public class AImpl implements a.A {
  public void addListener(L listener) {
    
  }
}

public class OuterBase {
  A createA() {
    return new AImpl();
  }
}

// package c;

public class ObfuscationIssue extends b.OuterBase {
  public void other() {
    // here, the ref works
    createA();
  }
  
  @Override
  a.A createA() {
    // ObfuscationIssue$123
    return new b.AImpl() {
      private final java.util.List<java.util.function.Consumer<String>> list;
      { // anon constructor
        list = java.util.List.of();
        // probably unrelated: we have a ref like a.A.EnumXX.LITERAL, here
        
        // anon a.L is ObfuscationIssue$123$1
        addListener(new a.L() {
          @Override public void onEvent() {
            
            list.forEach(c -> c.accept("thing"));
          }
        });
      }
      @Override
      public void m() {
        // do stuff
      }
    };
  }

}

The warning we now get is c.ObfuscationIssue$123$1: can't find enclosing method 'A createAl()' in program class c.ObfuscationIssue$123

I hope this helps, please let me know if you need something else / more info.

from proguard.

jmohrmann avatar jmohrmann commented on June 2, 2024

Well, it appears this may have been an issue with Eclipse and not with ProGuard. I have just updated to the latest 2024-03 version of Eclipse, and the problem does not occur anymore. Even using ProGuard 5.2.1, the project builds and obfuscates fine with no warnings about anonymous classes that have to be ignored for the obfuscation to complete successfully.

from proguard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.