DRILL-8035: Update Janino to 3.1.7 version
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
index e2ce922..640cd0e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
@@ -240,7 +240,7 @@
       Map<String, Pair<byte[], ClassNode>> classesToMerge = Maps.newHashMap();
       for (byte[] clazz : implementationClasses) {
         totalBytecodeSize += clazz.length;
-        final ClassNode node = AsmUtil.classFromBytes(clazz, ClassReader.EXPAND_FRAMES);
+        ClassNode node = AsmUtil.classFromBytes(clazz, ClassReader.SKIP_FRAMES);
         if (!AsmUtil.isClassOk(logger, "implementationClasses", node)) {
           throw new IllegalStateException("Problem found with implementationClasses");
         }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
index 0bce966..787d681 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/JaninoClassCompiler.java
@@ -19,11 +19,11 @@
 
 import java.io.IOException;
 import java.io.StringReader;
-import java.util.HashMap;
+import java.util.Arrays;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 import org.apache.drill.exec.compile.ClassTransformer.ClassNames;
-import org.apache.drill.exec.exception.ClassTransformationException;
 import org.codehaus.commons.compiler.CompileException;
 import org.codehaus.janino.ClassLoaderIClassLoader;
 import org.codehaus.janino.IClassLoader;
@@ -36,7 +36,7 @@
 class JaninoClassCompiler extends AbstractClassCompiler {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(JaninoClassCompiler.class);
 
-  private IClassLoader compilationClassLoader;
+  private final IClassLoader compilationClassLoader;
 
   public JaninoClassCompiler(ClassLoader parentClassLoader, boolean debug) {
     super(debug);
@@ -45,7 +45,7 @@
 
   @Override
   protected byte[][] getByteCode(final ClassNames className, final String sourceCode)
-      throws CompileException, IOException, ClassNotFoundException, ClassTransformationException {
+      throws CompileException, IOException {
     ClassFile[] classFiles = doCompile(sourceCode);
 
     byte[][] byteCodes = new byte[classFiles.length][];
@@ -60,19 +60,15 @@
       throws CompileException, IOException, ClassNotFoundException {
 
     ClassFile[] classFiles = doCompile(sourceCode);
-    Map<String,byte[]> results = new HashMap<>();
-    for(int i = 0;  i < classFiles.length;  i++) {
-      ClassFile classFile = classFiles[i];
-      results.put(classFile.getThisClassName(), classFile.toByteArray());
-    }
-    return results;
+    return Arrays.stream(classFiles)
+      .collect(Collectors.toMap(ClassFile::getThisClassName, ClassFile::toByteArray, (a, b) -> b));
   }
 
   private ClassFile[] doCompile(final String sourceCode)
-      throws CompileException, IOException, ClassNotFoundException {
+      throws CompileException, IOException {
     StringReader reader = new StringReader(sourceCode);
-    Scanner scanner = new Scanner((String) null, reader);
-    Java.CompilationUnit compilationUnit = new Parser(scanner).parseCompilationUnit();
+    Scanner scanner = new Scanner(null, reader);
+    Java.AbstractCompilationUnit compilationUnit = new Parser(scanner).parseAbstractCompilationUnit();
     return new UnitCompiler(compilationUnit, compilationClassLoader)
                                   .compileUnit(this.debug, this.debug, this.debug);
   }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
index 42c8685..5654bfc 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ReplacingBasicValue.java
@@ -283,14 +283,16 @@
     if (AssertionUtil.ASSERT_ENABLED) {
       assert associates == other.associates;
       assert flagSet == other.flagSet;
-      assert associates.containsKey(this);
-      assert associates.containsKey(other);
+      if (associates != null) {
+        assert associates.containsKey(this);
+        assert associates.containsKey(other);
 
-      // check all the other values as well
-      for(ReplacingBasicValue value : associates.keySet()) {
-        assert associates.get(value) == null; // we never use the value
-        assert value.associates == associates;
-        assert value.flagSet == flagSet;
+        // check all the other values as well
+        for(ReplacingBasicValue value : associates.keySet()) {
+          assert associates.get(value) == null; // we never use the value
+          assert value.associates == associates;
+          assert value.flagSet == flagSet;
+        }
       }
     }
   }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
index 2b9d223..dfaf380 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionInitializer.java
@@ -150,7 +150,7 @@
       // TODO: Hack to remove annotations so Janino doesn't choke. Need to reconsider this problem...
       body = body.replaceAll("@\\w+(?:\\([^\\\\]*?\\))?", "");
       try {
-        return new Parser(new Scanner(null, new StringReader(body))).parseCompilationUnit();
+        return (CompilationUnit) new Parser(new Scanner(null, new StringReader(body))).parseAbstractCompilationUnit();
       } catch (CompileException e) {
           throw new IOException(String.format("Failure while loading class %s.", clazz.getName()), e);
       }
@@ -159,4 +159,4 @@
 
   }
 
-}
\ No newline at end of file
+}
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
index 3e67ebf..2319ae2 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/ImportGrabber.java
@@ -18,13 +18,14 @@
 package org.apache.drill.exec.expr.fn;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.codehaus.janino.Java;
-import org.codehaus.janino.Java.CompilationUnit.SingleStaticImportDeclaration;
-import org.codehaus.janino.Java.CompilationUnit.SingleTypeImportDeclaration;
-import org.codehaus.janino.Java.CompilationUnit.StaticImportOnDemandDeclaration;
-import org.codehaus.janino.Java.CompilationUnit.TypeImportOnDemandDeclaration;
+import org.codehaus.janino.Java.AbstractCompilationUnit.SingleStaticImportDeclaration;
+import org.codehaus.janino.Java.AbstractCompilationUnit.SingleTypeImportDeclaration;
+import org.codehaus.janino.Java.AbstractCompilationUnit.StaticImportOnDemandDeclaration;
+import org.codehaus.janino.Java.AbstractCompilationUnit.TypeImportOnDemandDeclaration;
 import org.codehaus.janino.util.AbstractTraverser;
 
 public class ImportGrabber {
@@ -45,7 +46,7 @@
    */
   public static List<String> getImports(Java.CompilationUnit compilationUnit) {
     ImportGrabber visitor = new ImportGrabber();
-    compilationUnit.importDeclarations.forEach(visitor.importFinder::visitImportDeclaration);
+    Arrays.stream(compilationUnit.importDeclarations).forEach(visitor.importFinder::visitImportDeclaration);
 
     return visitor.imports;
   }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
index 18cc4e4..b1c1713 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/MethodGrabbingVisitor.java
@@ -106,7 +106,7 @@
         try {
           // replaces return statements and stores the result into methodBodyBlock
           methodBodyBlock.addStatements(
-              returnStatementReplacer.copyBlockStatements(methodDeclarator.optionalStatements));
+              returnStatementReplacer.copyBlockStatements(methodDeclarator.statements));
         } catch (CompileException e) {
           throw new RuntimeException(e);
         }
diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml
index d40a7d9..e29dc5e 100644
--- a/exec/jdbc-all/pom.xml
+++ b/exec/jdbc-all/pom.xml
@@ -34,7 +34,7 @@
        "package.namespace.prefix" equals to "oadd.". It can be overridden if necessary within any profile -->
   <properties>
     <package.namespace.prefix>oadd.</package.namespace.prefix>
-    <jdbc-all-jar.maxsize>49400000</jdbc-all-jar.maxsize>
+    <jdbc-all-jar.maxsize>50000000</jdbc-all-jar.maxsize>
   </properties>
 
   <dependencies>
diff --git a/pom.xml b/pom.xml
index ba8d4d5..d966cbc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
     <calcite.groupId>com.github.vvysotskyi.drill-calcite</calcite.groupId>
     <calcite.version>1.21.0-drill-r8</calcite.version>
     <avatica.version>1.17.0</avatica.version>
-    <janino.version>3.0.11</janino.version>
+    <janino.version>3.1.7</janino.version>
     <sqlline.version>1.12.0</sqlline.version>
     <jackson.version>2.13.2.20220328</jackson.version>
     <zookeeper.version>3.5.7</zookeeper.version>