/*
 * The MIT License
 *
 * Copyright (c) 2015 Misakura.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package jp.gr.java_conf.kgd.example.blog.crossgenerics;

public class MeaninglessGenericsExample {

    // 引数の型をTにする意味がない
    public static <T> void printObject(T obj) {
        System.out.println(obj.toString());
    }

    // これと同じこと
    public static void printObject2(Object obj) {
        System.out.println(obj.toString());
    }

    // 上限境界があっても同じ
    public static <T extends Number> void printNumberAsInt(T number) {
        System.out.println(number.intValue());
    }

    // これも同じこと
    public static void printNumberAsInt2(Number number) {
        System.out.println(number.intValue());
    }
}

@@ -1736,11 +1736,326 @@
 );%0A    %7D
+%0A%0A    // %E6%88%BB%E3%82%8A%E5%80%A4%E3%82%92%E5%8F%97%E3%81%91%E5%8F%96%E3%82%8B%E5%81%B4%E3%81%AE%E5%9E%8B%E3%81%A7%E5%9E%8B%E6%8E%A8%E8%AB%96%E3%81%95%E3%81%9B%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AF%E3%81%9D%E3%82%8C%E3%81%AA%E3%82%8A%E3%81%AB%E6%84%8F%E5%91%B3%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%0A    // %E3%81%9F%E3%81%A0%E3%81%93%E3%82%8C%E3%81%AF%E6%9C%AC%E8%B3%AA%E7%9A%84%E3%81%AA%E5%9E%8B%E5%AE%89%E5%85%A8%E3%81%A7%E3%81%AF%E3%81%AA%E3%81%84%E3%81%A7%E3%81%99%E3%80%82%0A    // JavaFX%E3%81%AEFXMLLoader#load%E3%81%AF%E3%82%81%E3%81%A1%E3%82%83%E3%81%8F%E3%81%A1%E3%82%83%E5%8D%B1%E3%81%AA%E3%81%84%E3%81%A8%E6%80%9D%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%0A    public static %3CT%3E T newInstance(String className) throws ClassNotFoundException, IllegalAccessException, InstantiationException %7B%0A        return (T) Class.forName(className).newInstance();%0A    %7D
 %0A%7D%0A

add 型推論でキャストする場合を追加。