mjc

org.multijava.mjc
Class TestMain_Typecheck

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.multijava.util.testing.TestCase
              extended byorg.multijava.mjc.FunctionalTestSuite.TestCase
                  extended byorg.multijava.mjc.TestMain_Typecheck
All Implemented Interfaces:
junit.framework.Test

public class TestMain_Typecheck
extends FunctionalTestSuite.TestCase


Nested Class Summary
 
Nested classes inherited from class org.multijava.mjc.FunctionalTestSuite.TestCase
FunctionalTestSuite.TestCase.CodeGenResults, FunctionalTestSuite.TestCase.CompilationResults, FunctionalTestSuite.TestCase.Processor, FunctionalTestSuite.TestCase.RuntimeResults
 
Field Summary
 
Fields inherited from class org.multijava.mjc.FunctionalTestSuite.TestCase
workingDir
 
Fields inherited from class org.multijava.util.testing.TestCase
NEWLINE
 
Fields inherited from class junit.framework.TestCase
 
Constructor Summary
TestMain_Typecheck(String name)
           
 
Method Summary
 void test_ambiguity_1()
          Should fail since augmenting method induces an ambiguity.
 void test_ambiguity_2()
          Typechecker should detect ambiguity on < Ambiguity2,Number[],Number[] >.
 void test_ambiguity_3()
          Typechecker should not detect ambiguity on overloaded methods because one is private.
 void test_ambiguity_4()
          Typechecker should detect ambiguity on < Ambiguity4B,Ambiguity4B > because Ambiguity4B has types Ambiguity4A and Comparable.
 void test_ambiguity_5()
          Typechecker should detect ambiguity on < Ambiguity5B,Ambiguity5E2 >
 void test_augmenting_this_1()
          Regular methods of the augmented object can be accessed with or without an explicit "this".
 void test_augmenting_this_10()
          Final local variables of an augmenting method can be accessible from within inner classes.
 void test_augmenting_this_2()
          Augmenting methods of the augmented object can be accessed with or without an explicit "this".
 void test_augmenting_this_3()
          Methods of the receiver class of an augmenting method can be accessed from within an anonymous class of the augmenting method, with or without an explicit this.
 void test_augmenting_this_4()
          Regular fields of the augmented object can be accessed with or without an explicit "this".
 void test_augmenting_this_5()
          Fields of the receiver class of an augmenting method can be accessed from within an anonymous class of the augmenting method, with or without an explicit this.
 void test_augmenting_this_6()
          Static inner classes of the augmented object can be referenced with or without the augmented object's class name.
 void test_augmenting_this_7()
          Inner classes of the augmented object can be instantiated with or without an explicit this.
 void test_augmenting_this_8()
          Methods of the receiver class of an augmenting method can be accessed from within a class declaration statement of the augmenting method, with or without an explicit this.
 void test_augmenting_this_9()
          Fields of the receiver class of an augmenting method can be accessed from within a class declaration statement of the augmenting method, with or without an explicit this.
 void test_badSpec_1()
          specializer must be proper subtype
 void test_badSpec_3()
          cannot specialize to non-reference type
 void test_badSpec_5()
          cannot specialize to interface type
 void test_badSpec_6()
          specializer must be proper subtype
 void test_badSpec_7()
          specializer must be proper subtype
 void test_badSpec_8()
          Typechecker should disallow specialization to an array of primitive types.
 void test_badSpec_9()
          Typechecker should disallow specialization to an array of interface types.
 void test_catch_1()
          Typechecker should allow properly ordered catches on exceptions from the same hierarchy.
 void test_catch_2()
          Typechecker should give a warning because catch for Catch2B is unreachable.
 void test_catch_3()
          Typechecker should signal error because second catch for RuntimeException is unreachable.
 void test_catch_4()
          Typechecker should signal error because the catch for CloneNotSupportedException is unreachable.
 void test_class_access_1()
          Classes inherit (non-private) classes from superclasses and interfaces.
 void test_class_access_2()
          Classes inherit (non-private) classes from superclasses and interfaces.
 void test_class_access_3()
          Classes cannot instantiate private inner class of another public class.
 void test_class_access_4()
          Inner classes hide inner classes of the same name in superclasses and superinterfaces.
 void test_constructor_1()
           
 void test_defAssn1()
          A variable that is assigned to in both branches on an if-then-else statement is definitely assigned.
 void test_defAssn10()
          Access to outer variables.
 void test_defAssn11()
          Access to outer variables.
 void test_defAssn12()
          Access to outer variables.
 void test_defAssn2()
          A variable that is assigned to after a reachable statement of a block is definitely assigned after the block.
 void test_defAssn3()
          Final fields may only be assigned to once, but once in each branch of an if-then-else statement is OK.
 void test_defAssn4()
          A variable is only definitely assigned if it is assigned in all possible paths.
 void test_defAssn5()
          Static fields are assumed to be assigned after static initializers have been checked.
 void test_defAssn6()
          A variable is definitely assigned if it is assigned on all paths that can reach the reference.
 void test_defAssn7()
          A variable is definitely assigned if it is assigned on all paths that can reach the reference.
 void test_defAssn8()
          A variable is definitely assigned if it is assigned on all paths that can reach the reference.
 void test_defAssn9()
          A variable is definitely assigned if it is assigned on all paths that can reach the reference.
 void test_dup_class_2()
          Cannot import two classes with the same name in the same compilation unit.
 void test_field_access_1()
          Regular fields of the augmented object can be accessed with or without an explicit "this".
 void test_final_1()
          A final variable can only be assigned to once.
 void test_final_10()
          A final field must be assigned to before being used.
 void test_final_11()
          Explicit this() constructor calls are assumed to result in all final instance fields being initialized.
 void test_final_12()
          We were seeing some strange bugs with references to final fields of other instances of the local class from within constructors.
 void test_final_13()
          We were seeing some strange bugs with references to final fields of other instances of the local class from within constructors.
 void test_final_14()
          A constructor can use a final field initialized in an initializer.
 void test_final_15()
          Two disjoint constructors can initialize a blank final field.
 void test_final_2()
          A final field can only be assigned to once.
 void test_final_3()
          A final variable can only be assigned to once.
 void test_final_4()
          A final field can only be assigned to once.
 void test_final_5()
          A final field can only be assigned to once.
 void test_final_6()
          A final field can only be assigned to once.
 void test_final_7()
          A final field in an interface must be initialized.
 void test_final_8()
          A final field in an interface must be initialized.
 void test_final_9()
          A final field must be assigned to before being used.
 void test_goodSpec_1()
          Typechecker should allow specialization of Object to any (non-primitive, non-interface) array type.
 void test_goodSpec_3()
          interface types can be specialized
 void test_goodSpec_4()
          Simplest specializer test.
 void test_inner_resolve1()
           
 void test_inner_this_1()
          Methods of the outer class can be accessed from within an anonymous class, with or without an explicit "this".
 void test_inner_this_2()
          Fields of the outer class can be accessed from within an anonymous class, with or without an explicit "this".
 void test_inner_this_3()
          References to fields of an outer class cannot cross a static lexical contour.
 void test_internalize_3()
          Private augmenting generic functions should be accessible to other augmenting generic functions in the same compilation unit.
 void test_local1()
          A local variable cannot appear within the scope of another local variable of the same name (JLS2 14.4.2).
 void test_local2()
          A switch statement's body is a new block, so local variables defined in the body are not visible outside the switch.
 void test_local3()
          A for statement is a new block, so local variables defined in the initializer are not visible outside the for loop.
 void test_local4()
          A for statement is a new block, so local variables defined in the initializer are not visible outside the for loop.
 void test_local5()
          The scope of a variable declared in a switch group is all of the switch statement following the declaration.
 void test_local6()
          The scope of a variable declared in a switch group is all of the switch statement following the declaration, even without fall through.
 void test_local7()
          Typechecking of switches had a bug where a case with fall-through entry and a declaration signalled a duplicate declaration.
 void test_method_access_1()
          Private methods are not inherited and so subclass can change return type.
 void test_pleomorphic_1()
          The pleomorphic method should be allowed since both generic functions are internal.
 void test_pleomorphic_2()
          The pleomorphic method should be allowed by static typechecking.
 void test_pleomorphic_3()
          The pleomorphic method should be disallowed by static typechecking since both top methods are concrete.
 void test_pleomorphic_4()
          The pleomorphic method should be disallowed by static typechecking since both top methods are concrete.
 void test_pleomorphic_5()
          The pleomorphic method should be disallowed by static typechecking since both top methods are concrete.
 void test_reachable1()
          The end of the method block cannot be reached (i.e., every control flow path reaches a statement that completes abruptly.
 void test_reachable2()
          Conditional breaks inside switches.
 void test_reachable3()
          Check for warning on a case that falls through, except for the last case.
 void test_reachable4()
          Conditional continues inside for-loops.
 void test_reachable5()
          Conditional continues inside for-loops.
 void test_reorder_1()
          Changing the order of multimethod declarations shouldn't impact the results of duplicate method checks.
 void test_reorder_2()
          Changing the order of multimethod declarations shouldn't impact the results of duplicate method checks.
 void test_reorder_3()
          Changing the order of multimethod declarations shouldn't impact the results of duplicate method checks.
 void test_Return1()
          Return statements may not appear in initializers.
 void test_simple_class_1()
          Should successfully compile the (very simple) source code.
 void test_simple_class_2()
          Should fail on the malformed class declaration.
 void test_simple_class_3()
          Should fail on the malformed class declaration.
 void test_split_method1()
           
 void test_switchLabels1()
          Labels must be unique.
 void test_switchLabels2()
          Labels must be unique.
 void test_switchLabels3()
          Labels must be unique.
 void test_switchLabels4()
          Labels must be unique.
 void test_switchLabels5()
          Labels must be constants.
 void test_switchLabels6()
          Labels must be constants.
 void test_switchLabels7()
          Constant labels may be defined in unreachable code.
 
Methods inherited from class org.multijava.mjc.FunctionalTestSuite.TestCase
cleanWorkingDir, compile, disasm, expectFailure, expectSuccess, invokeCompiler, remove, run, saveAs, setUp, split, tearDown
 
Methods inherited from class org.multijava.util.testing.TestCase
assertDiff, assertEquals
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestMain_Typecheck

public TestMain_Typecheck(String name)
Method Detail

test_split_method1

public void test_split_method1()

test_simple_class_1

public void test_simple_class_1()
Should successfully compile the (very simple) source code.


test_simple_class_2

public void test_simple_class_2()
Should fail on the malformed class declaration.


test_simple_class_3

public void test_simple_class_3()
Should fail on the malformed class declaration.


test_constructor_1

public void test_constructor_1()

test_pleomorphic_1

public void test_pleomorphic_1()
The pleomorphic method should be allowed since both generic functions are internal.


test_pleomorphic_2

public void test_pleomorphic_2()
The pleomorphic method should be allowed by static typechecking.


test_pleomorphic_3

public void test_pleomorphic_3()
The pleomorphic method should be disallowed by static typechecking since both top methods are concrete.


test_pleomorphic_4

public void test_pleomorphic_4()
The pleomorphic method should be disallowed by static typechecking since both top methods are concrete.


test_pleomorphic_5

public void test_pleomorphic_5()
The pleomorphic method should be disallowed by static typechecking since both top methods are concrete.


test_goodSpec_1

public void test_goodSpec_1()
Typechecker should allow specialization of Object to any (non-primitive, non-interface) array type.


test_goodSpec_3

public void test_goodSpec_3()
interface types can be specialized


test_goodSpec_4

public void test_goodSpec_4()
Simplest specializer test.


test_badSpec_1

public void test_badSpec_1()
specializer must be proper subtype


test_badSpec_3

public void test_badSpec_3()
cannot specialize to non-reference type


test_badSpec_5

public void test_badSpec_5()
cannot specialize to interface type


test_badSpec_6

public void test_badSpec_6()
specializer must be proper subtype


test_badSpec_7

public void test_badSpec_7()
specializer must be proper subtype


test_badSpec_8

public void test_badSpec_8()
Typechecker should disallow specialization to an array of primitive types.


test_badSpec_9

public void test_badSpec_9()
Typechecker should disallow specialization to an array of interface types.


test_ambiguity_1

public void test_ambiguity_1()
Should fail since augmenting method induces an ambiguity.


test_ambiguity_2

public void test_ambiguity_2()
Typechecker should detect ambiguity on < Ambiguity2,Number[],Number[] >.


test_ambiguity_3

public void test_ambiguity_3()
Typechecker should not detect ambiguity on overloaded methods because one is private.


test_ambiguity_4

public void test_ambiguity_4()
Typechecker should detect ambiguity on < Ambiguity4B,Ambiguity4B > because Ambiguity4B has types Ambiguity4A and Comparable.


test_ambiguity_5

public void test_ambiguity_5()
Typechecker should detect ambiguity on < Ambiguity5B,Ambiguity5E2 >


test_catch_1

public void test_catch_1()
Typechecker should allow properly ordered catches on exceptions from the same hierarchy.


test_catch_2

public void test_catch_2()
Typechecker should give a warning because catch for Catch2B is unreachable.


test_catch_3

public void test_catch_3()
Typechecker should signal error because second catch for RuntimeException is unreachable.


test_catch_4

public void test_catch_4()
Typechecker should signal error because the catch for CloneNotSupportedException is unreachable.


test_augmenting_this_1

public void test_augmenting_this_1()
Regular methods of the augmented object can be accessed with or without an explicit "this".


test_augmenting_this_2

public void test_augmenting_this_2()
Augmenting methods of the augmented object can be accessed with or without an explicit "this".


test_augmenting_this_3

public void test_augmenting_this_3()
Methods of the receiver class of an augmenting method can be accessed from within an anonymous class of the augmenting method, with or without an explicit this.


test_augmenting_this_4

public void test_augmenting_this_4()
Regular fields of the augmented object can be accessed with or without an explicit "this".


test_augmenting_this_5

public void test_augmenting_this_5()
Fields of the receiver class of an augmenting method can be accessed from within an anonymous class of the augmenting method, with or without an explicit this.


test_augmenting_this_6

public void test_augmenting_this_6()
Static inner classes of the augmented object can be referenced with or without the augmented object's class name.


test_augmenting_this_7

public void test_augmenting_this_7()
Inner classes of the augmented object can be instantiated with or without an explicit this.


test_augmenting_this_8

public void test_augmenting_this_8()
Methods of the receiver class of an augmenting method can be accessed from within a class declaration statement of the augmenting method, with or without an explicit this.


test_augmenting_this_9

public void test_augmenting_this_9()
Fields of the receiver class of an augmenting method can be accessed from within a class declaration statement of the augmenting method, with or without an explicit this.


test_augmenting_this_10

public void test_augmenting_this_10()
Final local variables of an augmenting method can be accessible from within inner classes.


test_inner_this_1

public void test_inner_this_1()
Methods of the outer class can be accessed from within an anonymous class, with or without an explicit "this".


test_inner_this_2

public void test_inner_this_2()
Fields of the outer class can be accessed from within an anonymous class, with or without an explicit "this".


test_inner_this_3

public void test_inner_this_3()
References to fields of an outer class cannot cross a static lexical contour.


test_field_access_1

public void test_field_access_1()
Regular fields of the augmented object can be accessed with or without an explicit "this".


test_class_access_1

public void test_class_access_1()
Classes inherit (non-private) classes from superclasses and interfaces. JLS2 6.5.5


test_class_access_2

public void test_class_access_2()
Classes inherit (non-private) classes from superclasses and interfaces. JLS2 6.5.5. Both inner classes are inherited resulting in an ambiguity


test_class_access_3

public void test_class_access_3()
Classes cannot instantiate private inner class of another public class.


test_class_access_4

public void test_class_access_4()
Inner classes hide inner classes of the same name in superclasses and superinterfaces.


test_method_access_1

public void test_method_access_1()
Private methods are not inherited and so subclass can change return type.


test_internalize_3

public void test_internalize_3()
Private augmenting generic functions should be accessible to other augmenting generic functions in the same compilation unit.


test_dup_class_2

public void test_dup_class_2()
Cannot import two classes with the same name in the same compilation unit.


test_reorder_1

public void test_reorder_1()
Changing the order of multimethod declarations shouldn't impact the results of duplicate method checks.


test_reorder_2

public void test_reorder_2()
Changing the order of multimethod declarations shouldn't impact the results of duplicate method checks.


test_reorder_3

public void test_reorder_3()
Changing the order of multimethod declarations shouldn't impact the results of duplicate method checks.


test_final_1

public void test_final_1()
A final variable can only be assigned to once. JLS2 4.5.4


test_final_2

public void test_final_2()
A final field can only be assigned to once. JLS2 8.3.1.2


test_final_3

public void test_final_3()
A final variable can only be assigned to once. JLS2 4.5.4


test_final_4

public void test_final_4()
A final field can only be assigned to once. JLS4 8.3.1.4


test_final_5

public void test_final_5()
A final field can only be assigned to once. JLS2 8.3.1.2


test_final_6

public void test_final_6()
A final field can only be assigned to once. JLS4 8.3.1.4


test_final_7

public void test_final_7()
A final field in an interface must be initialized.


test_final_8

public void test_final_8()
A final field in an interface must be initialized.


test_final_9

public void test_final_9()
A final field must be assigned to before being used.


test_final_10

public void test_final_10()
A final field must be assigned to before being used.


test_final_11

public void test_final_11()
Explicit this() constructor calls are assumed to result in all final instance fields being initialized.


test_final_12

public void test_final_12()
We were seeing some strange bugs with references to final fields of other instances of the local class from within constructors.


test_final_13

public void test_final_13()
We were seeing some strange bugs with references to final fields of other instances of the local class from within constructors.


test_final_14

public void test_final_14()
A constructor can use a final field initialized in an initializer.


test_final_15

public void test_final_15()
Two disjoint constructors can initialize a blank final field.


test_local1

public void test_local1()
A local variable cannot appear within the scope of another local variable of the same name (JLS2 14.4.2).


test_local2

public void test_local2()
A switch statement's body is a new block, so local variables defined in the body are not visible outside the switch.


test_local3

public void test_local3()
A for statement is a new block, so local variables defined in the initializer are not visible outside the for loop.


test_local4

public void test_local4()
A for statement is a new block, so local variables defined in the initializer are not visible outside the for loop.


test_local5

public void test_local5()
The scope of a variable declared in a switch group is all of the switch statement following the declaration.


test_local6

public void test_local6()
The scope of a variable declared in a switch group is all of the switch statement following the declaration, even without fall through.


test_local7

public void test_local7()
Typechecking of switches had a bug where a case with fall-through entry and a declaration signalled a duplicate declaration.


test_defAssn1

public void test_defAssn1()
A variable that is assigned to in both branches on an if-then-else statement is definitely assigned.


test_defAssn2

public void test_defAssn2()
A variable that is assigned to after a reachable statement of a block is definitely assigned after the block.


test_defAssn3

public void test_defAssn3()
Final fields may only be assigned to once, but once in each branch of an if-then-else statement is OK.


test_defAssn4

public void test_defAssn4()
A variable is only definitely assigned if it is assigned in all possible paths.


test_defAssn5

public void test_defAssn5()
Static fields are assumed to be assigned after static initializers have been checked.


test_defAssn6

public void test_defAssn6()
A variable is definitely assigned if it is assigned on all paths that can reach the reference.


test_defAssn7

public void test_defAssn7()
A variable is definitely assigned if it is assigned on all paths that can reach the reference.


test_defAssn8

public void test_defAssn8()
A variable is definitely assigned if it is assigned on all paths that can reach the reference.


test_defAssn9

public void test_defAssn9()
A variable is definitely assigned if it is assigned on all paths that can reach the reference.


test_defAssn10

public void test_defAssn10()
Access to outer variables.


test_defAssn11

public void test_defAssn11()
Access to outer variables.


test_defAssn12

public void test_defAssn12()
Access to outer variables.


test_switchLabels1

public void test_switchLabels1()
Labels must be unique.


test_switchLabels2

public void test_switchLabels2()
Labels must be unique.


test_switchLabels3

public void test_switchLabels3()
Labels must be unique.


test_switchLabels4

public void test_switchLabels4()
Labels must be unique.


test_switchLabels5

public void test_switchLabels5()
Labels must be constants.


test_switchLabels6

public void test_switchLabels6()
Labels must be constants.


test_switchLabels7

public void test_switchLabels7()
Constant labels may be defined in unreachable code. Very weird.


test_Return1

public void test_Return1()
Return statements may not appear in initializers.


test_reachable1

public void test_reachable1()
The end of the method block cannot be reached (i.e., every control flow path reaches a statement that completes abruptly.


test_reachable2

public void test_reachable2()
Conditional breaks inside switches.


test_reachable3

public void test_reachable3()
Check for warning on a case that falls through, except for the last case.


test_reachable4

public void test_reachable4()
Conditional continues inside for-loops.


test_reachable5

public void test_reachable5()
Conditional continues inside for-loops.


test_inner_resolve1

public void test_inner_resolve1()

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.