As proposed to the CDI EG for the CDI-2.0 specification.
Sometimes you have to provide a producer for a class with non-private, non-static final classes. In those cases the CDI spec defines that a UnproxyableResolutionException needs to be thrown. And for a good reason. Usually this should be avoided but sometimes the code containing those final methods is not under your control. E.g. ThreadPoolExecutor, ConcurrentHashMap as of Java7 or if you need to integrate with some legacy applications.
In all those cases it would be great to have an exclude list for that rule.
The mechanism proposed to the CDI EG is to have a 2-phase configuration:
1.) system.env and system.settings to define 'global' allowProxying classes. This is needed if the whole deployable is not under your control. E.g. when installing a WAR or EAR which contains a ConcurrentHashMap producer on a container running Java7 or later. Usage:
2.) Adding the allow in some beans.xml. This is for cases where you have to integrate another jar or class which is not under your control but the app itself is yours.
All the given classes will simply get added to to a big Set<String> at boot time and for those classes the UnproxyableResolutionException will get supressed. (We might log out an info msg instead).