Esempio n. 1
0
 private static MethodAnalysisResults analyzeLambdaClass(
     Class<?> lambdaClass,
     MetamodelUtil metamodel,
     LambdaAsClassAnalysisConfig lambdaAsClass,
     ClassLoader alternateClassLoader,
     boolean isObjectEqualsSafe,
     boolean isCollectionContainsSafe)
     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, isCollectionContainsSafe));
   MethodAnalysisResults analysis =
       classAnalyzer.analyzeLambdaMethod(
           matchingMethod.getName(),
           Type.getMethodDescriptor(matchingMethod),
           pathAnalysisFactory);
   PathAnalysisSimplifier.cleanAndSimplify(
       analysis, metamodel.getComparisonMethods(isObjectEqualsSafe));
   return analysis;
 }
Esempio n. 2
0
 private static MethodAnalysisResults analyzeLambda(
     MetamodelUtil metamodel,
     ClassLoader alternateClassLoader,
     boolean isObjectEqualsSafe,
     boolean isCollectionContainsSafe,
     String className,
     String methodName,
     String methodSignature)
     throws IOException, AnalyzerException {
   // Open up the corresponding class to analyze
   PathAnalysisFactory pathAnalysisFactory =
       new PathAnalysisFactory(
           metamodel.getMethodChecker(isObjectEqualsSafe, isCollectionContainsSafe));
   TransformationClassAnalyzer classAnalyzer =
       new TransformationClassAnalyzer(className, alternateClassLoader);
   MethodAnalysisResults analysis =
       classAnalyzer.analyzeLambdaMethod(methodName, methodSignature, pathAnalysisFactory);
   PathAnalysisSimplifier.cleanAndSimplify(
       analysis, metamodel.getComparisonMethods(isObjectEqualsSafe));
   return analysis;
 }