Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 468020

Summary: MemberValuePairBinding.init() exposes internal MemberValuePairBinding.NoValue as value
Product: [Eclipse Project] JDT Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: stephan.herrmann
Version: 4.5   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Sebastian Zarnekow CLA 2015-05-22 09:55:08 EDT
From the code (below) and bug 467477 (filed against Xtext) I figured that MemberValuePairBinding may expose the internal represenation of a cached, issing value (NoValue) wrapped into an array to clients.


	public Object getValue() {
		if (this.value == null)
			init();
		return this.value == NoValue ? null : this.value;
	}

	private void init() {
		this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver);
		if (this.value == null)
			this.value = NoValue;
		IMethodBinding methodBinding = getMethodBinding();
		if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) {
			this.value = new Object[] { this.value }; 
		}
	}

This appears to be wrong since #getValue is defined as an array of valid annotation values but now contains an instance of java.lang.Object.
Comment 1 Stephan Herrmann CLA 2015-05-22 14:17:33 EDT
So, if resolving failed on an array-typed member, would you as a client expect null or new Object[] { null } ?
Comment 2 Eclipse Genie CLA 2020-03-15 17:02:01 EDT
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.