Qi4j

ConcernOf/SideEffectOf not working with <Property<SomeType>>

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.1
  • Fix Version/s: 1.2
  • Component/s: Core Runtime
  • Labels:
    None
  • Environment:
    -

Description

In org.qi4j.runtime.property.PropertyTest#testProperty() we should
Assert.assertEquals( "JAYWAY", company.name().get() );

CapitalizeConcern.set() doesn't kick in.

No effect either with SideEffectOf<Property<String>> (using @SideEffects).

Activity

Hide
Niclas Hedhman added a comment -

It is actually not a bug, it is an incorrect testcase. The essence is like this;

@Concerns( CapitalizeConcern.class )
public interface Nameable

{ @Capitalized Property<String> name(); }

@AppliesTo( Capitalized.class )
public static abstract class CapitalizeConcern
extends ConcernOf<Property<String>>
implements Property<String>
{
public void set( String newValue )
throws IllegalArgumentException

{ newValue = newValue.toUpperCase(); next.set( newValue ); }

}

where the intention of the test is to apply the concern on the set() method.

However, as it is written, the @Capitalized annotation is on the name() method, and hence being at the "wrong" level. To make it work as intended, an implementation of Nameable is needed, where the set() method is provided and marked @Capitalized.

I am therefor closing this bug report.

Show
Niclas Hedhman added a comment - It is actually not a bug, it is an incorrect testcase. The essence is like this; @Concerns( CapitalizeConcern.class ) public interface Nameable { @Capitalized Property<String> name(); } @AppliesTo( Capitalized.class ) public static abstract class CapitalizeConcern extends ConcernOf<Property<String>> implements Property<String> { public void set( String newValue ) throws IllegalArgumentException { newValue = newValue.toUpperCase(); next.set( newValue ); } } where the intention of the test is to apply the concern on the set() method. However, as it is written, the @Capitalized annotation is on the name() method, and hence being at the "wrong" level. To make it work as intended, an implementation of Nameable is needed, where the set() method is provided and marked @Capitalized. I am therefor closing this bug report.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: