<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>Hi all!</div>
<div><br>
</div>
<div>With the advent of class-based proxies my team and I have been fooled by debuggers quite often. To be honest I don't want to know how many hours we wasted so far while looking at the attributes of an proxy wondering why the application behaved differently
 (based on what the attributes of that proxy said ;). Even experienced developers usually need some time to detect that the attribute they are looking at are the default values of the class and not the values of the target instance.</div>
<div><br>
</div>
<div>Therefore I am wondering if we could help IDE providers to detect such situations and provide useful hints to developers. At a minimum I would ask for a simple &quot;this is not the real instance&quot;-hint, best case the debugger shows the values of the target
 instance. Some time ago I asked the IDEA guys (1) for better class-based proxy support in their debugger, nevertheless it would remain a proprietary solution once implemented.</div>
<div><br>
</div>
<div>I am not an expert in that field, but here are my thoughts.</div>
<div>- Across all bytecode manipulation/ bytecode generation frameworks there is no common way to detect whether a given object instance is a proxy or not.</div>
<div>- There is no direct JVM/java class library support either, apart from Class.isSynthetic – see 4.7.6 The Synthetic Attribute in (2)&nbsp;</div>
<div><span class="Apple-style-span">- A debugger could simply rely on&nbsp;</span>Class.isSynthetic<span class="Apple-style-span">&nbsp;to show a simple hint (if all CDI implementations would set this attribute – see 3)</span></div>
<div><span class="Apple-style-span">- We could ensure that proxies implement a common CDI SPI interface that allows access to the target instance. (If it wouldn't take that long the interface should be part of java.lang.reflect or similar).</span></div>
<div><span class="Apple-style-span"><br>
</span></div>
<div><span class="Apple-style-span">What do you think?</span></div>
<div><span class="Apple-style-span"><br>
</span></div>
<div>Jens</div>
<div>(1) http://youtrack.jetbrains.com/issue/IDEA-88756</div>
<div>(2)&nbsp;http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html</div>
<div>(3) https://issues.jboss.org/browse/WELD-1417&nbsp;</div>
</body>
</html>