Ticket #54 (closed defect: fixed)

Opened 1 year ago

Last modified 11 months ago

Annotation parameters cannot be of type stubReflectionClass

Reported by: schst Assigned to: mikey
Priority: blocker Milestone:
Component: ReflectionApi Version: SVN-trunk
Keywords: Cc:

Description

In the current version of Stubbles, the following code does not work:

/**
 * Annotation with class parameter
 *
 * @MyAnnotation(
 *     foo=AnyTestClass.class
 * )
 */
class AnotherTestClass {
}

$class = new stubReflectionClass('AnotherTestClass');
$anno  = $class->getAnnotation('MyAnnotation');

This results in

Fatal error:  Trying to clone an uncloneable object of class stubReflectionClass in C:\wamp\www\projects\stubbles\src\main\php\net\stubbles\reflection\annotations\stubAbstractAnnotation.php on line 50

Change History

06/02/07 12:11:37 changed by schst

I added a unit test, that currently fails because of this problem in changeset [702].

06/02/07 13:11:40 changed by mikey

  • priority changed from major to blocker.
  • status changed from new to assigned.
  • milestone set to 0.2.0.

06/02/07 14:08:51 changed by mikey

  • status changed from assigned to closed.
  • resolution set to fixed.

Fixed with changeset 703 with a hack because PHP does not offer a possibility to check whether an object can be cloned or not. We should think about introducing a new interface net.stubbles.stubClonable which indicates whether an object is clonable or not. Furthermore we should prevent the need to clone PHP internal classes because it could not be detected whether they are clonable or not.

07/02/07 10:40:45 changed by

  • milestone deleted.

Milestone 0.2.0 deleted