aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java
diff options
context:
space:
mode:
Diffstat (limited to 'exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java')
-rw-r--r--exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java
index 05e8ac171..3a01dda8d 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/MergeAdapter.java
@@ -141,7 +141,21 @@ class MergeAdapter extends ClassVisitor {
public void visitEnd() {
// add all the fields of the class we're going to merge.
for (Iterator<?> it = classToMerge.fields.iterator(); it.hasNext();) {
- ((FieldNode) it.next()).accept(this);
+
+ // Special handling for nested classes. Drill uses non-static nested
+ // "inner" classes in some templates. Prior versions of Drill would
+ // create the generated nested classes as static, then this line
+ // would copy the "this$0" field to convert the static nested class
+ // into a non-static inner class. However, that approach is not
+ // compatible with plain-old Java compilation. Now, Drill generates
+ // the nested classes as non-static inner classes. As a result, we
+ // do not want to copy the hidden fields; we'll end up with two if
+ // we do.
+
+ FieldNode field = (FieldNode) it.next();
+ if (! field.name.startsWith("this$")) {
+ field.accept(this);
+ }
}
// add all the methods that we to include.