Giter Club home page Giter Club logo

Comments (1)

xxDark avatar xxDark commented on June 10, 2024

Simple example:

public interface MyConsumer<T> {
    public void accept(T t);
}

public class Test {
	public static void main(String[] args) {
		MyConsumer<String> c = consumer();
		c.accept("Hello, World");
	}
	
	private static MyConsumer<String> consumer() {
		return Test::println;
	}
	
	private static void println(String message) {
		System.out.println(message);
	}
}

After some testing, it is indeed seems like Proguard assumes that invocation of MyConsumer::accept has no side effects if there are no implementations of it in the jar file. If I add at least 1 file that references MyConsumer and use it in the code issue disappears.

Small sample, change .zip to .jar
For the sake of simplicity, use Java 8. Jar doesn't include logic necessary to run on newer versions.
Proguard settings:
Shrinking enabled, Test::main is kept
Obfuscation disabled
Optimizations enabled, 5 passes, all boxes under 'Remove' and 'Remove debugging' are unchecked
dontwarn is set to 'java.lang.invoke.**'

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.