

def _test_compile(self, target_level, class_name, source_contents, platform_args=None):
    with temporary_dir(root_dir=os.path.abspath('.')) as tmpdir:
        with open(os.path.join(tmpdir, 'BUILD'), 'w') as f:
            f.write(dedent("\n        java_library(name='{target_name}',\n          sources=['{class_name}.java'],\n          platform='{target_level}',\n        )\n        ".format(target_name=os.path.basename(tmpdir), class_name=class_name, target_level=target_level)))
        with open(os.path.join(tmpdir, '{}.java'.format(class_name)), 'w') as f:
            f.write(source_contents)
        platforms = str({
            str(target_level): {
                'source': str(target_level),
                'target': str(target_level),
                'args': (platform_args or []),
            },
        })
        command = []
        command.extend(['--jvm-platform-platforms={}'.format(platforms), '--jvm-platform-default-platform={}'.format(target_level)])
        command.extend(source_contents.get_pants_compile_args())
        command.extend([tmpdir])
        pants_run = self.run_pants(command)
        return pants_run

dataset/ETHPy150Open pantsbuild/pants/tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/jvm_platform_integration_mixin.py JvmPlatformIntegrationMixin._test_compile/VarMisuse@202/314 `self`->`source_contents`