test/compiler/compilercontrol/share/method/SignatureType.java

Print this page
rev 9056 : [mq]: existing-directives

@@ -27,10 +27,11 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.util.Arrays;
+import java.util.regex.Pattern;
 
 /**
  * This class represents a signature of the method
  */
 public class SignatureType extends MethodElementType {

@@ -64,11 +65,12 @@
     @Override
     public void setElement(String element) {
         if (element.isEmpty()) {
             setPattern(MethodDescriptor.PatternType.ANY);
         } else {
-            super.setElement(element);
+            this.element = element;
+            this.regexp = element;
         }
     }
 
     @Override
     public boolean isValid() {

@@ -146,6 +148,14 @@
             default:
                 throw new IllegalArgumentException("ERROR: wrong pattern type "
                         + patternType);
         }
     }
+
+    @Override
+    public String getRegexp() {
+        if ("\\(.*\\).*".equals(regexp)) {
+            return regexp;
+        }
+        return Pattern.quote(regexp);
+    }
 }