]> source.dussan.org Git - aspectj.git/commitdiff
Progress on: empty catch block warning - updates to test cases with empty catch blocks
authoracolyer <acolyer>
Fri, 10 Feb 2006 17:59:13 +0000 (17:59 +0000)
committeracolyer <acolyer>
Fri, 10 Feb 2006 17:59:13 +0000 (17:59 +0000)
13 files changed:
tests/src/org/aspectj/systemtest/ajc10x/ajc10x-tests.xml
tests/src/org/aspectj/systemtest/ajc11/ajc11-tests.xml
tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
tests/src/org/aspectj/systemtest/ajc150/ataspectj/annotationgen.xml
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
tests/src/org/aspectj/systemtest/aspectpath/aspectpath-tests.xml
tests/src/org/aspectj/systemtest/design/designtest.xml
tests/src/org/aspectj/systemtest/incremental/model/incremental-model-tests.xml
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
tests/src/org/aspectj/systemtest/pre10x/pre10x-tests.xml

index 0c085c7f0be88e912ebd4715aa9fd6f3be6e8d21..8076d2e259162d406515c6428862c0f56ab38165 100644 (file)
     <ajc-test dir="new" pr="248"
       title=", PR#249, PR#250 advice on constructor sites"
       keywords="from-resolved_10x">
-        <compile files="NewSiteAdvice.java"/>
+        <compile files="NewSiteAdvice.java" options="-Xlint:ignore"/>
         <run class="NewSiteAdvice"/>
     </ajc-test>
 
     <ajc-test dir="new/extraThrows" pr="259"
       title="throws Exception clause is unnecessarily added to Driver.main method"
       keywords="from-resolved_10x">
-        <compile files="Driver.java"/>
+        <compile files="Driver.java" options="-Xlint:ignore"/>
         <run class="Driver"/>
     </ajc-test>
 
 
     <ajc-test dir="new" pr="318" title="Handlers problem"
       keywords="from-resolved_10x">
-        <compile files="PR318.java"/>
+        <compile files="PR318.java" options="-Xlint:ignore"/>
         <run class="PR318"/>
     </ajc-test>
 
 
     <ajc-test dir="new" title="Basic test for cflow pointcuts [eachcflow]"
       keywords="from-resolved_10x">
-        <compile files="CFlowPoints.java"/>
+        <compile files="CFlowPoints.java" options="-Xlint:ignore"/>
         <run class="CFlowPoints"/>
     </ajc-test>
 
     <ajc-test dir="new" pr="114"
       title=", PR#115 checks the ordering of catch clauses"
       keywords="from-resolved_10x">
-        <compile files="OrderOfCatches.java"/>
+        <compile files="OrderOfCatches.java" options="-Xlint:ignore"/>
         <run class="OrderOfCatches"/>
     </ajc-test>
 
     <ajc-test dir="new"
       title="exceptions thrown and caught in advice, particularly try+proceed"
       keywords="from-resolved_10x">
-        <compile files="TryAndProceed.java"/>
+        <compile files="TryAndProceed.java" options="-Xlint:ignore"/>
         <run class="TryAndProceed"/>
     </ajc-test>
 
     <ajc-test dir="new/packageAccessPR556" pr="556"
       title="aspects should get package access outside the file"
       keywords="from-resolved_10rc3">
-        <compile files="base1/p/C1.java,base2/p/C2.java"/>
+        <compile files="base1/p/C1.java,base2/p/C2.java" options="-Xlint:ignore"/>
         <run class="p.C1"/>
     </ajc-test>
 
     <ajc-test dir="new"
       title="changing this in around's proceed reported by Rich Price"
       keywords="from-resolved_104">
-        <compile files="AroundChangeThis.java" options="-1.4"/>
+        <compile files="AroundChangeThis.java" options="-1.4 -Xlint:ignore"/>
         <run class="AroundChangeThis"/>
     </ajc-test>
 
index 1ca899087f3c1866725e34cfcd610a085cc22f3d..61f80848cc37023e6133d19cca08d9ac8a4914d9 100644 (file)
 
     <ajc-test dir="bugs" pr="34925"
       title="declare soft and throw statements">
-        <compile files="ConvertToUnchecked.java"/>
+        <compile files="ConvertToUnchecked.java" options="-Xlint:ignore"/>
         <run class="ConvertToUnchecked"/>
     </ajc-test>
     
     
     <ajc-test dir="bugs" pr="36564"
       title="Internal compiler error with thisJoinPoint.getStaticPart()">
-        <compile files="tjpStaticPart/Test.java,tjpStaticPart/Exceptions.java"/>
+        <compile files="tjpStaticPart/Test.java,tjpStaticPart/Exceptions.java" options="-Xlint:ignore"/>
         <run class="tjpStaticPart.Test"/>
     </ajc-test>
     
     <ajc-test dir="bugs" pr="29665"
       title="Inconsistant stack height with around">
-        <compile files="StackError.java"/>
+        <compile files="StackError.java" options="-Xlint:ignore"/>
         <run class="StackError"/>
     </ajc-test>
     
index 8f2a5528edd5da4e343c7ed63e78670749c91e9d..096a7daa948c0bc8b0f31f4d859bbca5c814f81a 100644 (file)
 
     <ajc-test dir="bugs" pr="44586"
       title="After throwing advice on ctors doesn't execute for inter-type decl field inits">
-        <compile files="AfterThrowingCtor.java">
+        <compile files="AfterThrowingCtor.java" options="-Xlint:ignore">
         </compile>
                <run class="AfterThrowingCtor"/>
     </ajc-test>
     
   <ajc-test dir="bugs" pr="34206"
       title="before():execution(new(..)) does not throw NoAspectBoundException">
-        <compile files="ErroneousExceptionConversion1.java">
+        <compile files="ErroneousExceptionConversion1.java" options="-Xlint:ignore">
         </compile>
         <run class="ErroneousExceptionConversion1"/>
     </ajc-test>
index 54f6047032485e162c3408c399e7aeac953609c4..681f033c756ea6ea7c1382f1cc81f26ac0dd1693 100644 (file)
                        <message kind="error" line="10" text="The method ancientJ() from the type AncientFoo is not visible"/>
                        <message kind="error" line="11" text="The method clone() from the type Object is not visible"/>
                        <message kind="error" line="12" text="Cannot make a static reference to the non-static method clone() from the type Object"/>
+                       <message kind="warning" line="14" text="Exception swallowed in catch block"/>
+                       <message kind="warning" line="29" text="Exception swallowed in catch block"/>
                </compile>
        </ajc-test>
        
index 6a343d5f1fc1e1421a68f5f08a04477de9984485..c29a22fbde5076fd30f54a8361612050b83a3b97 100644 (file)
@@ -51,7 +51,9 @@
                <message kind="warning" line="17" text="aa * *(..) throws Exception"/>
                <message kind="warning" line="37" text="aa call void m() throws Exception"/>
                <message kind="warning" line="38" text="aa call void m() throws Exception"/>
-        </compile>
+            <message kind="warning" line="37" text="Exception swallowed in catch block"/>
+            <message kind="warning" line="38" text="Exception swallowed in catch block"/>
+       </compile>
         <run class="pr119749">
             <stdout>
              <line text="execution(void pr119749.C.m()): execMe[Me]"/>
        </ajc-test>
        
        <ajc-test dir="java5/reflection" title="reflection on itds">
-               <compile files="InterTypeDeclarations.aj,ReflectOnCodeStyleITDs.java" options="-1.5"></compile>
+               <compile files="InterTypeDeclarations.aj,ReflectOnCodeStyleITDs.java" options="-1.5 -Xlint:ignore"></compile>
                <run class="ReflectOnCodeStyleITDs" classpath="../lib/bcel/bcel.jar">
                  <stdout>
                        <line text="public C.new(int, int, int)"/>
        </ajc-test>
 
        <ajc-test dir="java5/reflection" title="reflection on @DeclareParents">
-               <compile files="AtAspectJDeclareParents.aj,ReflectOnAtAspectJDeclareParents.java" options="-1.5"></compile>
+               <compile files="AtAspectJDeclareParents.aj,ReflectOnAtAspectJDeclareParents.java" options="-1.5 -Xlint:ignore"></compile>
                <run class="ReflectOnAtAspectJDeclareParents" classpath="../lib/bcel/bcel.jar">
                  <stdout>
                    <line text="declare parents : C implements I"/>
        </ajc-test>
        
        <ajc-test dir="compatibility/case2" title="generating code for a 1.2.1 runtime - 2">
-               <compile files="TrackingErrors.aj,A.java" options="-Xajruntimetarget:1.2"/>
+               <compile files="TrackingErrors.aj,A.java" options="-Xajruntimetarget:1.2 -Xlint:ignore"/>
                <run class="A" classpath="../lib/aspectj/lib/aspectjrt121.jar"/>
        </ajc-test>
                
        </ajc-test>
 
        <ajc-test dir="bugs150" title="declare soft and exclusions" pr="103097">
-               <compile files="Pr103097.aj"/>
+               <compile files="Pr103097.aj" options="-Xlint:ignore"/>
                <run class="Pr103097"/>
        </ajc-test>
                    
     </ajc-test>
 
     <ajc-test dir="decs" pr="42743" title="declare soft w. catch block">
-        <compile files="VerifyError.aj">
+        <compile files="VerifyError.aj" options="-Xlint:ignore">
         </compile>
         <run class="VerifyError"/>
     </ajc-test>
     </ajc-test>
 
     <ajc-test dir="bugs150" pr="83645" title="pertypewithin({interface}) illegal field modifier">
-        <compile files="PR83645.java"/>
+        <compile files="PR83645.java" options="-Xlint:ignore"/>
         <run class="PR83645"/>
     </ajc-test>
     
     <!-- end of atOverride tests with ITDs -->
 
     <ajc-test dir="../docs/dist/doc/examples/introduction" title="introduction sample" vm="1.5">
-        <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5"/>
+        <compile files="CloneablePoint.java,ComparablePoint.java,HashablePoint.java,Point.java" options="-1.5 -Xlint:ignore"/>
     </ajc-test>
 
     <ajc-test dir="java5/varargs" title="varargs in constructor sig" vm="1.5">
    <!-- ======================================================================================= -->
     
    <ajc-test dir="java5/pertypewithin" title="basic ptw test">
-       <compile files="A.java,B.java,C.java,D.java,Main.java,X.java"/>
+       <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/>
        <run class="p.A">
            <stderr>
                <line text="hi from A"/>
    </ajc-test> 
 
    <ajc-test dir="java5/pertypewithin" title="ptw hasAspect">
-       <compile files="A.java,B.java,C.java,D.java,Main.java,X.java"/>
+       <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/>
        <run class="p.B">
            <stderr>
                <line text="hi from B"/>
    </ajc-test> 
    
     <ajc-test dir="java5/pertypewithin" title="ptw aspectOf">
-       <compile files="A.java,B.java,C.java,D.java,Main.java,X.java"/>
+       <compile files="A.java,B.java,C.java,D.java,Main.java,X.java" options="-Xlint:ignore"/>
        <run class="p.C"/>
    </ajc-test> 
 
index d92762a5d6834f06568c98837d3c67bb1e2ab3d6..c42dbb642958e34ae4617d3bac4557b0a51e239a 100644 (file)
     </ajc-test>
     
     <ajc-test dir="java5/ataspectj/annotationGen" title="ann gen for itds">
-        <compile files="ITDTest.aj" options="-1.5, -outxml">
+        <compile files="ITDTest.aj" options="-1.5, -outxml -Xlint:ignore">
         </compile>
         <run class="a.b.c.ITDTest" ltw=""/>
     </ajc-test>    
index 7e209d0b582c00b9f2d5967dc645485085b3b231..4407a8106dee4bc2755fe8dc0c586912bdac2595 100644 (file)
@@ -77,6 +77,13 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("E extends Enum(E) again");
   }
   
+  public void testSwallowedException() {
+         runTest("swallowed exceptions");
+  }
+  
+  public void testSwallowedExceptionIgnored() {
+         runTest("swallowed exceptions with xlint");
+  }
   /*
    * @AspectJ bugs and enhancements
    */
index e3b67929abf0891f522c3c307be0a058679cc151..10102fc77773fe0e0916bd05ed41156f6418decd 100644 (file)
           </stderr>
         </run>
     </ajc-test>  
+    
+    <ajc-test dir="features151/swallowedExceptions" title="swallowed exceptions">
+        <compile files="SwallowedException.java">
+            <message kind="warning" line="11" text="Exception swallowed in catch block"/>
+        </compile>
+    </ajc-test>
 
+    <ajc-test dir="features151/swallowedExceptions" title="swallowed exceptions with xlint">
+        <compile files="SwallowedException.java" options="-Xlint:ignore">
+        </compile>
+    </ajc-test>
 </suite>
\ No newline at end of file
index bb5bd265ff6c0f4b5cc9aba18f3836da565cecd3..5f201b355f157f4c9831716dcce3c33a051dc533 100644 (file)
        <ajc-test 
                dir="bugs/interfaceLibrary"
                title="exception clause for aspect-declared interface methods - positive">
-               <compile files="Client.java,LibraryAspect.java,lib/LibraryInterface.java"/>
+               <compile files="Client.java,LibraryAspect.java,lib/LibraryInterface.java" options="-Xlint:ignore"/>
                <run class="Client"/>
                </ajc-test>
 
        <ajc-test 
                dir="bugs/interfaceLibrary"
                title="exception clause for aspect-declared class methods - positive">
-               <compile files="ClassClient.java,LibraryClassAspect.java,lib/LibraryClass.java"/>
+               <compile files="ClassClient.java,LibraryClassAspect.java,lib/LibraryClass.java" options="-Xlint:ignore"/>
                <run class="ClassClient"/>
                </ajc-test>
 
        <ajc-test dir="bugs/interfaceLibrary"
                pr="41175"
                title="exception clause for aspect-declared interface methods - positive binary">
-               <compile files="Client.java" aspectpath="lib.jar"/>
+               <compile files="Client.java" aspectpath="lib.jar" options="-Xlint:ignore"/>
                <run class="Client"/>
                </ajc-test>
 
        <ajc-test dir="bugs/interfaceLibrary"
                pr="41175"
                title="exception clause for aspect-declared class methods - positive binary">
-               <compile files="ClassClient.java" aspectpath="libClass.jar"/>
+               <compile files="ClassClient.java" aspectpath="libClass.jar" options="-Xlint:ignore"/>
                <run class="ClassClient"/>
                </ajc-test>
 
index c58e2561f7c715fbc7dfd094b5863584dd614727..9da9ac8f00b511cc9085f4b96edfabf98aa570e9 100644 (file)
@@ -50,7 +50,9 @@
 
     <ajc-test dir="design/intro"
       title="declared exceptions are checked correctly on intros">
-        <compile files="ExceptionsCP.java"/>
+      <compile files="ExceptionsCP.java">
+        <message kind="warning" line="10" text="Exception swallowed in catch block"/>        
+      </compile>
         <run class="ExceptionsCP"/>
     </ajc-test>
 
@@ -77,7 +79,7 @@
 
     <ajc-test dir="design/reflect" title="Checking new joinpoints"
       keywords="from-design">
-        <compile files="Coverage.java"/>
+        <compile files="Coverage.java" options="-Xlint:ignore"/>
         <run class="Coverage"/>
     </ajc-test>
 
index 075b1d07fff079dbcf8d8caf46f51bcb966ecae1..3f00f080365483304af01776837dab2b8c221f22 100644 (file)
@@ -40,7 +40,7 @@
     <ajc-test dir="incremental/model/introduction" 
        title="Testing incremental structure model: Intertype declarations (and a declare parents)" 
        keywords="incremental-test,model-test" >
-        <compile staging="true" options="-incremental,-emacssym" sourceroots="src"/>
+        <compile staging="true" options="-incremental,-emacssym -Xlint:ignore" sourceroots="src"/>
         <inc-compile tag="20"/> <!-- Just 'touched' one file -->
         <inc-compile tag="30"/> <!-- Just 'touched another aspect -->
      </ajc-test>
index 939902b9eba66f452c7f0ace420d7aa00f9f6d40..03ab2daefab37528d35581542c791692ff165a49 100644 (file)
@@ -91,13 +91,16 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
        // Make simple changes to a project, adding a class and an aspect
        public void testAddingAnAspect() {
                initialiseProject("P1");
-               build("P1");
+               build("P1");                                                    // build 1, weave 1
                alter("P1","inc1"); // adds a class
                alter("P1","inc2"); // adds an aspect
-               build("P1");
+               build("P1");                            // build 1,
                long timeTakenForFullBuildAndWeave = getTimeTakenForBuild();
-               checkWasntFullBuild();
-               checkCompileWeaveCount(2,3);
+               checkWasFullBuild();  // it *will* be a full build under the new 
+                                     // "back-to-the-source strategy
+               checkCompileWeaveCount(5,3); // we compile X and A (the delta) find out that
+                                            // an aspect has changed, go back to the source
+                                                                        // and compile X,A,C, then weave them all.
                build("P1");
                long timeTakenForSimpleIncBuild = getTimeTakenForBuild();
                // I don't think this test will have timing issues as the times should be *RADICALLY* different
@@ -145,7 +148,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                alter("P1","inc1"); // adds a class
                alter("P1","inc2"); // adds an aspect
                build("P1");
-               checkWasntFullBuild();
+               checkWasFullBuild();  // adding an aspect makes us go back to the source
        }
        
        
@@ -307,7 +310,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                checkForError("only abstract aspects can have type parameters");
                alter("PR125405","inc2");
                build("PR125405");
-               checkCompileWeaveCount(1,1);
+               checkCompileWeaveCount(2,1);
                assertTrue("Should be no errors, but got "+MyTaskListManager.getErrorMessages(),MyTaskListManager.getErrorMessages().size()==0);                
        }
        
@@ -348,10 +351,10 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                build("pr114875");
                alter("pr114875","inc1");
                build("pr114875");
-               checkWasntFullBuild();
+               checkWasFullBuild();
                alter("pr114875","inc2");
                build("pr114875");
-               checkWasntFullBuild();
+               checkWasFullBuild();  // back to the source for an aspect change
        }
        
        public void testPr117882() {
@@ -362,7 +365,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                checkWasFullBuild();
                alter("PR117882","inc1");
                build("PR117882");
-               checkWasntFullBuild();
+               checkWasFullBuild();  // back to the source for an aspect
 //             AjdeInteractionTestbed.VERBOSE=false;
 //             AjdeInteractionTestbed.configureBuildStructureModel(false);
        }
@@ -375,7 +378,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                checkWasFullBuild();
                alter("PR117882_2","inc1");
                build("PR117882_2");
-               checkWasntFullBuild();
+               checkWasFullBuild();  // back to the source...
                //checkCompileWeaveCount(1,4);
                //fullBuild("PR117882_2");
                //checkWasFullBuild();
@@ -390,7 +393,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                checkWasFullBuild();
                alter("PR115251","inc1");
                build("PR115251");
-               checkWasntFullBuild();
+               checkWasFullBuild();  // back to the source
        }
        
 
@@ -502,7 +505,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                build("PR113257");
                alter("PR113257","inc1");
                build("PR113257");
-               checkWasntFullBuild();
+               checkWasFullBuild();  // back to the source
                alter("PR113257","inc1");
                build("PR113257");
        }
@@ -512,7 +515,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                build("PR123612");
                alter("PR123612","inc1");
                build("PR123612");
-               checkWasntFullBuild();
+               checkWasFullBuild(); // back to the source
        }
        
        // other possible tests:
index 4d4cb999dedb8f44d44eee59c24e655d779f3738..0dbdce7bdb9c9b519d83788892ee9974daa1fd62 100644 (file)
         <compile files="UndeclaredThrows.java">
             <message kind="error" line="12"/>
             <message kind="error" line="18"/>
+            <message kind="warning" line="18" text="Exception swallowed in catch block"/>
         </compile>
     </ajc-test>