langtools/test/jdk/jshell/ClassesTest.java
changeset 41940 048d559e9da7
parent 41858 5843b57ce3a6
equal deleted inserted replaced
41939:4e7ef9667ea6 41940:048d559e9da7
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8145239
    26  * @bug 8145239 8129559 8080354
    27  * @summary Tests for EvaluationState.classes
    27  * @summary Tests for EvaluationState.classes
    28  * @build KullaTesting TestingInputStream ExpectedDiagnostic
    28  * @build KullaTesting TestingInputStream ExpectedDiagnostic
    29  * @run testng ClassesTest
    29  * @run testng ClassesTest
    30  */
    30  */
    31 
    31 
   253         assertDeclareWarn1("final interface C extends A { }",
   253         assertDeclareWarn1("final interface C extends A { }",
   254                 new ExpectedDiagnostic("jdk.eval.warn.illegal.modifiers", 0, 5, 0, -1, -1, Diagnostic.Kind.WARNING));
   254                 new ExpectedDiagnostic("jdk.eval.warn.illegal.modifiers", 0, 5, 0, -1, -1, Diagnostic.Kind.WARNING));
   255         assertActiveKeys();
   255         assertActiveKeys();
   256     }
   256     }
   257 
   257 
       
   258     public void classesIgnoredModifiersAnnotation() {
       
   259         assertEval("public @interface X { }");
       
   260         assertEval("@X public interface A { }");
       
   261         assertDeclareWarn1("@X static class B implements A { }",
       
   262                 new ExpectedDiagnostic("jdk.eval.warn.illegal.modifiers", 0, 9, 0, -1, -1, Diagnostic.Kind.WARNING));
       
   263         assertDeclareWarn1("@X final interface C extends A { }",
       
   264                 new ExpectedDiagnostic("jdk.eval.warn.illegal.modifiers", 0, 8, 0, -1, -1, Diagnostic.Kind.WARNING));
       
   265         assertActiveKeys();
       
   266     }
       
   267 
       
   268     public void classesIgnoredModifiersOtherModifiers() {
       
   269         assertEval("strictfp public interface A { }");
       
   270         assertDeclareWarn1("strictfp static class B implements A { }",
       
   271                 new ExpectedDiagnostic("jdk.eval.warn.illegal.modifiers", 0, 15, 0, -1, -1, Diagnostic.Kind.WARNING));
       
   272         assertDeclareWarn1("strictfp final interface C extends A { }",
       
   273                 new ExpectedDiagnostic("jdk.eval.warn.illegal.modifiers", 0, 14, 0, -1, -1, Diagnostic.Kind.WARNING));
       
   274         assertActiveKeys();
       
   275     }
       
   276 
   258     public void ignoreModifierSpaceIssue() {
   277     public void ignoreModifierSpaceIssue() {
   259         assertEval("interface I { void f(); } ");
   278         assertEval("interface I { void f(); } ");
   260         // there should not be a space between 'I' and '{' to reproduce the failure
   279         // there should not be a space between 'I' and '{' to reproduce the failure
   261         assertEval("class C implements I{ public void f() {}}");
   280         assertEval("class C implements I{ public void f() {}}");
   262         assertClasses(clazz(KullaTesting.ClassType.CLASS, "C"), clazz(KullaTesting.ClassType.INTERFACE, "I"));
   281         assertClasses(clazz(KullaTesting.ClassType.CLASS, "C"), clazz(KullaTesting.ClassType.INTERFACE, "I"));