| Summary: | IMemberValuePair#getValue returns null for expressions | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Pavan V <pavan.ananth> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | srikanth_sankaran |
| Version: | 3.6.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
Could you provide us with a stripped down, minimal, but complete version of client code that shows this problem ? TIA. I thought the example I've included is simple enough :). My usage of the AST is roughly on the lines of :
for(IMemberValuePair memPair : annotation.getMemberValuePairs()){
Object value = memPair.getValue(); //value returns null
}
You could use the QuickFix on the problems marker to create the AProperty annotation & its properties automatically.
(In reply to comment #2) > I thought the example I've included is simple enough :). My usage of the AST > is roughly on the lines of : The example is simple, but you didn't show the client code that is processing the file and is running into null's. > for(IMemberValuePair memPair : annotation.getMemberValuePairs()){ > Object value = memPair.getValue(); //value returns null > } Could you attach a complete example, please. Am sorry but the chain of events leading to this state involves too many classes & methods to be included here. If I'm not mistaken, you could use a ASTParser to parse this code (as String) & investigate the AST - perhaps the JDT Junits would already be doing this somewhere ? Bugs that carry a small reproducible case tend to get attended to sooner than others where a committer needs to guess. We routinely run into cases where we try to reconstruct from wordy descriptions only to fail. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Take this example for instance, public class Klass1 { private final String ONE = "one"; @AProperty(iAttr = 5 * 2, bAttr = false | true, sAttr = ONE+"Test", eAttr = EStatus.VAL1) public String attribute1; } For the annotation AProperty, the member value pairs iAttr, bAttr & sAttr store value as null. The API I am referring to is: org.eclipse.jdt.core.IMemberValuePair#getValue()