Open
Description
Proposal:
A package-level flag in the source code that can only be used in the main
package which switches the dead code elimination into "aggressive" mode. In this mode, the reflection can only invoke methods that are also referenced somewhere else in the code. If they are not referenced, the DCE eliminates them at compile time and calling them via reflection will cause a panic properly describing the situation.
This flag is an opt-in feature to produce smaller output. Since it can only be set in the main
package, it is the application author's responsibility to make sure that it does not break the program at runtime. The author can always add a dummy reference somewhere to make the DCE include a certain method.
Metadata
Metadata
Assignees
Labels
Community contributions are welcome for this feature!Community contributions are welcome for this feature!