changeset 7569:1fc04d7d379f

Fix broken test, synthetic method should be skipped.
author henryjen
date Wed, 06 Mar 2013 19:20:58 -0800
parents 73b2f833427c
children f0063d6f7bfd
files test/java/lang/StringBuffer/TestSynchronization.java
diffstat 1 files changed, 3 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/lang/StringBuffer/TestSynchronization.java	Wed Mar 06 18:23:07 2013 -0800
+++ b/test/java/lang/StringBuffer/TestSynchronization.java	Wed Mar 06 19:20:58 2013 -0800
@@ -79,23 +79,6 @@
                  */ false);
     }
 
-    private static boolean isWhiteListed(Method m) {
-        // Following two methods return Stream, and user is expected to
-        // synchronize manually to ensure no modifiication should happen when
-        // using the returned Stream.
-        Object[][] list = {{ "chars", new Class[]{} },
-                           { "codePoints", new Class[]{} }};
-
-        for (int i = 0; i < list.length; i++) {
-            String name = m.getName();
-            if (name.equals((String) list[i][0]) &&
-                Arrays.equals(m.getParameterTypes(), (Object[]) list[i][1])) {
-                    return true;
-            }
-        }
-        return false;
-    }
-
     /**
      * Test all the public, unsynchronized methods of the given class. If
      * isSelfTest is true, this is a self-test to ensure that the test program
@@ -113,9 +96,9 @@
         // the right thing.
         List<Method> methods = Arrays.asList(aClass.getDeclaredMethods());
         for (Method m : methods) {
-            // some methods are designed not to be synchronized
-            if (isWhiteListed(m)) {
-                // System.out.println(m.toString() + " is white listed.");
+            // skip synthetic methods, like default interface methods and lambdas
+            if (m.isSynthetic()) {
+                // System.out.println(m.toString() + " is synthetic, ignore.");
                 continue;
             }
             int modifiers = m.getModifiers();