harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Beyer" <ndbe...@apache.org>
Subject Re: svn commit: r703715 - in /harmony/enhanced/classlib/trunk/modules/archive/src: main/java/org/apache/harmony/archive/util/Util.java test/java/org/apache/harmony/archive/util/UtilTest.java
Date Fri, 24 Oct 2008 02:57:36 GMT
That does make sense. I keep forgetting that they are separate like
that. So, this should start working if the tests are run as part of
the bootclasspath.

The methods could actually be private, they are only used within the
Util class itself. I just dropped them, so that they weren't exposed
anymore, but could still be tested.

-Nathan

On Thu, Oct 23, 2008 at 8:59 AM, Sian January
<sianjanuary@googlemail.com> wrote:
> I think this is happening because we run the tests with main classes
> on the bootclasspath and test classes on the normal classpath.  I can
> also reproduce the error on the RI with a simple test case if I run
> with that classpath setup so I think it's probably behaving correctly.
>
> Does that sound right?
>
> Thanks,
>
> Sian
>
>
> 2008/10/23 Sian January <sianjanuary@googlemail.com>:
>> This also fails for me on the IBM VME, although like Nathan I can't
>> see why.  Do we have any other tests like this (i.e. tests in the same
>> package but a different folder that are calling package-private
>> methods)?
>>
>>
>> 2008/10/23 Nathan Beyer <ndbeyer@apache.org>:
>>> This code compiles perfectly, works fine on a Windows RI and Mac OS X,
>>> but blows up when run on DRLVM. I haven't tried on the IBM VME.
>>>
>>> Any thoughts on why this would be an issue? Those methods shouldn't
>>> have to be public, the test is in the same package, so it's
>>> accessible. I've been trying to isolate it, but haven't hit it yet.
>>>
>>> -Nathan
>>>
>>> On Wed, Oct 22, 2008 at 1:38 AM, chunrong lai <chunronglai@gmail.com> wrote:
>>>>  I notice that the commit change some method descriptors:
>>>>
>>>> -    public static final char toASCIIUpperCase(char c) {
>>>> +    static final char toASCIIUpperCase(char c) {
>>>>
>>>> -    public static final byte toASCIIUpperCase(byte b) {
>>>> +    static final byte toASCIIUpperCase(byte b) {
>>>>
>>>>  which breaks the
>>>> org.apache.harmony.archive.util.UtilTest.testToASCIIUpperCaseByte
>>>> and org.apache.harmony.archive.util.UtilTest.testToASCIIUpperCaseChar in
>>>> integrity testing,
>>>>  with error message below, adding the "public" back just make the test cases
>>>> pass:
>>>>
>>>>  Test:  testToASCIIUpperCaseByte Class:
>>>> org.apache.harmony.archive.util.UtilTest      java.lang.IllegalAccessError:
>>>> org/apache/harmony/archive/util/Util.toASCIIUpperCase(B)B while resolving
>>>> constant pool entry at index 71 in class
>>>> org/apache/harmony/archive/util/UtilTest   at
>>>> java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
>>>>
>>>>
>>>>
>>>>
>>>> On Sun, Oct 12, 2008 at 3:28 AM, <ndbeyer@apache.org> wrote:
>>>>
>>>>> Author: ndbeyer
>>>>> Date: Sat Oct 11 12:28:08 2008
>>>>> New Revision: 703715
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=703715&view=rev
>>>>> Log:
>>>>> remove unused methods and their tests
>>>>>
>>>>> Modified:
>>>>>
>>>>>  harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/util/Util.java
>>>>>
>>>>>  harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/util/UtilTest.java
>>>>>
>>>>> Modified:
>>>>> harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/util/Util.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/util/Util.java?rev=703715&r1=703714&r2=703715&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> ---
>>>>> harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/util/Util.java
>>>>> (original)
>>>>> +++
>>>>> harmony/enhanced/classlib/trunk/modules/archive/src/main/java/org/apache/harmony/archive/util/Util.java
>>>>> Sat Oct 11 12:28:08 2008
>>>>> @@ -42,40 +42,6 @@
>>>>>         throw new NullPointerException();
>>>>>     }
>>>>>
>>>>> -    public static byte[] toASCIILowerCase(byte[] buf) {
>>>>> -        int len = buf.length;
>>>>> -        byte[] buffer = new byte[len];
>>>>> -        for (int i = 0; i < len; i++) {
>>>>> -            byte b = buf[i];
>>>>> -            if ('A' <= b && b <= 'Z') {
>>>>> -                buffer[i] = (byte) (b + ('a' - 'A'));
>>>>> -            } else {
>>>>> -                buffer[i] = b;
>>>>> -            }
>>>>> -        }
>>>>> -        return buffer;
>>>>> -    }
>>>>> -
>>>>> -    public static final boolean equalsIgnoreCase(String s1, String s2)
{
>>>>> -        if (s1 == s2) {
>>>>> -            return true;
>>>>> -        }
>>>>> -
>>>>> -        if (s1 == null || s2 == null || s1.length() != s2.length())
{
>>>>> -            return false;
>>>>> -        }
>>>>> -
>>>>> -        char c1, c2;
>>>>> -
>>>>> -        for (int i = 0; i < s1.length(); i++) {
>>>>> -            if ((c1 = s1.charAt(i)) != (c2 = s2.charAt(i))
>>>>> -                    && toASCIIUpperCase(c1) != toASCIIUpperCase(c2))
{
>>>>> -                return false;
>>>>> -            }
>>>>> -        }
>>>>> -        return true;
>>>>> -    }
>>>>> -
>>>>>     public static final boolean equalsIgnoreCase(byte[] buf1, byte[]
buf2)
>>>>> {
>>>>>         if (buf1 == buf2) {
>>>>>             return true;
>>>>> @@ -96,21 +62,14 @@
>>>>>         return true;
>>>>>     }
>>>>>
>>>>> -    public static final char toASCIILowerCase(char c) {
>>>>> -        if ('A' <= c && c <= 'Z') {
>>>>> -            return (char) (c + ('a' - 'A'));
>>>>> -        }
>>>>> -        return c;
>>>>> -    }
>>>>> -
>>>>> -    public static final char toASCIIUpperCase(char c) {
>>>>> +    static final char toASCIIUpperCase(char c) {
>>>>>         if ('a' <= c && c <= 'z') {
>>>>>             return (char) (c - ('a' - 'A'));
>>>>>         }
>>>>>         return c;
>>>>>     }
>>>>>
>>>>> -    public static final byte toASCIIUpperCase(byte b) {
>>>>> +    static final byte toASCIIUpperCase(byte b) {
>>>>>         if ('a' <= b && b <= 'z') {
>>>>>             return (byte) (b - ('a' - 'A'));
>>>>>         }
>>>>>
>>>>> Modified:
>>>>> harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/util/UtilTest.java
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/util/UtilTest.java?rev=703715&r1=703714&r2=703715&view=diff
>>>>>
>>>>> ==============================================================================
>>>>> ---
>>>>> harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/util/UtilTest.java
>>>>> (original)
>>>>> +++
>>>>> harmony/enhanced/classlib/trunk/modules/archive/src/test/java/org/apache/harmony/archive/util/UtilTest.java
>>>>> Sat Oct 11 12:28:08 2008
>>>>> @@ -53,20 +53,6 @@
>>>>>         }
>>>>>     }
>>>>>
>>>>> -    private void assertEqualsBytes(byte[] expected, byte[] actual) {
>>>>> -        assertEquals(expected.length, actual.length);
>>>>> -        for (int i = 0; i < expected.length; i++) {
>>>>> -            assertEquals(expected[i], actual[i]);
>>>>> -        }
>>>>> -    }
>>>>> -
>>>>> -    public void testToASCIILowerCase() {
>>>>> -        assertEqualsBytes(ASCII_ALPHABET_LC_BYTES, Util
>>>>> -                .toASCIILowerCase(ASCII_ALPHABET_UC_BYTES));
>>>>> -        assertEqualsBytes(ASCII_ALPHABET_LC_BYTES, Util
>>>>> -                .toASCIILowerCase(ASCII_ALPHABET_LC_BYTES));
>>>>> -    }
>>>>> -
>>>>>     public void testToASCIIUpperCaseByte() {
>>>>>         for (int i = 0; i < ASCII_ALPHABET_LC_BYTES.length; i++) {
>>>>>             assertEquals(ASCII_ALPHABET_UC_BYTES[i], Util
>>>>> @@ -78,17 +64,6 @@
>>>>>         }
>>>>>     }
>>>>>
>>>>> -    public void testToASCIILowerCaseChar() {
>>>>> -        for (int i = 0; i < ASCII_ALPHABET_UC.length(); i++) {
>>>>> -            assertEquals(ASCII_ALPHABET_LC.charAt(i), Util
>>>>> -                    .toASCIILowerCase(ASCII_ALPHABET_UC.charAt(i)));
>>>>> -        }
>>>>> -        for (int i = 0; i < ASCII_ALPHABET_LC.length(); i++) {
>>>>> -            assertEquals(ASCII_ALPHABET_LC.charAt(i), Util
>>>>> -                    .toASCIILowerCase(ASCII_ALPHABET_LC.charAt(i)));
>>>>> -        }
>>>>> -    }
>>>>> -
>>>>>     public void testToASCIIUpperCaseChar() {
>>>>>         for (int i = 0; i < ASCII_ALPHABET_LC.length(); i++) {
>>>>>             assertEquals(ASCII_ALPHABET_UC.charAt(i), Util
>>>>> @@ -100,14 +75,6 @@
>>>>>         }
>>>>>     }
>>>>>
>>>>> -    public void testEqualsIgnoreCaseStringString() {
>>>>> -        final String s1 = ASCII_ALPHABET_LC;
>>>>> -        final String s2 = ASCII_ALPHABET_UC;
>>>>> -        assertTrue(Util.equalsIgnoreCase(s1, s1));
>>>>> -        assertTrue(Util.equalsIgnoreCase(s1, s2));
>>>>> -        assertTrue(Util.equalsIgnoreCase(s2, s2));
>>>>> -    }
>>>>> -
>>>>>     public void testEqualsIgnoreCaseByteArrayByteArray() {
>>>>>         assertTrue(Util.equalsIgnoreCase(ASCII_ALPHABET_LC_BYTES,
>>>>>                 ASCII_ALPHABET_LC_BYTES));
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>>
>> --
>> Unless stated otherwise above:
>> IBM United Kingdom Limited - Registered in England and Wales with number 741598.
>> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
>>
>
>
>
> --
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
>

Mime
View raw message