Search in sources :

Example 1 with NestedAnonymousInnerClass

use of org.apache.flink.runtime.util.jartestprogram.NestedAnonymousInnerClass in project flink by apache.

the class JarFileCreatorTest method TestAnonymousInnerClassTrick4.

//anonymous inner class in an anonymous inner class accessing a field of the outermost enclosing class.
@Test
public void TestAnonymousInnerClassTrick4() throws Exception {
    File out = new File(System.getProperty("java.io.tmpdir"), "jarcreatortest.jar");
    JarFileCreator jfc = new JarFileCreator(out);
    jfc.addClass(NestedAnonymousInnerClass.class).createJarFile();
    Set<String> ans = new HashSet<String>();
    ans.add("org/apache/flink/runtime/util/jartestprogram/NestedAnonymousInnerClass.class");
    ans.add("org/apache/flink/runtime/util/jartestprogram/NestedAnonymousInnerClass$1$1.class");
    ans.add("org/apache/flink/runtime/util/jartestprogram/NestedAnonymousInnerClass$1.class");
    ans.add("org/apache/flink/runtime/util/jartestprogram/NestedAnonymousInnerClass$A.class");
    Assert.assertTrue("Jar file for Anonymous Inner Class is not correct", validate(ans, out));
    out.delete();
}
Also used : File(java.io.File) NestedAnonymousInnerClass(org.apache.flink.runtime.util.jartestprogram.NestedAnonymousInnerClass) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

File (java.io.File)1 HashSet (java.util.HashSet)1 NestedAnonymousInnerClass (org.apache.flink.runtime.util.jartestprogram.NestedAnonymousInnerClass)1 Test (org.junit.Test)1