< prev index next >

test/langtools/tools/javac/StringsInSwitch/OneCaseSwitches.java

Print this page


   1 /*
   2  * @test /nodynamiccopyright/
   3  * @bug 6827009 8078561
   4  * @summary Positive tests for strings in switch with few alternatives.
   5  * @compile/fail/ref=OneCaseSwitches.out -XDrawDiagnostics -source 6 OneCaseSwitches.java
   6  * @compile          OneCaseSwitches.java
   7  * @run main OneCaseSwitches
   8  * @author  Joseph D. Darcy
   9  */
  10 
  11 import java.lang.reflect.*;
  12 import java.lang.annotation.*;
  13 import java.util.*;
  14 import static java.lang.annotation.RetentionPolicy.*;
  15 
  16 public class OneCaseSwitches {
  17     @Retention(RUNTIME)
  18     @interface TestMeForNull {}
  19 
  20     @TestMeForNull
  21     public static int zeroCasesNoDefault(String s, Set<String> stringSet, boolean expected) {
  22         int failures = 0;
  23         switch(s) {
  24         }
  25         return failures;


   1 /*
   2  * @test /nodynamiccopyright/
   3  * @bug 6827009 8078561
   4  * @summary Positive tests for strings in switch with few alternatives.

   5  * @compile          OneCaseSwitches.java
   6  * @run main OneCaseSwitches
   7  * @author  Joseph D. Darcy
   8  */
   9 
  10 import java.lang.reflect.*;
  11 import java.lang.annotation.*;
  12 import java.util.*;
  13 import static java.lang.annotation.RetentionPolicy.*;
  14 
  15 public class OneCaseSwitches {
  16     @Retention(RUNTIME)
  17     @interface TestMeForNull {}
  18 
  19     @TestMeForNull
  20     public static int zeroCasesNoDefault(String s, Set<String> stringSet, boolean expected) {
  21         int failures = 0;
  22         switch(s) {
  23         }
  24         return failures;


< prev index next >