use of org.apache.flink.runtime.util.jartestprogram.AnonymousInNonStaticMethod in project flink by apache.
the class JarFileCreatorTest method TestAnonymousInnerClassTrick2.
//anonymous inner class in non static method accessing a local variable in its closure.
@Test
public void TestAnonymousInnerClassTrick2() throws Exception {
File out = new File(System.getProperty("java.io.tmpdir"), "jarcreatortest.jar");
JarFileCreator jfc = new JarFileCreator(out);
jfc.addClass(AnonymousInNonStaticMethod.class).createJarFile();
Set<String> ans = new HashSet<String>();
ans.add("org/apache/flink/runtime/util/jartestprogram/AnonymousInNonStaticMethod$1.class");
ans.add("org/apache/flink/runtime/util/jartestprogram/AnonymousInNonStaticMethod$A.class");
ans.add("org/apache/flink/runtime/util/jartestprogram/AnonymousInNonStaticMethod.class");
Assert.assertTrue("Jar file for Anonymous Inner Class is not correct", validate(ans, out));
out.delete();
}
Aggregations