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; }
public MethodAnalysisResults analyzeLambda( String className, String methodName, String methodSignature) { try { // Open up the corresponding class to analyze QueryllPathAnalysisSupplementalFactory pathAnalysisFactory = new QueryllPathAnalysisSupplementalFactory(entityInfo, new ArrayList<>()); TransformationClassAnalyzer classAnalyzer = new TransformationClassAnalyzer(className); MethodAnalysisResults analysis = classAnalyzer.analyzeLambdaMethod(methodName, methodSignature, pathAnalysisFactory); return analysis; } catch (IOException e) { e.printStackTrace(); return null; } catch (AnalyzerException e) { e.printStackTrace(); return null; } }
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; }