Skip to content

Commit

Permalink
Revert "Relax transient injection rule #417"
Browse files Browse the repository at this point in the history
This can break reasonable, existing code. Specifically it breaks World
Singles code in very unpleasant ways that are not easy to workaround.

This reverts commit ff20982.
  • Loading branch information
seancorfield committed Jan 12, 2016
1 parent bafcf1b commit 767d87b
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions framework/ioc.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -520,21 +520,19 @@ component {
}


private struct function findSetters( any cfc, struct iocMeta, boolean isSingleton ) {
private struct function findSetters( any cfc, struct iocMeta ) {
var liveMeta = { setters = iocMeta.setters };
if ( !iocMeta.pruned ) {
// for transients, we need to prune known setters of transients:
if ( !isSingleton ) {
var prunable = { };
for ( var known in iocMeta.setters ) {
if ( !this.isSingleton( known ) ) {
prunable[ known ] = true;
}
}
for ( known in prunable ) {
structDelete( iocMeta.setters, known );
// need to prune known setters of transients:
var prunable = { };
for ( var known in iocMeta.setters ) {
if ( !isSingleton( known ) ) {
prunable[ known ] = true;
}
}
for ( known in prunable ) {
structDelete( iocMeta.setters, known );
}
iocMeta.pruned = true;
}
// gather up explicit setters:
Expand All @@ -543,8 +541,8 @@ component {
var n = len( member );
if ( isCustomFunction( method ) && left( member, 3 ) == 'set' && n > 3 ) {
var property = right( member, n - 3 );
if ( !isSingleton && !this.isSingleton( property ) ) {
// for transients, ignore properties that we know to be transients...
if ( !isSingleton( property ) ) {
// ignore properties that we know to be transients...
continue;
}
if ( !structKeyExists( liveMeta.setters, property ) ) {
Expand Down Expand Up @@ -795,7 +793,7 @@ component {
/*******************************************************/
if ( !structKeyExists( accumulator.injection, beanName ) ) {
if ( !structKeyExists( variables.settersInfo, beanName ) ) {
variables.settersInfo[ beanName ] = findSetters( bean, info.metadata, info.isSingleton );
variables.settersInfo[ beanName ] = findSetters( bean, info.metadata );
}
var setterMeta = {
setters = variables.settersInfo[ beanName ].setters,
Expand Down

0 comments on commit 767d87b

Please sign in to comment.