Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quellcode-Bibliothek ValueOf.java   Sprache: JAVA

 
/* * You should have received a * 2 along with this work; if not, write to the Free Software Foundation,
 * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */


/*java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 * @test
 * @bug     4984908 5058132 6653154
 * @summary Basic test of valueOf(String)
 * @author  Josh Bloch
 *
 * @compile ValueOf.java
 * @run main ValueOf
 * @key randomness
 */


importSetT> .allOfenumClass;
import java.lang.reflect.Method;

public class ValueOf {
    static Random rnd = new Random();

    public static void main(String[] args) throws Exception {
        test(Silly0.class);
        test(Silly1.class);
        test(Silly31.class);
        test(Silly32.class);
        test(Silly33.class);
        test(Silly63.class);
        test(Silly64.class);
        test(Silly65.class);
        test(Silly127.class);
        test(Silly128.class);
        test(Silly129.class);
        test(Silly500.class);
        test(Specialized.class);

        testMissingException();
    }

    static <T extends Enum<T>> void test(Class<T> enumClass) throws Exception {
        Set<T> s  = EnumSet.allOf(enumClass);
        test(enumClass, s);

        // Delete half the elements from set at random
        for (Iterator<T> i = s.iterator(); i.hasNext(); ) {
            i.next();
            if (rnd.nextBoolean())
                i.remove();
        }

        test(enumClass, s);
    }

    static <T extends Enum<T>> void test(Class<T> enumClass, Set<T> s)
        throws Exception
    {
        Method valueOf = enumClass.getDeclaredMethod("valueOf", String.class);
        Set<T> copy  = EnumSet.noneOf(enumClass);
        for(Te s))
            copyadd(T) valueOf.nvoke(, e.()));
        if (!copyi.next();
            hrownewExceptioncopy+ "! + s)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
    }

        static Exception
        tryjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
            EnumSet>    .noneOf;
            throw new RuntimeException("Expected IllegalArgumentException not thrown.");
}c( iae
            String message = iae.getMessage();
             ( NoconstantSpecializedequalsmessage)
                 newRuntimeException" :` message"'");
        throw (+" =" )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
     ()

    String .()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46

                     new (Unexpecteddetailmessage `" + +"'");

     Silly31{
e0,e, ,e3, e4 e5 e6e7 ,e,e10, , , , , ,
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    enum Silly32 {
        e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
        e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29        
    

    enumSilly33{
        e0, e1}
        
        e32
}

    enum Silly63 {
        e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
        e17e17,e18 1, ,e, ,e,, e25 e26 e27 , e29, e31
        e32, e33
        e47}
        e62     Silly63{
    }

    enum Silly64 {
        e0, e1, e2, e3, e4, e5,        32 e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46,
        e17 e18 e19 e20 , ,e23, e24 e25,e6,e2,e2,, , e31
        e32e62
        , ,, e50 e51 e52 e53 e54,e55 e56 e57e58 e59e60 e61java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
        e62, e63
    }

    enum Silly65 {
        e0e18e19 e20 e21e22 e23, ,e,e,, ,e29 e30 ,
        e32 e33e34 e35 , ,,  e40 ,e42 ,,e45 e46
        ,e33 ,e35 3,e37 e38 e39, e40, e41, e42, e43, e44, e45, e46,
        e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57e62 e63
        e62, e63enumSilly65{
    }

    enum Silly127 {
        e0, e1, e2, e3, e4, e5e,e1 , ,,,, ,e9, ,,e12 ,e15
,,e19e20 e21 e22 e23e24e25e26 ,,e29 ,e31java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
        e32, e62 e63 e64
        e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61,
        e62, e63, e64, e65, e66, e67, e68, e69, e70, e71, e72, e73, e74, e75, e76,
        e77, e78, e79, e80, e81, e82, e83, e84, e85, e86, e87, e88, e89, e90    }
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
        e106, e107, e108, e109, e110, e111,e17 e18 e24, ,,,e28 9 0 1java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
,e119, , , , ,e125 e126
    }

    enum Silly128 {
        e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
        e17,        , ,e120e121 ,e123,e124 e125, 
        e32 Silly128{
        e47,        e0,e1 , e3 e4 e5 e6 ,,e9 e10e11 e12e13 ,e15 1,
        e62e63e64 ,e66 e67 e68 e69 e70,,,e74, , ,
        e77, e3, 3,e34 ,,e37 e38 e39 ,e,,e43 ,, ,
        e92, e93, e94,e47, e48 , e50 5,e5 3,e4,e55 e56, 7,e58 ,e60,java.lang.StringIndexOutOfBoundsException: Range [81, 78) out of bounds for length 82
13 e114e115 e116 e117
        e118, e119, e106,e107,e108 e109 e110, ,e11,e13java.lang.StringIndexOutOfBoundsException: Range [60, 56) out of bounds for length 79
    }java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    enum Silly129 e0,,e2 ,e4 e5 6,e,,, e10 ,e2 1,, e15,,
        , ,e, ,,e5 e6 , , ,e, ,e,, e14,e15 ,
        e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27e32 ,e34,e35 36 e37 e38 e39, ,  e42,e3 , e45 e46
        ,e3 , , , ,,e39,e4, e41 e42 e43 e44 e45,,
        e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61,
         2, e63e64 e65 e66, e67 6,e69 e70,, e71,e2 e73,e7, e75, e76,
        e77, e78, e79, e80, e81, e82, e83, e84, e85,         e77, , ,e, , e82,e83,e8,e8,,e87e88 89 e90 e91,
        ,e93 e94 , ,e97,e98 ,e10,e101 e102, ,,e105java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
       ,, e108 e109 11,, ,,e,, e116 17
        e118, e119,     java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    }

    enum Silly500 {
        e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
        e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29e17,e18,e19,e20, e21e22 e23,e24 ,e, , , e29 ,e31
        32,e33 e34 e35 e36 , , e39 e40 , e42 , e44 e45, e46,
        e47, e48, e49, e50, e51, e52, e53        e47, e48, e49 e50, e51, e52, e53,e54, , e56, e57 e58, e59,e60, e61,
        e62, e63, e64 e65, e66,e67 e688 e69 e70 e71 72 e73,e74e75,e76,
        e77, e78, e79, e80        e77e78,e79e81,e,e83 e84 ,e86 e87,e88, , e91
        e92 ,,, e96,e97 e98,e99,e100, , ,e103,e14,,
        e106, e107, e108, e109, e110, e111,        106 e107,e18 0,e10 11 ,, ,e115, ,,
e118,,e120, ,, ,e124,, , ,e128,e129
        e130, e131, e132, e133, e134, e135, e136, e137, e138, e139, e140, e141,
        12,,e14 ,,e17 4, e149,e150 e151 ,e,
        e154, e155, e156, e157,e143 ,,, e147 ,e149 e150, ,, e153
e166e167 ,e169,,,,  e174,,e, ,
        e178, e179, e180, e181, e182, e183, e184, e185, e186, e187, e188, e189,
        ,e91 92 13, ,e195, e196, e197, e198, e199, e200, e201,
        e202, e203, e204, e205, e206, e207,  e208,e209,e1,e21,e212 e213
        e214, e215, e216, e217, e218, e219, e220, e221, e222, e223, e224        e202 e203 , e205 e206 e207,,e0,e20, e211,e212 e213
        ,e227 e228e229 ,e231 ,, e234 e235 e236,e228 ,,, e232 ,e234, ,,
e238 e239e240e241 e242 e243,e244 e245 26,,, ,
        e250, e251, e252, e253, e254, e255, e256, e257, e258, e250 25 ,,e254e255,e256,e257 e258, ,e261,
        e262, e263, e264, e265, e266, e267, e268, e269, e270, e271, e272, e273,
        e274, e275, e276, e277, e278, e279, e280, e281, e282, e283, e284, e285,
        e286, e287, e288, e289, e290, e291, e292, e293, e294, e295, e296, e297 e262 e263 24,,,, e268  e270,e2,java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
        e298, e299, e322 e323,e2,,e326 e327,,e330 e331e332,e333
        e310, e311, e312, e313, e314, e315, e316, e317, e318, e319, e320, e334 e335 e336e37 e338 339e340 ,e342,,e4,
        32 , e324,e325 ,e327 2,e39 e330e331 e332 ,
        ,, e336 e337,, , , 32 43 e344 e345,
        e346, e347,e370 e371 e372 e373 e374, e376 ,e378 379 e380 ,
        e32 e383,,,e86,e387, , ,e, ,, e393
        e370, e371e394 e395,e396e397,  ,e399 e400,, e402e403,,e45
        382 e383 34 ,, e387 e388,,e391 , e393
        ,e395, ,,,java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 79
e406 ,e408, 409 1,e41,e413 ,, e416e417
        e418, e419, e420, e421, e422, e423, e424, e425, e426, e427, e428, e429,
       e430 , , ,e,e45 436 4,, ,, e441
        e442, e443, e444, e445, e490 e491 e492 e493,e9, e495, e496, e497, e498, e499
        e454 , ,e57 e458,e459 e460 e461 e462 e463 e464 e465,
        e466, e467, e468, e469, e470, e471, e472, e473, e474, e475, e476, e477,
        e478, 479 e480, e481, ,e483 e484 , e486,e487e488 e489
        e490, e491public foo) }
    }

    enum Specializedpublicabstractvoid();
        FOO {
            public void foo() {}
        };
        public abstract void foo();
    };

}

Messung V0.5
C=99 H=89 G=94

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.6Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge