langtools/test/tools/javac/tree/8067914/NukeExtraCast.java
author mcimadamore
Fri, 09 Jan 2015 15:51:20 +0000
changeset 28339 fa0685d84b74
child 30730 d3ce7619db2c
permissions -rw-r--r--
8067914: Redundant type cast nodes in AST (follow up from JDK-8043741) Summary: Workaround for redundant (but harmless) synthetic cast generated in TransTypes Reviewed-by: mcimadamore Contributed-by: srikanth.adayapalam@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28339
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     1
/*
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     4
 *
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     8
 *
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    14
 *
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    18
 *
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    21
 * questions.
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    22
 */
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    23
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    24
/*
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    25
 * @test
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    26
 * @bug 8067914
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    27
 * @summary Redunant type cast nodes in AST (follow up from JDK-8043741)
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    28
 * @library /tools/lib
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    29
 * @build ToolBox
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    30
 * @run compile -XD-printsource T8067914.java
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    31
 * @run main NukeExtraCast
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    32
 */
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    33
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    34
import java.nio.file.Path;
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    35
import java.nio.file.Paths;
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    36
import java.util.List;
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    37
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    38
public class NukeExtraCast {
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    39
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    40
    public static void main(String[] args) throws Exception {
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    41
        ToolBox tb = new ToolBox();
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    42
        Path path1 = Paths.get(ToolBox.testClasses, "E.java");
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    43
        List<String> file1 = tb.readAllLines(path1);
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    44
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    45
        Path path2 = Paths.get(ToolBox.testSrc, "E.out");
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    46
        List<String> file2 = tb.readAllLines(path2);
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    47
        tb.checkEqual(file1, file2);
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    48
    }
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    49
fa0685d84b74 8067914: Redundant type cast nodes in AST (follow up from JDK-8043741)
mcimadamore
parents:
diff changeset
    50
}