system/src/sc/lang/java/IdentifierExpression.java
static private void checkForBindableCompiledField(String propertyName, Object boundType, Object annotType, Object referenceType, Statement fromExpr, boolean referenceOnly, boolean checkAnnotations) {
      TypeDeclaration referenceTD;
      LayeredSystem sys;

      if (!(referenceType instanceof BodyTypeDeclaration)) {
         if (!referenceOnly && ModelUtil.hasSetMethod(boundType) && ModelUtil.getPropertyAnnotation(annotType, "sc.bind.Bindable") == null) {
            fromExpr.displayWarning("Binding to unbindable compiled type: " + referenceType + " for property: " + propertyName + " in: ");
            ModelUtil.getPropertyAnnotation(annotType, "sc.bind.Bindable");
         }

         if (!(sys = fromExpr.getLayeredSystem()).useRuntimeReflection) {
            sys.buildInfo.addExternalDynProp(referenceType, propertyName, fromExpr.getJavaModel(), referenceOnly);
         }
      }
      else {
         referenceTD = (TypeDeclaration) referenceType;

         if (ModelUtil.hasSetMethod(boundType) && ModelUtil.getPropertyAnnotation(annotType, "sc.bind.Bindable") == null) {
            Object nextType;
            TypeDeclaration nextTD;
            boolean addBindable = true;

            // We'll already be making the property in the reference TD bindable which should be enough
            Object member = referenceTD.definesMember(propertyName, MemberType.PropertyAnySet, null, null);
            if (checkAnnotations && member != null && ModelUtil.getAnnotation(member, "sc.bind.Bindable") != null)
                return;

            Layer nextTDLayer = null;
            // Find the most specific class/object type which defines this property skipping annotation layers which are
            // not generated
            while ((nextType = referenceTD.getDerivedTypeDeclaration()) instanceof TypeDeclaration &&
                    (nextTD = (TypeDeclaration) nextType).isClassOrObjectType() && ((nextTDLayer = nextTD.getLayer()) == null || !nextTDLayer.annotationLayer)) {

               member = nextTD.definesMember(propertyName, MemberType.PropertyAnySet, null, null);
               // Make sure this next type actually defines the property before we try to make it bindable
               if (member == null)
                  break;

               // If we are derived from a type which implements the bindable contract, we do not need to make this one bindable as well.
               if (checkAnnotations && (ModelUtil.getAnnotation(member, "sc.bind.Bindable") != null || ModelUtil.isConstant(member))) {
                  addBindable = false;
                  break;
               }
               referenceTD = nextTD;
            }

            if (!(nextType instanceof TypeDeclaration)) {
               sys = fromExpr.getLayeredSystem();
               if (sys != null && !sys.useRuntimeReflection) {
                  sys.buildInfo.addExternalDynProp(nextType, propertyName, fromExpr.getJavaModel(), referenceOnly);
               }
            }

            if (member != null && (ModelUtil.isConstant(member) || (boundType != member && ModelUtil.isConstant(boundType))))
               addBindable = false;

            // But then need to resolve it back to the most specific modified type
            referenceTD = (TypeDeclaration) referenceTD.resolve(true);

            if (addBindable) {
               referenceTD.addPropertyToMakeBindable(propertyName, boundType, fromExpr.getJavaModel(), referenceOnly, fromExpr);
            }
         }
         // TODO: else read-only property?
      }
      // Get the set method and print a warning if it is not bindable
   }
/**
    * Checks if the given property is bindable already.  If not, it will add the property to the list of those to inject bindability to during class transformation.  If "makeBindable" is true
    * this is called from the makeBindable method which has already determined we need to make it bindable.  If not, we look for any bindable annotation in the chain and abort the binding.
    */
Checks if the given property is bindable already.  If not, it will add the property to the list of those to inject bindability to during class transformation.  If "makeBindable" is true
this is called from the makeBindable method which has already determined we need to make it bindable.  If not, we look for any bindable annotation in the chain and abort the binding.
Checks if the given property is bindable already . If not it will add the property to the list of those to inject bindability to during class transformation . If " makeBindable " is true this is called from the makeBindable method which has already determined we need to make it bindable . If not we look for any bindable annotation in the chain and abort the binding .
static private void checkForBindableCompiledField(String propertyName, Object boundType, Object annotType, Object referenceType, Statement fromExpr, boolean referenceOnly, boolean checkAnnotations) {
      TypeDeclaration referenceTD;
      LayeredSystem sys;
      if (!(referenceType instanceof BodyTypeDeclaration)) {
         if (!referenceOnly && ModelUtil.hasSetMethod(boundType) && ModelUtil.getPropertyAnnotation(annotType, "sc.bind.Bindable") == null) {
            fromExpr.displayWarning("Binding to unbindable compiled type: " + referenceType + " for property: " + propertyName + " in: ");
            ModelUtil.getPropertyAnnotation(annotType, "sc.bind.Bindable");
         }
         if (!(sys = fromExpr.getLayeredSystem()).useRuntimeReflection) {
            sys.buildInfo.addExternalDynProp(referenceType, propertyName, fromExpr.getJavaModel(), referenceOnly);
         }
      }
      else {
         referenceTD = (TypeDeclaration) referenceType;
         if (ModelUtil.hasSetMethod(boundType) && ModelUtil.getPropertyAnnotation(annotType, "sc.bind.Bindable") == null) {
            Object nextType;
            TypeDeclaration nextTD;
            boolean addBindable = true;
            Object member = referenceTD.definesMember(propertyName, MemberType.PropertyAnySet, null, null);
            if (checkAnnotations && member != null && ModelUtil.getAnnotation(member, "sc.bind.Bindable") != null)
                return;
            Layer nextTDLayer = null;
            while ((nextType = referenceTD.getDerivedTypeDeclaration()) instanceof TypeDeclaration &&
                    (nextTD = (TypeDeclaration) nextType).isClassOrObjectType() && ((nextTDLayer = nextTD.getLayer()) == null || !nextTDLayer.annotationLayer)) {
               member = nextTD.definesMember(propertyName, MemberType.PropertyAnySet, null, null);
               if (member == null)
                  break;
               if (checkAnnotations && (ModelUtil.getAnnotation(member, "sc.bind.Bindable") != null || ModelUtil.isConstant(member))) {
                  addBindable = false;
                  break;
               }
               referenceTD = nextTD;
            }
            if (!(nextType instanceof TypeDeclaration)) {
               sys = fromExpr.getLayeredSystem();
               if (sys != null && !sys.useRuntimeReflection) {
                  sys.buildInfo.addExternalDynProp(nextType, propertyName, fromExpr.getJavaModel(), referenceOnly);
               }
            }
            if (member != null && (ModelUtil.isConstant(member) || (boundType != member && ModelUtil.isConstant(boundType))))
               addBindable = false;
            referenceTD = (TypeDeclaration) referenceTD.resolve(true);
            if (addBindable) {
               referenceTD.addPropertyToMakeBindable(propertyName, boundType, fromExpr.getJavaModel(), referenceOnly, fromExpr);
            }
         }
      }
   }
static private void checkForBindableCompiledField ( String propertyName , Object boundType , Object annotType , Object referenceType , Statement fromExpr , boolean referenceOnly , boolean checkAnnotations ) { TypeDeclaration referenceTD ; LayeredSystem sys ; if ( ! ( referenceType instanceof BodyTypeDeclaration ) ) { if ( ! referenceOnly && ModelUtil . hasSetMethod ( boundType ) && ModelUtil . getPropertyAnnotation ( annotType , "sc.bind.Bindable" ) == null ) { fromExpr . displayWarning ( "Binding to unbindable compiled type: " + referenceType + " for property: " + propertyName + " in: " ) ; ModelUtil . getPropertyAnnotation ( annotType , "sc.bind.Bindable" ) ; } if ( ! ( sys = fromExpr . getLayeredSystem ( ) ) . useRuntimeReflection ) { sys . buildInfo . addExternalDynProp ( referenceType , propertyName , fromExpr . getJavaModel ( ) , referenceOnly ) ; } } else { referenceTD = ( TypeDeclaration ) referenceType ; if ( ModelUtil . hasSetMethod ( boundType ) && ModelUtil . getPropertyAnnotation ( annotType , "sc.bind.Bindable" ) == null ) { Object nextType ; TypeDeclaration nextTD ; boolean addBindable = true ; Object member = referenceTD . definesMember ( propertyName , MemberType . PropertyAnySet , null , null ) ; if ( checkAnnotations && member != null && ModelUtil . getAnnotation ( member , "sc.bind.Bindable" ) != null ) return ; Layer nextTDLayer = null ; while ( ( nextType = referenceTD . getDerivedTypeDeclaration ( ) ) instanceof TypeDeclaration && ( nextTD = ( TypeDeclaration ) nextType ) . isClassOrObjectType ( ) && ( ( nextTDLayer = nextTD . getLayer ( ) ) == null || ! nextTDLayer . annotationLayer ) ) { member = nextTD . definesMember ( propertyName , MemberType . PropertyAnySet , null , null ) ; if ( member == null ) break ; if ( checkAnnotations && ( ModelUtil . getAnnotation ( member , "sc.bind.Bindable" ) != null || ModelUtil . isConstant ( member ) ) ) { addBindable = false ; break ; } referenceTD = nextTD ; } if ( ! ( nextType instanceof TypeDeclaration ) ) { sys = fromExpr . getLayeredSystem ( ) ; if ( sys != null && ! sys . useRuntimeReflection ) { sys . buildInfo . addExternalDynProp ( nextType , propertyName , fromExpr . getJavaModel ( ) , referenceOnly ) ; } } if ( member != null && ( ModelUtil . isConstant ( member ) || ( boundType != member && ModelUtil . isConstant ( boundType ) ) ) ) addBindable = false ; referenceTD = ( TypeDeclaration ) referenceTD . resolve ( true ) ; if ( addBindable ) { referenceTD . addPropertyToMakeBindable ( propertyName , boundType , fromExpr . getJavaModel ( ) , referenceOnly , fromExpr ) ; } } } }
Checks if the given property is bindable already.
Checks if the given property is bindable already .
// We'll already be making the property in the reference TD bindable which should be enough // Find the most specific class/object type which defines this property skipping annotation layers which are // not generated // Make sure this next type actually defines the property before we try to make it bindable // If we are derived from a type which implements the bindable contract, we do not need to make this one bindable as well. // But then need to resolve it back to the most specific modified type // TODO: else read-only property? // Get the set method and print a warning if it is not bindable