Towards Benchmarking Design Pattern Detection Under Obfuscation: Reproducing and Evaluating Attention-Based Detection Method
摘要
This paper investigates the semantic robustness of attention- based classifiers for design pattern detection, particularly focusing on their reliance on structural and behavioral semantics. We reproduce the state-of-the-art attention-based design pattern detection approach using learning based classifiers–and evaluate its performance under obfuscation. To this end, we curate an obfuscated version of the original Java Corpus used in the attention-based approach, where the name-based syntactic identifiers such as class names, method names and string literals in print statements and comment blocks are replaced while preserving control flow, inheritance and code logic. Our findings reveal that these trained classifiers depend significantly on superficial syntactic features, leading to substantial misclassification when such cues are removed through obfuscation. This work highlights the need for more robust detection tools capable of capturing deeper semantic meanings in source code, as well as the need for semantically grounded benchmark. We propose our curated obfuscated java subset (containing 34 Java source files) as a reusable proof-of-concept benchmark for evaluating state-of-the-art design pattern detectors on their true semantic generalization capabilities.