Comments (1)
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)
- predictNullPointerExceptions is enabled when not optimizing aggressively HOT 2
- java.lang.NullPointerException: Cannot throw exception because "null" is null HOT 1
- Support K2 HOT 2
- Excluded directories are still being processed incorrectly
- keep rule not working with annotation nested inside class HOT 2
- CRITICAL PROGUARD BUG! Very simple code not working!
- adaptresourcefilecontents on path like package reference
- Gradle plugin keep rules are not task inputs - breaking up-to-date checking
- Anonymous Classes Inside Other Anonymous Classes Produce "Unresolved references to program class members" Warning HOT 2
- Wildcard of field type, method return type and method parameters in conditional rules can't be referenced
- java.lang.VerifyError: Bad return type
- Support for Java 22 HOT 14
- com.android.tools.r8.ResourceException: com.android.tools.r8.internal.vc: I/O exception while reading HOT 1
- Java Formats and locales do not work
- Caused by: java.lang.ClassNotFoundException: proguard.optimize.gson._OptimizedJsonWriter HOT 1
- Modular program
- ProGuard writes wrong version code in zip files
- Reproducible Build Support HOT 1
- How to find root issue relate "It appears you are missing some classes resulting in an incomplete class hierarchy" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proguard.