Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7103992

javac crash lowering string switch

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      An exception has occurred in the compiler (1.7.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.NullPointerException
      at com.sun.tools.javac.comp.Lower.visitStringSwitch(Lower.java:3456)
      at com.sun.tools.javac.comp.Lower.visitSwitch(Lower.java:3357)
      at com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:959)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2160)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
      at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:160)
      at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:3311)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2160)
      at com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:144)
      at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2619)
      at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2538)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:669)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2160)
      at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2283)
      at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:591)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2160)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2180)
      at com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:3650)
      at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1393)
      at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1271)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:870)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:829)
      at com.sun.tools.javac.main.Main.compile(Main.java:417)
      at com.sun.tools.javac.main.Main.compile(Main.java:331)
      at com.sun.tools.javac.main.Main.compile(Main.java:322)
      at com.sun.tools.javac.Main.compile(Main.java:76)
      at com.sun.tools.javac.Main.main(Main.java:61)

      REGRESSION. Last worked in version 7

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      import java.util. Scanner;
      public class question2 {
      public static void main(String [] args){
      Scanner kb = new Scanner(System.in);
      double num1;
      double num2;
      System.out.println("Enter s for area of a square");
      System.out.println("Enter t for area of a triangle");
      String input1 = kb.next();
      switch (input1){
      case ("s"):
      System.out.println("Please enter the side of the square:");
      num1 = kb.nextDouble();
      num1 = Math.pow(num1,2);
      System.out.println("The area of the square you entered = " + num1);
      break;
      case ("t"):
      System.out.println("Please enter the base of the triangle");
      System.out.print("Base = ");
      num1= kb.nextDouble();
      System.out.print("\n Hight = ");
      num2=kb.nextDouble();
      double num3 = .5 * num1* num2;
      System.out.println("\n The area of the triangle you entered = " + num3);
      break;
      default:
      System.out.println("Input is not correct");

      }
      }
      }


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darcy Joe Darcy
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: