[ http://issues.apache.org/jira/browse/BEEHIVE-1087?page=all ]
Chad Schoettger resolved BEEHIVE-1087:
--------------------------------------
Fix Version: v.next
Resolution: Fixed
Assign To: Alejandro Ramirez (was: Chad Schoettger)
Modified org.apache.beehive.controls.api.bean.Control annotation to include an
optional interface hint attribute:
public @interface Control
{
/**
* Optional member used to specify the control interface class.
* Typically only necessary to resolve ambiguities when multiple
* control interfaces with same name but different packages are present.
*/
Class<?> interfaceHint() default Object.class;
}
The interfaceHint may be used to explicitly specify the control's interface
class.
> Controls with simple name conflicts not resolved correctly
> ----------------------------------------------------------
>
> Key: BEEHIVE-1087
> URL: http://issues.apache.org/jira/browse/BEEHIVE-1087
> Project: Beehive
> Type: Bug
> Components: Controls
> Versions: 1.0.1
> Reporter: Jess Garms
> Assignee: Alejandro Ramirez
> Fix For: v.next
> Attachments: wrong_control_selected.zip
>
> I have two controls, both called FooControl, in separate packages. If I then
> refer to one of them via their generated Bean class in a Controller, the
> annotation processor doesn't always use the correct one. I'll attach source
> code that exhibits this problem, where a reference to b.FooControlBean
> becomes a reference to a.FooControlBean in the generated code.
> This occurs because during a clean build the generated Bean class has not yet
> been generated, so the annotation processor searches for all types that are
> annotated with @ControlInterface, and looks for one with a matching simple
> name, ignoring the package. In this case, there are two such types with
> matching simple names in different packages, and the annotation processor
> cannot differentiate between the two, as APT provides no means for examining
> imports or resolving the fully-qualified name of a type that has not been
> generated (in this case the Bean).
> A possible fix: add an optional value to the Control annotation like so:
> public @interface Control {
> Class<?> interfaceClass default Object.class;
> }
> Then if @Control is used on a generated Bean class, the user could indicate
> what the interface is (from the example I'll be attaching):
> ...
> import b.*;
> ...
> @Control(FooControl.class)
> private FooControlBean fooControl;
> ...
> This change is binary- and source-compatible with previous releases, as the
> new value is optional.
> When processing the use of the control, the annotation processor could use
> the interfaceClass value to determine which interface to use for the Bean
> instance.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira