Uploaded image for project: 'Lucee Development'
  1. LDEV-1778

Dynamic Proxies through no class defined exceptions

    Details

    • Type: Bug
    • Status: Awaiting Approval
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 5.2.6.61
    • Labels:
      None

      Description

      When working with dynamic proxies, i am seeing a weird error when implementing core JDK interfaces. These interfaces are part of JDK8.

      Example proxy:

      /**
       * Functional Interface that maps to java.util.function.Predicate
       * See https://docs.oracle.com/javase/8/docs/api/java/util/function/Predicate.html
       */
      component{ 
      
          /**
           * Constructor
           *
           * @f The lambda or closure to be used in the <code>apply()</code> method
           */
          function init( required f ){
              variables.target = arguments.f;
              // Stupid ACF Compiler
              variables[ "and" ]  = variables[ "$and" ];
              variables[ "or" ]   = variables[ "$or" ];
              return this;
          }
      
          /**
           * Evaluates this predicate on the given argument.
           *
           * @t 
           */
          boolean function test( t ){
              return variables.target( arguments.t );
          }
      
          
          function isEqual( targetRef ){}
          
          function negate(){}
          
          function $and( other ){}
          function $or( other ){}
      
      }
      

      Example Usage:

      boolean function noneMatch( required predicate ){
      		return variables.jStream.noneMatch(
      			createDynamicProxy( 
      				new proxies.Predicate( arguments.predicate ), 
      				[ "java.util.function.Predicate" ] 
      			)
      		);
      	}
      

      When I first run the code in the server, the code fails with a no class defined exception. If I restart the server, the error goes away. This is not good for stability.

      You can see a travis build on this here:
      https://travis-ci.org/coldbox-modules/cbstreams/jobs/360321909

        Attachments

          Activity

            People

            • Assignee:
              michael1 Michael Offner
              Reporter:
              lmajano Luis Majano
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: