Package ch.epfl.labos.iu.orm.queryll2.symbolic

Examples of ch.epfl.labos.iu.orm.queryll2.symbolic.LambdaFactory


   }

   private static MethodAnalysisResults analyzeLambda(MetamodelUtil metamodel, ClassLoader alternateClassLoader, boolean isObjectEqualsSafe, String className, String methodName, String methodSignature) throws IOException, AnalyzerException
   {
      // Open up the corresponding class to analyze
      PathAnalysisFactory pathAnalysisFactory = new PathAnalysisFactory(
            metamodel.getMethodChecker(isObjectEqualsSafe));
      TransformationClassAnalyzer classAnalyzer =
            new TransformationClassAnalyzer(className, alternateClassLoader);
      MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(methodName, methodSignature, pathAnalysisFactory);
      PathAnalysisSimplifier.cleanAndSimplify(analysis, metamodel.getComparisonMethods(isObjectEqualsSafe));
View Full Code Here


      TransformationClassAnalyzer classAnalyzer =
            new TransformationClassAnalyzer(lambdaClass.getName(), alternateClassLoader);
      Method matchingMethod = lambdaAsClass.findLambdaMethod(lambdaClass);
      if (matchingMethod == null)
         throw new AnalyzerException(null, "Could not find a lambda method with the expected name in the class");
      PathAnalysisFactory pathAnalysisFactory = new PathAnalysisFactory(
            metamodel.getMethodChecker(isObjectEqualsSafe));
      MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(matchingMethod.getName(), Type.getMethodDescriptor(matchingMethod), pathAnalysisFactory);
      PathAnalysisSimplifier.cleanAndSimplify(analysis, metamodel.getComparisonMethods(isObjectEqualsSafe));
      return analysis;
   }
View Full Code Here

  
   private static MethodAnalysisResults analyzeLambda(MetamodelUtil metamodel, String className, String methodName, String methodSignature)
   {
      try {
         // Open up the corresponding class to analyze
         PathAnalysisFactory pathAnalysisFactory = new PathAnalysisFactory(
               new MethodChecker(metamodel));
         TransformationClassAnalyzer classAnalyzer =
               new TransformationClassAnalyzer(className);
         MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(methodName, methodSignature, pathAnalysisFactory);
         PathAnalysisSimplifier.cleanAndSimplify(analysis, Collections.emptyMap());
View Full Code Here

   private static MethodAnalysisResults analyzeLambda(MetamodelUtil metamodel, ClassLoader alternateClassLoader, boolean isObjectEqualsSafe, String className, String methodName, String methodSignature) throws IOException, AnalyzerException
   {
      // Open up the corresponding class to analyze
      PathAnalysisFactory pathAnalysisFactory = new PathAnalysisFactory(
            metamodel.getMethodChecker(isObjectEqualsSafe));
      TransformationClassAnalyzer classAnalyzer =
            new TransformationClassAnalyzer(className, alternateClassLoader);
      MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(methodName, methodSignature, pathAnalysisFactory);
      PathAnalysisSimplifier.cleanAndSimplify(analysis, metamodel.getComparisonMethods(isObjectEqualsSafe));
      return analysis;
   }
View Full Code Here

   }

   private static MethodAnalysisResults analyzeLambdaClass(Class<?> lambdaClass, MetamodelUtil metamodel, LambdaAsClassAnalysisConfig lambdaAsClass, ClassLoader alternateClassLoader, boolean isObjectEqualsSafe) throws IOException, AnalyzerException
   {
      // Open up the corresponding class to analyze
      TransformationClassAnalyzer classAnalyzer =
            new TransformationClassAnalyzer(lambdaClass.getName(), alternateClassLoader);
      Method matchingMethod = lambdaAsClass.findLambdaMethod(lambdaClass);
      if (matchingMethod == null)
         throw new AnalyzerException(null, "Could not find a lambda method with the expected name in the class");
      PathAnalysisFactory pathAnalysisFactory = new PathAnalysisFactory(
            metamodel.getMethodChecker(isObjectEqualsSafe));
      MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(matchingMethod.getName(), Type.getMethodDescriptor(matchingMethod), pathAnalysisFactory);
      PathAnalysisSimplifier.cleanAndSimplify(analysis, metamodel.getComparisonMethods(isObjectEqualsSafe));
      return analysis;
   }
View Full Code Here

   {
      try {
         // Open up the corresponding class to analyze
         PathAnalysisFactory pathAnalysisFactory = new PathAnalysisFactory(
               new MethodChecker(metamodel));
         TransformationClassAnalyzer classAnalyzer =
               new TransformationClassAnalyzer(className);
         MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(methodName, methodSignature, pathAnalysisFactory);
         PathAnalysisSimplifier.cleanAndSimplify(analysis, Collections.emptyMap());
         return analysis;
      } catch (IOException e)
      {
         e.printStackTrace();
View Full Code Here

   public void registerORMSimpleLink(String entityPackage, String map,
                                     String fromEntityName, String fromField, String fromCol,
                                     String toEntityName, String toField, String toCol)
   {
      ORMEntity fromEntity = entityFor(fromEntityName);
      ORMEntity toEntity = entityFor(toEntityName);
      String fromInternalName = makeInternalName(fromEntity.entityPackage, fromEntity.name);
      String toInternalName = makeInternalName(toEntity.entityPackage, toEntity.name);
      MethodSignature from1Signature =
         makeMethodSignature(entityPackage,
                             fromEntity.name,
View Full Code Here

      }
      final List<MethodSignature> transformConstructorsCalled = new ArrayList<MethodSignature>();
      final DBSetSourceChecker checkDBSets = new DBSetSourceChecker(entityInfo);
      final Set<TypedValue> unresolvedDBSets = new HashSet<TypedValue>();
      ConditionRecorder pathConditions = new ConditionRecorder();
      BasicSymbolicInterpreter interpreter = new SymbolicInterpreterWithFieldAccess(Opcodes.ASM5);
      FrameWithHelpers frame = new FrameWithHelpers(cl, m, interpreter);
      interpreter.setFrameForAliasingFixups(frame);
      interpreter.setBranchHandler(pathConditions);
      interpreter.setMethodChecker(new BasicSymbolicInterpreter.MethodChecker() {
            public boolean isStaticMethodSafe(MethodSignature m)
               { return safeStaticMethods.contains(m); }
            public boolean isMethodSafe(MethodSignature m, TypedValue base, List<TypedValue> args)
               {
                  if (m.name.equals("<init>") && otherTransformClasses.contains(m.owner))
View Full Code Here

            else
               conditions.add(ifTrueValue.inverseValue());
         }
      }
      ConditionRecorder pathConditions = new ConditionRecorder();
      BasicSymbolicInterpreter interpreter = new SymbolicInterpreterWithFieldAccess(Opcodes.ASM5);
      FrameWithHelpers frame = new FrameWithHelpers(cl, m, interpreter);
      interpreter.setFrameForAliasingFixups(frame);
      interpreter.setBranchHandler(pathConditions);
      interpreter.setMethodChecker(methodChecker);
     
      for (PathInstruction instruction: path)
      {
         // Skip "fake" instructions like Frame, LineNumber, and Label
         if (instruction.node.getOpcode() < 0) continue;
View Full Code Here

      final List<MethodSignature> transformConstructorsCalled = new ArrayList<MethodSignature>();
      final DBSetSourceChecker checkDBSets = new DBSetSourceChecker(entityInfo);
      final Set<TypedValue> unresolvedDBSets = new HashSet<TypedValue>();
      ConditionRecorder pathConditions = new ConditionRecorder();
      BasicSymbolicInterpreter interpreter = new SymbolicInterpreterWithFieldAccess(Opcodes.ASM5);
      FrameWithHelpers frame = new FrameWithHelpers(cl, m, interpreter);
      interpreter.setFrameForAliasingFixups(frame);
      interpreter.setBranchHandler(pathConditions);
      interpreter.setMethodChecker(new BasicSymbolicInterpreter.MethodChecker() {
            public boolean isStaticMethodSafe(MethodSignature m)
               { return safeStaticMethods.contains(m); }
            public boolean isMethodSafe(MethodSignature m, TypedValue base, List<TypedValue> args)
               {
                  if (m.name.equals("<init>") && otherTransformClasses.contains(m.owner))
                  {
                     transformConstructorsCalled.add(m);
                     return true;
                  }
                  else if (entityInfo.dbSetMethods.contains(m))
                  {
                     Type[] argTypes = Type.getArgumentTypes(m.desc);
                     try {
                        base.visit(checkDBSets, unresolvedDBSets);
                        for (int n = 0; n < argTypes.length; n++)
                        {
                           Type t = argTypes[n];
                           if (t.getSort() != Type.OBJECT) continue;
                           if (!t.getInternalName().equals("Lch/epfl/labos/iu/orm/DBSet;")) continue;
                           args.get(n).visit(checkDBSets, unresolvedDBSets);
                        }
                     } catch (TypedValueVisitorException e)
                     {
                        return false;
                     }
                     return true;
                  }
                  else
                     return safeMethods.contains(m);
               }});
     
      for (PathInstruction instruction: path)
      {
         // Skip "fake" instructions like Frame, LineNumber, and Label
         if (instruction.node.getOpcode() < 0) continue;
        
         if (instruction.isBranch)
            pathConditions.isBranchTaken = instruction.isBranchTaken;
         frame.execute(instruction.node, interpreter);
      }
     
      TypedValue returnValue = interpreter.returnValue;
      List<TypedValue.ComparisonValue> conditions = pathConditions.conditions;
     
View Full Code Here

TOP

Related Classes of ch.epfl.labos.iu.orm.queryll2.symbolic.LambdaFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.